Ticket #229 (assigned defect)

Opened 10 months ago

Last modified 9 months ago

Stub databases should be read with msvc_posix_open

Reported by: richard Owned by: richard
Priority: normal Milestone:
Component: Other Version: SVN trunk
Severity: normal Keywords:
Cc: olly Blocked By:
Operating System: Microsoft Windows Blocking:

Description

Currently, stub databases are read using a standard C++ ifstream. (See backends/database.cc, function open_stub()) This works fine, except that if a user (or the database replication code) tries, on Windows, to atomically rename a new stub db file over an existing one, it will receive an error if the old stub DB file was open.

This can be avoided if we instead use msvc_posix_open() (or just open() on unix) in open_stub() to get a file handle for the stub database, and access it using C file-handling routines.

Change History

Changed 10 months ago by richard

  • status changed from new to assigned

Changed 9 months ago by olly

  • cc olly@… added

hmm, but if we do this, what happens on windows if the file is overwritten while we're reading it? The read will fail I believe...

Changed 9 months ago by trac

  • platform set to Microsoft Windows

Changed 9 months ago by richard

So, a full fix would probably have to handle failures of the read, and retry. What a pain.

Changed 9 months ago by olly

Ah yes, that should work if the read returns a suitable error (which I think it does).

Note: See TracTickets for help on using tickets.