db:backups, db:ouptut order of operations.

Thursday, 20 April 2017 · 5 messages · last reply 22 Apr 2017
CG
Christian Grünin reply to France Baril, 21 Apr 2017, 01:4020 Apr 2017 23:46 #

Dear France,

The argument of db:output will be cached before updates will be executed. Otherwise, out could be that the argument to be output does not exist anymore. Please see [1] for more information.

Best, Christian

[1] http://docs.basex.org/wiki/Database_Module#db:output

Quoted text · France Baril · 1 line
Am 20.04.2017 23:40 schrieb "France Baril" <france.baril at architextus.com>:

Hi,

What am I doing wrong? It was my impression that db:ouput was not executed until the database updates were completed.

However, when I execute:

let $db-name := 'Inve'
return (
  db:create-backup($db-name),
  db:output(db:backups($db-name))
)

The list of backups returned doesn't include the backup just added by db:create-backup(). I just tried with 8.6.3 to make sure it wasn't an older issue.

Thanks!

-- France Baril Architecte documentaire / Documentation architect france.baril at architextus.com
FB
France Baril21 Apr 2017 01:40 #

Hi,

What am I doing wrong? It was my impression that db:ouput was not executed until the database updates were completed.

However, when I execute:

let $db-name := 'Inve'
return (
  db:create-backup($db-name),
  db:output(db:backups($db-name))
)

The list of backups returned doesn't include the backup just added by db:create-backup(). I just tried with 8.6.3 to make sure it wasn't an older issue.

Thanks!

-- France Baril Architecte documentaire / Documentation architect france.baril at architextus.com
FB
France Barilin reply to Christian Grün, 20 Apr 2017, 23:4621 Apr 2017 02:01 #

So I need to send 2 separate http requests or use a redirect? 1. Send request that creates backups 2. Send request that extracts the latest backup name from the list of all backups and returns it to me?

Any chance db:create-backup, could return the name of the new backup instead of an empty sequence?

I'm getting a lot of lag in my applications from having to perform so many calls or redirects to get anything from the server after an update.

Or maybe you have a better approach to propose?

CG
Christian Grün21 Apr 2017 11:26 #
Quoted text · France Baril · 4 lines
> So I need to send 2 separate http requests or use a redirect? > 1. Send request that creates backups > 2. Send request that extracts the latest backup name from the list of all > backups and returns it to me?

Exactly.

Quoted text · France Baril · 2 lines
> I'm getting a lot of lag in my applications from having to perform so many > calls or redirects to get anything from the server after an update.

If the redirection should really turn out to be a lag (I wouldn’t hope so, because such a call should be really cheap), simply use rest:forward instead of rest:redirect [1].

Quoted text · France Baril · 1 line
> Or maybe you have a better approach to propose?

Maybe you don’t really need the exact name of the backup, because db:restore can be called without timestamp [2].

Best, Christian

[1] http://docs.basex.org/wiki/RESTXQ#rest:forward [2] http://docs.basex.org/wiki/Database_Module#db:restore

FB
France Baril22 Apr 2017 07:33 #

The plan is not to restore straight from the data folder. I'm creating a script that:

1- Create a backup of all dbs 2- Rezip backups with AES256 encryption 3- Copies the encrypted backups to a remote location.

The double call works. The shell script didn't respond well to a redirect. I haven't tried the forward yet. I just thought there would be a way to do it in one operation. For this case, lag is not much of an issue because it's a shell and it's internal, but I've had similar cases in web applications with other functions, so I asked.

Quoted text · Christian Grün · 30 lines
On Fri, Apr 21, 2017 at 4:26 AM, Christian Grün <christian.gruen at gmail.com> wrote: > > So I need to send 2 separate http requests or use a redirect? > > 1. Send request that creates backups > > 2. Send request that extracts the latest backup name from the list of > all > > backups and returns it to me? > > Exactly. > > > I'm getting a lot of lag in my applications from having to perform so > many > > calls or redirects to get anything from the server after an update. > > If the redirection should really turn out to be a lag (I wouldn’t hope > so, because such a call should be really cheap), simply use > rest:forward instead of rest:redirect [1]. > > > > Or maybe you have a better approach to propose? > > Maybe you don’t really need the exact name of the backup, because > db:restore can be called without timestamp [2]. > > Best, > Christian > > [1] http://docs.basex.org/wiki/RESTXQ#rest:forward > [2] http://docs.basex.org/wiki/Database_Module#db:restore >
-- France Baril Architecte documentaire / Documentation architect france.baril at architextus.com

⚡Generated with XQuery