feat:improve backup database functionality via SQL and add related tests - #2198
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request implements a new backup database functionality with enhancements on error handling and test coverage while cleaning up and modernizing several parts of the codebase.
- Introduces a backup feature with detailed error reporting in the backup command handler.
- Expands test coverage for backup functionality across various test suites.
- Updates packaging and configuration files to support backup, replication, and improved test isolation.
Reviewed Changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| server/src/main/java/com/arcadedb/server/http/handler/PostCommandHandler.java | Removed stray semicolon for cleaner code. |
| server/src/main/java/com/arcadedb/server/ArcadeDBServer.java | Added a createDirectories method to ensure necessary directories (databases and backups) are present. |
| postgresw/src/test/java/com/arcadedb/postgres/PostgresWJdbcTest.java | Added a basic backup database test using a "BACKUP DATABASE" SQL command. |
| postgresw/src/main/java/com/arcadedb/postgres/PostgresNetworkListener.java | Reformatted constructor parameters across multiple lines for improved readability. |
| postgresw/src/main/java/com/arcadedb/postgres/PostgresNetworkExecutor.java | Updated SQL command execution to use a BasicCommandContext and pass the server configuration. |
| package/src/main/docker/Dockerfile | Added new volumes for configuration, backups, and replication support. |
| package/src/main/assembly/*.xml | Created new file sets to generate empty directories for backups and replication in the distributions. |
| integration/src/test/java/com/arcadedb/integration/backup/BackupDatabaseTest.java | Introduced an integration test validating backup command output. |
| integration/src/test/java/com/arcadedb/integration/backup/format/FullBackupFormat.java | Updated import statements for clarity and maintainability. |
| integration/src/test/java/com/arcadedb/integration/backup/BackupSettings.java | Refactored to use switch expressions and modern imports to assign backup settings. |
| engine/src/test/java/com/arcadedb/TestHelper.java | Improved test isolation by resetting global configuration after each test. |
| engine/src/main/java/com/arcadedb/query/sql/parser/BackupDatabaseStatement.java | Enhanced error handling in backup execution by wrapping the call in a try-catch with detailed error logging. |
| engine/src/main/java/com/arcadedb/query/sql/executor/BasicCommandContext.java | Updated class comments to match the current interface naming. |
| engine/src/main/java/com/arcadedb/query/sql/SQLQueryEngine.java | Converted the parse method from static to an instance method to improve API design. |
| e2e/src/test/java/com/arcadedb/e2e/RemoteDatabaseJavaApiTest.java & JdbcQueriesTest.java | Expanded tests to cover backup command behavior via both SQL and SQLScript interfaces. |
| e2e/src/test/java/com/arcadedb/e2e/ArcadeContainerTemplate.java | Updated the container initialization using generics and a more modern formatting style. |
…aseStatement.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…xecutor.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
|
@robfrank will this affect #2177 ? It seems such a test could be easily added here https://github.com/ArcadeData/arcadedb/pull/2198/files#diff-d24951ee7936b3abd0aa8458f0fa2e97b6fc7758de35f5f1fda114929eaff7b0 fir |
|
@gramian added and tested locally, it fails. But I think it is expected to fail |
|
What is the |
|
Yes, is for HA, but was missing as the backups one, so I added both |
refs to #2116
This pull request introduces several changes aimed at improving database backup functionality, enhancing test coverage, and refining code quality. The most critical updates include adding a new backup feature, improving error handling during backups, and expanding test cases to ensure the robustness of the backup functionality. Additionally, there are various code cleanups and structural improvements across the codebase.
Database Backup Enhancements:
BackupDatabaseStatementclass to include improved error handling during database backups. It now logs errors and returns detailed results, including success or failure status and error messages when applicable.BackupSettingsto use modern Java constructs (e.g.,switchexpressions) and simplified logic for assigning default filenames.BackupDatabaseTestto test the backup functionality, ensuring the command produces the expected results and file outputs.Test Coverage Improvements:
testBackupDatabase) inJdbcQueriesTestandRemoteDatabaseJavaApiTestto validate backup functionality. [1] [2]TestHelperto reset global configuration after each test to ensure test isolation.Code Quality and Refactoring:
ArcadeContainerTemplate,BackupSettings, andFullBackupFormat. [1] [2] [3]parsemethod non-static inSQLQueryEngineto align with object-oriented principles.Packaging and Deployment Updates:
full.xml,headless.xml,minimal.xml) to include empty directories for backups and replication. [1] [2] [3]Postgres Integration:
PostgresNetworkExecutorto useBasicCommandContextfor executing SQL statements, enabling better configuration management. [1] [2]## What does this PR do?Checklist
mvn clean packagecommand