From mboxrd@z Thu Jan 1 00:00:00 1970 From: Theodore Ts'o Subject: Re: light weight write barriers Date: Thu, 25 Oct 2012 14:29:48 -0400 Message-ID: <20121025182948.GB16257@thunk.org> References: <5086F5A7.9090406@vlnb.net> <20121025060231.GC9860@thunk.org> <20121025140327.GB13562@thunk.org> Reply-To: General Discussion of SQLite Database Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: General Discussion of SQLite Database , drh-X1OJI8nnyKUAvxtiuMwx3w@public.gmane.org, linux-kernel , linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: david-gFPdbfVZQbY@public.gmane.org Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: sqlite-users-bounces-CzDROfG0BjIdnm+yROfE0A@public.gmane.org Errors-To: sqlite-users-bounces-CzDROfG0BjIdnm+yROfE0A@public.gmane.org List-Id: linux-fsdevel.vger.kernel.org On Thu, Oct 25, 2012 at 11:03:13AM -0700, david-gFPdbfVZQbY@public.gmane.org wrote: > I agree, this is why I'm trying to figure out the recommended way to > do this without needing to do full commits. > > Since in most cases it's acceptable to loose the last few chunks > written, if we had some way of specifying ordering, without having > to specify "write this NOW", the solution would be pretty obvious. Well, using data journalling with ext3/4 may do what you want. If you don't do any fsync, the changes will get written every 5 seconds when the automatic journal sync happens (and sub-4k writes will also get coalesced to a 5 second granularity). Even with plain text files, it's pretty easy to tell whether or not the final record is a partially written or not after a crash; just look for a trailing newline. Better yet, if you are writing to multiple log files with data journalling, all of the writes will happen at the same time, and they will be streamed to the file system journal, minimizing random writes for at least the journal writes. - Ted