comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Truncating Direct IO files
Date: Tue, 21 Apr 2015 09:47:24 +0200
Date: 2015-04-21T09:47:24+02:00	[thread overview]
Message-ID: <1tufk7ruhyejt.1tyb01i9kotm1.dlg@40tude.net> (raw)
In-Reply-To: 8323246f-eb13-49e8-9e0c-5c5ec1002060@googlegroups.com

On Tue, 21 Apr 2015 00:30:37 -0700 (PDT), tonyg wrote:

> I am recording records to disk. Sometimes I replace thes records with a
> smaller set of records.

Do you rewrite all file then? In that case you could simply work with a
copy and delete the original, in a sort of double-buffering manner.

> I could delete the file each time but would prefer to truncate the file. I
> can't see a way of doing this, can you?

There seems no way doing that without OS.

In my implementation of a persistent storage pool I simply maintain the
list of free elements and reuse them later.

BTW, I don't overwrite any file elements within single transaction. I don't
know what you are doing, but consider a scenario when the application or
the whole system crashes in the middle of file updating. Would that corrupt
the data?

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  reply	other threads:[~2015-04-21  7:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-21  7:30 Truncating Direct IO files tonyg
2015-04-21  7:47 ` Dmitry A. Kazakov [this message]
2015-04-21  8:20   ` tonyg
2015-04-21  9:17     ` Dmitry A. Kazakov
2015-04-21 22:01 ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox