Backups

Wednesday, 16 October 2019 · 4 messages · last reply 9 Nov 2019
CG
Christoph Gaukel16 Oct 2019 13:34 #
Hi, the following handling of backups is surprising: * db:alter changes the name of the database but does not alter the names of the corresponding backups * db:drop deletes both, the database and the corresponding backups I would prefer, if there was an option in db:drop to keep the backups, which would allow to restore a deleted database from their backups. Is it possible to add options to db:drop, which allow that? For me, the behavior of db:alter looks like a bug. There is another minor handling, i would like to have changed:
  * db:info($db)/resourceproperties/inputdate is a UTC dateTime with a
    time zone offset
  * db:backups($db)/@date is a local dateTime without a time zone offset
If I compare these two, it works correctly if the local time zone offset is the same as for the creation of the backup E.g.:
if (
      not(db:backups($db)) or
      max(db:backups($db)/@date/(. cast as xs:dateTime)) <
      db:info($db)/resourceproperties/inputdate/. cast as xs:dateTime
    ) then db:create-backup($db)
    else ()
Adding a time zone offset +hh:mm or -hh:mm to db:backups($db)/@date would solve this. Thanks, Christoph
CG
Christian Grün18 Oct 2019 10:25 #
Hi Christoph, Welcome back to the list.
Quoted text · Christoph Gaukel · 1 line
> db:drop deletes both, the database and the corresponding backups
The function should only delete database and preserve backups. For deleting backups, db:drop-backup can be used. Maybe there was a bug in an older version of BaseX?
Quoted text · Christoph Gaukel · 2 lines
> db:info($db)/resourceproperties/inputdate is a UTC dateTime with a time zone offset > db:backups($db)/@date is a local dateTime without a time zone offset
Same here: Both returned timezones should be a UTC dateTime with the Z time offset. Maybe you need to switch to the latest version of BaseX? Feel free to give us an update if the problems persist with BaseX 9.x. Hope this helps, Christian
CG
Christian Grün21 Oct 2019 14:45 #
Hi Christoph,
Quoted text · Christian Grün · 1 line
> db_alter() has not changed. It alters the name of the database but the corresponding backups stay unchanged. I combine it with db:drop-backup()
That’s true: db:alter() will only rename databases. This has been a deliberate design choice (in analogy with db:drop, a user might want to treat backups differently than the currently active instance); but I think we should add an additional db:alter-backup function. I have just created an issue for that [1]; Thanks for the observation.
Quoted text · Christian Grün · 3 lines
> I copied the old data, restxq etc. into the new structure. > … > In both cases I lost my users. How can I upgrade without loosing them?
Users are stored in the data directory in the users.xml file. Did you copy this file as well? Maybe the BaseX server was still running while you were copying the files? For databases, this shouldn’t matter (database are dynamically accessed), but the users.xml file will only be parsed at startup time. Best, Christian [1] https://github.com/BaseXdb/basex/issues/1742
Quoted text · Christoph Gaukel · 53 lines
On Mon, Oct 21, 2019 at 1:47 PM Christoph Gaukel <christoph.gaukel at gmx.de> wrote: > > Hi Christian, > > thank you for your answer. I upgraded from 9.1.2 to 9.2.4 and indeed: > > the output of db:backups('test_balance_tmp') changed from: > <backup database="test_balance_tmp" date="2019-10-18T00:05:50" size="2230">test_balance_tmp-2019-10-18-00-05-50</backup> > to: > <backup database="test_balance_tmp" date="2019-10-17T22:05:50Z" size="2230">test_balance_tmp-2019-10-18-00-05-50</backup> > > The same with db:drop(), now it deletes the database but not the backups. > > db_alter() has not changed. It alters the name of the database but the corresponding backups stay unchanged. I combine it with db:drop-backup() > > > From doing the upgrade, I got a new question. I have done two trials: > > I copied the old data, restxq etc. into the new structure. > I copied BaseX.jar and basex/lib into the old structure > > In both cases I lost my users. How can I upgrade without loosing them? > > > Thanks, > > Christoph > > Am 18.10.19 um 10:25 schrieb Christian Grün: > > Hi Christoph, > > Welcome back to the list. > > db:drop deletes both, the database and the corresponding backups > > The function should only delete database and preserve backups. For > deleting backups, db:drop-backup can be used. Maybe there was a bug in > an older version of BaseX? > > db:info($db)/resourceproperties/inputdate is a UTC dateTime with a time zone offset > db:backups($db)/@date is a local dateTime without a time zone offset > > Same here: Both returned timezones should be a UTC dateTime with the Z > time offset. > > Maybe you need to switch to the latest version of BaseX? > Feel free to give us an update if the problems persist with BaseX 9.x. > > Hope this helps, > Christian >
CG
Christian Grünin reply to Christoph Gaukel, 16 Oct 2019, 13:349 Nov 2019 18:19 #
Dear Christoph, A command and an XQuery function for renaming backup files was added in the latest snapshot of BaseX [1,2]. All the best, Christian [1] https://github.com/BaseXdb/basex/issues/1742 [2] http://files.basex.org/releases/latest/
Quoted text · Christoph Gaukel · 37 lines
On Wed, Oct 16, 2019 at 1:34 PM Christoph Gaukel <christoph.gaukel at gmx.de> wrote: > > Hi, > > the following handling of backups is surprising: > > db:alter changes the name of the database but does not alter the names of the corresponding backups > db:drop deletes both, the database and the corresponding backups > > I would prefer, if there was an option in db:drop to keep the backups, which would allow to restore a deleted database from their backups. Is it possible to add options to db:drop, which allow that? > > For me, the behavior of db:alter looks like a bug. > > > There is another minor handling, i would like to have changed: > > db:info($db)/resourceproperties/inputdate is a UTC dateTime with a time zone offset > db:backups($db)/@date is a local dateTime without a time zone offset > > If I compare these two, it works correctly if the local time zone offset is the same as for the creation of the backup E.g.: > > if ( > not(db:backups($db)) or > max(db:backups($db)/@date/(. cast as xs:dateTime)) < > db:info($db)/resourceproperties/inputdate/. cast as xs:dateTime > ) then db:create-backup($db) > else () > > Adding a time zone offset +hh:mm or -hh:mm to db:backups($db)/@date would solve this. > > > Thanks, > > Christoph > >

⚡Generated with XQuery