<div dir="ltr">Thanks Dave,<div><br></div><div>The automatic prealloc removal, if no new writes after 5 minutes, sounds perfect for my use case.  But realistically, I'm not likely to get our org to push/find an os update just for this purpose too easily.</div>
<div><br></div><div>So, in the meantime, the question remains, assuming I have the version I have currently (dynamic preallocation, persists indefinitely until the file is closed/app quits, etc.), will this idea work (e.g. close the file after writing, then re-open read-only?).  Currently, the app does keep the files open indefinitely long after writing has stopped, and this is of course resulting in the preallocation persisting indefinitely.</div>
<div><br></div><div>Jason</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jul 26, 2013 at 9:30 PM, Dave Chinner <span dir="ltr"><<a href="mailto:david@fromorbit.com" target="_blank">david@fromorbit.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Fri, Jul 26, 2013 at 05:11:55PM -0400, Jason Rosenberg wrote:<br>
</div><div class="im">> Is it safe to say that speculative preallocation will not be used if a file<br>
> is opened read-only?<br>
><br>
> It turns out that the kafka server does indeed write lots of log files, and<br>
> rotate them after they reach a max size, but never closes the files until<br>
> the app exits, or until it deletes the files.  This is because it needs to<br>
> make them available for reading, etc.   So, an obvious change for kafka<br>
> might be to close each log file after rotating, and then re-open it<br>
> read-only for consumers of the data.  Does that sound like a solution that<br>
> would pro-actively release pre-allocated storage?<br>
<br>
</div>No need - the mainline code that has a periodic background scan that<br>
stops buildup of unused prealocation. i.e. if the file is clean for<br>
5 minutes, then the prealloc will be removed. Hence it doesn't<br>
matter what the application does with it - if it holds it open and<br>
doesn't write to the file, then the prealloc will get removed. More<br>
will be added the next time the file is written, but until then it<br>
won't use excessive space.<br>
<div class="HOEnZb"><div class="h5"><br>
Cheers,<br>
<br>
Dave.<br>
--<br>
Dave Chinner<br>
<a href="mailto:david@fromorbit.com">david@fromorbit.com</a><br>
</div></div></blockquote></div><br></div>