Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL IMPORT DATABASE Cannot Restore Backup #645

Open
gramian opened this issue Nov 28, 2022 · 13 comments
Open

SQL IMPORT DATABASE Cannot Restore Backup #645

gramian opened this issue Nov 28, 2022 · 13 comments
Assignees
Labels
enhancement New feature or request

Comments

@gramian
Copy link
Collaborator

gramian commented Nov 28, 2022

ArcadeDB Version: v22.10.1 (build e692f4c/1667424782661/main)

JDK Version: openjdk 11.0.16.1 2022-08-12

OS: MacOS 12.6

Dear Developers,

I unsuccesfully tried to remotely import a backup. I was expecting that IMPORT DATABASE not only imports exported databases but also backups, as there seems to be no other remote way to restore a backup. The restore.sh script requires to be logged into a terminal on the server's machine / container.

Expected behavior

SQL IMPORT DATABASE imports backup made with BACKUP DATABASE

Actual behavior

Import technically succeeds but does not import anything

Server Output
Recognized format JSON (parsingLimitBytes=9,54MB parsingLimitEntries=0)- Status update: parsed 0 (0/sec) - 0 documents (0/sec) - 0 vertices (0/sec) - 0 edges (0/sec) - 0 skipped edges - 0 linked edges (0/sec - 0%)

Steps to reproduce

BACKUP DATABASE;
IMPORT DATABASE file://backups/test/backup-test-20221128-140440531.zip
@lvca
Copy link
Contributor

lvca commented Nov 28, 2022

Right now the only way to restore a database is by using API or the restore.sh command on the server. The reason why we cannot use the IMPORT DATABASE command is that in that case, the database must exist, while with the restore database the database is created by the restore API. The restore database, if any, should be supported by a new server command (that requires server authentication).

@lvca lvca self-assigned this Nov 28, 2022
@lvca lvca added the enhancement New feature or request label Nov 28, 2022
@gramian
Copy link
Collaborator Author

gramian commented Nov 28, 2022

OK, so I should rather use EXPORT DATABASE in my use-case if I want to import it remotely.

@gramian
Copy link
Collaborator Author

gramian commented Nov 28, 2022

The reason why we cannot use the IMPORT DATABASE command is that in that case, the database must exist, ...

Hmm, but if I use the HTTP API, I would have to use the command endpoint, which in turn requires a database in its API path, as in: api/v1/{db}/command, right? So a database has to exist. Or would that be the source of the problem then?

@lvca
Copy link
Contributor

lvca commented Nov 29, 2022

That's right, you need to create an empty database first, and then import from a previous export.

@lvca
Copy link
Contributor

lvca commented Dec 5, 2022

By checking our test cases I can see it's tested a minimal database exported from OrientDB:

https://github.com/ArcadeData/arcadedb/blob/5d260bd1a4bd1d32897aecb0707c3a0bfcf553a9/server/src/test/resources/orientdb-export-small.gz

@lvca
Copy link
Contributor

lvca commented Jan 5, 2023

I was checking this issue, is the issue still there?

@gramian
Copy link
Collaborator Author

gramian commented Jan 8, 2023

Yes,
using (in Studio):

IMPORT DATABASE https://github.com/ArcadeData/arcadedb-datasets/blob/main/arcadedb/Movies-backup-20211005-134613862.zip

(or others listed above) yields:

INFO  [SourceDiscovery] <ArcadeDB_0> Analyzing url: https://github.com/ArcadeData/arcadedb-datasets/blob/main/arcadedb/Movies-backup-20211005-134613862.zip...- Status update: parsed 0 (0/sec) - 0 documents (0/sec) - 0 vertices (0/sec) - 0 edges (0/sec) - 0 skipped edges - 0 linked edges (0/sec - 0%)
<ArcadeDB_0> Error on command execution (PostCommandHandler)
com.arcadedb.exception.CommandExecutionException: Error on importing database
	at com.arcadedb.query.sql.parser.ImportDatabaseStatement.executeSimple(ImportDatabaseStatement.java:70)
	at com.arcadedb.query.sql.executor.SingleOpExecutionPlan.executeInternal(SingleOpExecutionPlan.java:95)
	at com.arcadedb.query.sql.parser.SimpleExecStatement.execute(SimpleExecStatement.java:67)
	at com.arcadedb.query.sql.parser.Statement.execute(Statement.java:92)
	at com.arcadedb.query.sql.parser.Statement.execute(Statement.java:76)
	at com.arcadedb.query.sql.SQLQueryEngine.command(SQLQueryEngine.java:106)
	at com.arcadedb.database.EmbeddedDatabase.command(EmbeddedDatabase.java:1247)
	at com.arcadedb.server.ServerDatabase.command(ServerDatabase.java:416)
	at com.arcadedb.server.http.handler.PostCommandHandler.executeCommand(PostCommandHandler.java:130)
	at com.arcadedb.server.http.handler.PostCommandHandler.execute(PostCommandHandler.java:90)
	at com.arcadedb.server.http.handler.DatabaseAbstractHandler.execute(DatabaseAbstractHandler.java:85)
	at com.arcadedb.server.http.handler.AbstractHandler.handleRequest(AbstractHandler.java:111)
	at io.undertow.server.RoutingHandler.handleRequest(RoutingHandler.java:93)
	at io.undertow.server.handlers.PathHandler.handleRequest(PathHandler.java:104)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
	at io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:256)
	at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136)
	at io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:59)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
	at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
	at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)
	at org.xnio.nio.WorkerThread.run(WorkerThread.java:591)
Caused by: com.arcadedb.integration.importer.ImportException: Error on parsing source 'null'
	at com.arcadedb.integration.importer.Importer.load(Importer.java:62)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.arcadedb.query.sql.parser.ImportDatabaseStatement.executeSimple(ImportDatabaseStatement.java:65)
	... 21 more
Caused by: com.arcadedb.integration.importer.ImportException: Cannot determine the file type. If it is a CSV file, please specify the header via settings
	at com.arcadedb.integration.importer.SourceDiscovery.analyzeSourceContent(SourceDiscovery.java:317)
	at com.arcadedb.integration.importer.SourceDiscovery.getSchema(SourceDiscovery.java:60)
	at com.arcadedb.integration.importer.Importer.loadFromSource(Importer.java:78)
	at com.arcadedb.integration.importer.Importer.load(Importer.java:53)
	... 26 more

@lvca
Copy link
Contributor

lvca commented Mar 21, 2023

Did you figure out a way to get this working?

@lvca lvca added this to the 23.3.1 milestone Mar 21, 2023
@gramian
Copy link
Collaborator Author

gramian commented Mar 21, 2023

No, I still get: Cannot execute command Error on parsing source 'null'

Trace
[SourceDiscovery] <ArcadeDB_0> Analyzing url: https://github.com/ArcadeData/arcadedb-datasets/blob/main/orientdb/OpenBeer.gz...- Status update: parsed 0 (0/sec) - 0 documents (0/sec) - 0 vertices (0/sec) - 0 edges (0/sec) - 0 skipped edges - 0 linked edges (0/sec - 0%)
<ArcadeDB_0> Error on command execution (PostCommandHandler)
com.arcadedb.exception.CommandExecutionException: Error on importing database
	at com.arcadedb.query.sql.parser.ImportDatabaseStatement.executeSimple(ImportDatabaseStatement.java:69)
	at com.arcadedb.query.sql.executor.SingleOpExecutionPlan.executeInternal(SingleOpExecutionPlan.java:91)
	at com.arcadedb.query.sql.parser.SimpleExecStatement.execute(SimpleExecStatement.java:63)
	at com.arcadedb.query.sql.parser.Statement.execute(Statement.java:85)
	at com.arcadedb.query.sql.parser.Statement.execute(Statement.java:69)
	at com.arcadedb.query.sql.SQLQueryEngine.command(SQLQueryEngine.java:97)
	at com.arcadedb.database.EmbeddedDatabase.command(EmbeddedDatabase.java:1264)
	at com.arcadedb.server.ServerDatabase.command(ServerDatabase.java:421)
	at com.arcadedb.server.http.handler.PostCommandHandler.executeCommand(PostCommandHandler.java:127)
	at com.arcadedb.server.http.handler.PostCommandHandler.execute(PostCommandHandler.java:88)
	at com.arcadedb.server.http.handler.DatabaseAbstractHandler.execute(DatabaseAbstractHandler.java:92)
	at com.arcadedb.server.http.handler.AbstractHandler.handleRequest(AbstractHandler.java:127)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: com.arcadedb.integration.importer.ImportException: Error on parsing source 'null'
	at com.arcadedb.integration.importer.Importer.load(Importer.java:63)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.arcadedb.query.sql.parser.ImportDatabaseStatement.executeSimple(ImportDatabaseStatement.java:61)
	... 18 more
Caused by: com.arcadedb.integration.importer.ImportException: Cannot determine the file type. If it is a CSV file, please specify the header via settings
	at com.arcadedb.integration.importer.SourceDiscovery.analyzeSourceContent(SourceDiscovery.java:294)
	at com.arcadedb.integration.importer.SourceDiscovery.getSchema(SourceDiscovery.java:60)
	at com.arcadedb.integration.importer.Importer.loadFromSource(Importer.java:81)
	at com.arcadedb.integration.importer.Importer.load(Importer.java:54)
	... 23 more

@lvca
Copy link
Contributor

lvca commented Mar 27, 2023

Back on this, the original issue was that you cannot import a database from a backup and this is still correct. In order to import a database you have to create it first.

Have you tried importing an exported database?

@gramian
Copy link
Collaborator Author

gramian commented Mar 27, 2023

Yes, and it also does not work.
I did:

EXPORT DATABASE file://myexport.tgz FORMAT JSONL

and after dropping and creating a database I tried:

IMPORT DATABASE file://myexport.tgz
IMPORT DATABASE file:///myexport.tgz
IMPORT DATABASE file://exports/myexport.tgz
IMPORT DATABASE file:///exports/myexport.tgz

(and a few others) each resulting in:

Internal error Database 'null' is not available
 Error on command execution (PostCommandHandler)
com.arcadedb.exception.DatabaseIsClosedException: Database 'null' is not available
	at com.arcadedb.server.ArcadeDBServer.getDatabase(ArcadeDBServer.java:366)
	at com.arcadedb.server.http.handler.DatabaseAbstractHandler.execute(DatabaseAbstractHandler.java:58)
	at com.arcadedb.server.http.handler.AbstractHandler.handleRequest(AbstractHandler.java:128)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:393)
	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
	at org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
	at java.base/java.lang.Thread.run(Thread.java:829)
</details>

If this is supposed to work, then maybe my import path is not correct?

@lvca
Copy link
Contributor

lvca commented Mar 27, 2023

Ok, working on this.

@lvca lvca modified the milestones: 23.3.1, 23.4.1 Apr 5, 2023
@lvca lvca modified the milestones: 23.4.1, 23.5.1 May 2, 2023
@lvca lvca modified the milestones: 23.5.1, 23.6.1 Jun 9, 2023
@lvca lvca modified the milestones: 23.6.1, 23.7.1 Jun 27, 2023
@lvca lvca modified the milestones: 23.7.1, 23.8.1 Aug 9, 2023
@lvca lvca removed this from the 23.9.1 milestone Sep 27, 2023
@lvca lvca added this to the 23.10.1 milestone Sep 27, 2023
@lvca lvca modified the milestones: 23.10.1, 23.11.1 Oct 31, 2023
@lvca lvca removed this from the 23.11.1 milestone Nov 21, 2023
mergify bot added a commit that referenced this issue Feb 3, 2025
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.3.0 to 5.4.0.
Release notes

*Sourced from [actions/setup-python's releases](https://github.com/actions/setup-python/releases).*

> v5.4.0
> ------
> 
> What's Changed
> --------------
> 
> ### Enhancements:
> 
> * Update cache error message by [`@​aparnajyothi-y`](https://github.com/aparnajyothi-y) in [actions/setup-python#968](https://github.com/actions/setup-python/pull/968)
> * Enhance Workflows: Add Ubuntu-24, Remove Python 3.8 by [`@​priya-kinthali`](https://github.com/priya-kinthali) in [actions/setup-python#985](https://github.com/actions/setup-python/pull/985)
> * Configure Dependabot settings by [`@​HarithaVattikuti`](https://github.com/HarithaVattikuti) in [actions/setup-python#1008](https://github.com/actions/setup-python/pull/1008)
> 
> ### Documentation changes:
> 
> * Readme update - recommended permissions by [`@​benwells`](https://github.com/benwells) in [actions/setup-python#1009](https://github.com/actions/setup-python/pull/1009)
> * Improve Advanced Usage examples by [`@​lrq3000`](https://github.com/lrq3000) in [actions/setup-python#645](https://github.com/actions/setup-python/pull/645)
> 
> ### Dependency updates:
> 
> * Upgrade `undici` from 5.28.4 to 5.28.5 by [`@​dependabot`](https://github.com/dependabot) in [actions/setup-python#1012](https://github.com/actions/setup-python/pull/1012)
> * Upgrade `urllib3` from 1.25.9 to 1.26.19 in /**tests**/data by [`@​dependabot`](https://github.com/dependabot) in [actions/setup-python#895](https://github.com/actions/setup-python/pull/895)
> * Upgrade `actions/publish-immutable-action` from 0.0.3 to 0.0.4 by [`@​dependabot`](https://github.com/dependabot) in [actions/setup-python#1014](https://github.com/actions/setup-python/pull/1014)
> * Upgrade `@actions/http-client` from 2.2.1 to 2.2.3 by [`@​dependabot`](https://github.com/dependabot) in [actions/setup-python#1020](https://github.com/actions/setup-python/pull/1020)
> * Upgrade `requests` from 2.24.0 to 2.32.2 in /**tests**/data by [`@​dependabot`](https://github.com/dependabot) in [actions/setup-python#1019](https://github.com/actions/setup-python/pull/1019)
> * Upgrade `@actions/cache` to `^4.0.0` by [`@​priyagupta108`](https://github.com/priyagupta108) in [actions/setup-python#1007](https://github.com/actions/setup-python/pull/1007)
> 
> New Contributors
> ----------------
> 
> * [`@​benwells`](https://github.com/benwells) made their first contribution in [actions/setup-python#1009](https://github.com/actions/setup-python/pull/1009)
> * [`@​HarithaVattikuti`](https://github.com/HarithaVattikuti) made their first contribution in [actions/setup-python#1008](https://github.com/actions/setup-python/pull/1008)
> * [`@​lrq3000`](https://github.com/lrq3000) made their first contribution in [actions/setup-python#645](https://github.com/actions/setup-python/pull/645)
> 
> **Full Changelog**: <actions/setup-python@v5...v5.4.0>


Commits

* [`4237552`](actions/setup-python@4237552) Improve Advanced Usage examples ([#645](https://github.com/actions/setup-python/issues/645))
* [`709bfa5`](actions/setup-python@709bfa5) Bump requests from 2.24.0 to 2.32.2 in /**tests**/data ([#1019](https://github.com/actions/setup-python/issues/1019))
* [`ceb20b2`](actions/setup-python@ceb20b2) Bump `@​actions/http-client` from 2.2.1 to 2.2.3 ([#1020](https://github.com/actions/setup-python/issues/1020))
* [`0dc2d2c`](actions/setup-python@0dc2d2c) Bump actions/publish-immutable-action from 0.0.3 to 0.0.4 ([#1014](https://github.com/actions/setup-python/issues/1014))
* [`feb9c6e`](actions/setup-python@feb9c6e) Bump urllib3 from 1.25.9 to 1.26.19 in /**tests**/data ([#895](https://github.com/actions/setup-python/issues/895))
* [`d0b4fc4`](actions/setup-python@d0b4fc4) Bump undici from 5.28.4 to 5.28.5 ([#1012](https://github.com/actions/setup-python/issues/1012))
* [`e3dfaac`](actions/setup-python@e3dfaac) Configure Dependabot settings ([#1008](https://github.com/actions/setup-python/issues/1008))
* [`b8cf3eb`](actions/setup-python@b8cf3eb) Use the new cache service: upgrade `@actions/cache` to `^4.0.0` ([#1007](https://github.com/actions/setup-python/issues/1007))
* [`1928ae6`](actions/setup-python@1928ae6) Update README.md ([#1009](https://github.com/actions/setup-python/issues/1009))
* [`3fddbee`](actions/setup-python@3fddbee) Enhance Workflows: Add Ubuntu-24, Remove Python 3.8 ([#985](https://github.com/actions/setup-python/issues/985))
* Additional commits viewable in [compare view](actions/setup-python@0b93645...4237552)

  

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=actions/setup-python&package-manager=github\_actions&previous-version=5.3.0&new-version=5.4.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants