Automatic database coversion script anyone?
ondrej at sury.org
Sun Apr 17 15:20:42 EDT 2011
On Sun, Apr 17, 2011 at 19:55, Bron Gondwana <brong at fastmail.fm> wrote:
> On Tue, Apr 05, 2011 at 02:58:12AM +0200, Ondřej Surý wrote:
>> You cannot backup (using DB_ENV->archive) before you upgrade, but if
>> you find a way how to call (backend)->init with CYRUSDB_UPGRADE flag
>> and them (backend)->open with same flag, the attached patch should do
>> the trick. (But I advise to review the patch - it's 3AM here...)
> + r = db-close(db, 0);
> Yes, review would be good :)
> Apart from little syntax nitpicks though - the concept looks good.
> One question: we can't tell easily if the DB is an old version I
> don't think.
if (r == DB_OLD_VERSION)
after db->open(...) would do the trick.
> Would it make more sense to try to open it without
> the upgrade flag first, and only if that fails to do the upgrade?
> I'm thinking it would be good in that case to copy the file to a
> temporary location and upgrade the temporary DB, then close it and
> copy it back if the upgrade succeeds.
Ondřej Surý <ondrej at sury.org>
More information about the Cyrus-devel