Skip to content

fix(native): BACKUP DATABASE keeps Backup.backupDatabase() in the native image - #12556

Merged
robfrank merged 1 commit into
mainfrom
fix/native-backup-database-reflection
Nov 19, 2026
Merged

robfrank merged 1 commit into
mainfrom
fix/native-backup-database-reflection

Conversation

@robfrank

@robfrank robfrank commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

What

The nightly native build fails in the E2E tests (run 44438961124): BACKUP DATABASE throws NoSuchMethodException: com.arcadedb.integration.backup.Backup.backupDatabase(). It fails RemoteDatabaseJavaApiIT.backupDatabase and JdbcQueriesIT.backupDatabase on both amd64 and arm64.

Why

#12412 moved clazz.getMethod("backupDatabase") into the lambda passed to OutsideCallerTransaction.call(...). native-image keeps a reflectively called method only when it can resolve the class and method name while it builds the image. Inside the lambda, clazz arrives as a captured field, so the build can't resolve it and drops the method. The setter lookups in the switch arms are not affected: they run in the same method as Class.forName. No other Class.forName("com.arcadedb.integration...") caller looks up a method inside a lambda.

Fix

  • BackupDatabaseStatement: look up the Method before the lambda, and only call invoke inside it.
  • reachability-metadata.json: register Backup's (Database, String) constructor and backupDatabase(), so the image keeps them even if the lookup moves again.

Verification

  • BackupDatabaseTest, BackupSettingsTest and BackupDatabaseStatementTestParserTest pass (19 tests). They run on the JVM, where this failure cannot happen, so they only show nothing regressed.
  • The fix itself is not yet confirmed in the native image. That needs the native workflow (nightly or a manual dispatch) to run on this branch.

Summary by CodeRabbit

  • Bug Fixes
    • Improved database backup compatibility in native-image deployments.

…ive image

#12412 moved the reflective getMethod("backupDatabase") into the lambda run by
OutsideCallerTransaction.call. native-image cannot fold a lookup whose Class is a
captured lambda field, so the method was dropped and the statement failed with
NoSuchMethodException in the native E2E tests. The Method is now resolved before
the lambda, and Backup's constructor and backupDatabase() are registered in the
reachability metadata.
@robfrank robfrank self-assigned this Nov 19, 2026
@mergify

mergify Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The backup statement now resolves backupDatabase before creating its invocation lambda. Native-image reflection metadata now registers the Backup constructor and its no-argument backupDatabase method.

Changes: Backup reflection

Layer / File(s) Summary
Register and invoke backup reflectively
engine/src/main/java/com/arcadedb/query/sql/parser/BackupDatabaseStatement.java, native/src/main/resources/META-INF/native-image/com.arcadedb/arcadedb-native/reachability-metadata.json
The statement resolves backupDatabase before creating the lambda and invokes the cached method. Native-image metadata registers the Backup constructor with Database and String parameters, and its no-argument backupDatabase method.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

  • ArcadeData/arcadedb#12412: This PR moved the reflective lookup into a lambda; the current change moves it before the lambda.

Suggested reviewers: lvca

Merge Risk: Minimal · up to 88eb1

This change fixes the SQL BACKUP DATABASE statement failing in native-image builds by resolving the reflective method before the lambda and registering it in the native metadata. No concrete defect remains. Run the native workflow on this branch to confirm the fix before or soon after merging.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@github-actions github-actions Bot added backup-restore Backup, restore, and export native-image GraalVM native image no-issue The PR links no issue severity:major A feature is broken or returns wrong results, with no practical workaround sql triage:lgtm PR triage: nothing blocking, ready for a maintainer labels Nov 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Triage: triage:lgtm · severity:major · areas: native-image, sql, backup-restore · no-issue

LGTM. The fix is small and targeted.

  • BackupDatabaseStatement: clazz.getMethod("backupDatabase") now runs before the lambda, in the same method as Class.forName. native-image can then resolve it at build time. The lambda only calls invoke.
  • A NoSuchMethodException from the lookup now surfaces directly in the try block rather than through the lambda. The outer catch (Exception e) at line 184 still handles it. Either way the user gets a CommandExecutionException.
  • reachability-metadata.json: registering Backup's (Database, String) constructor and backupDatabase() is a sound safety net. The JSON structure matches the neighbouring entries.

Caveats:

  • The PR description says the fix is not yet confirmed in a native image. Please run the native workflow on this branch before merging.
  • No JVM test can reproduce this failure. The E2E tests (RemoteDatabaseJavaApiIT.backupDatabase, JdbcQueriesIT.backupDatabase) in the native workflow are the real regression check.

I rated this as major. BACKUP DATABASE is completely broken in the native image, though the JVM build is unaffected.

@robfrank
robfrank merged commit fcc52e0 into main Nov 19, 2026
19 of 21 checks passed
tae898 added a commit to ArcadeData/arcadedb-python that referenced this pull request Nov 20, 2026
…els; docs: open a database with an older wheel (#416)

* Native image: keep Backup.backupDatabase() for BACKUP DATABASE, and test the statement on both wheels

Upstream ArcadeData/arcadedb#12556 (fcc52e0f) registered
com.arcadedb.integration.backup.Backup in its own reachability metadata:
the (Database, String) constructor and backupDatabase(). BACKUP DATABASE
finds the class by name; since #12412 (after the 26.11.1 release) it looks the
method up inside a lambda, which native-image cannot fold, so the nightly
native build lost the method (NoSuchMethodException). This file had no entry.

The entry is copied as upstream has it (same type, same two methods, no
flags), in this file's one-space indent and alphabetical place. At the pinned
engine 26.11.1 the lookup is not yet in a lambda, so the entry is not
needed there; it is needed from the first engine release that contains
#12412, and it does no harm before.

The only BACKUP DATABASE test is JVM-only because it sets the engine's
global backup directory through JPype. The new test starts a server (the
default backup directory is <root path>/backups, so nothing global is set),
runs BACKUP DATABASE, finds the archive, unzips it and opens it, so it
runs on the native wheel too. Not run here: no tests could be run on the
authoring host.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* docs: say that a 26.11.x database must not be opened with an older wheel

26.11.1 wheels write float and double arrays in the fixed-width form
(binary types 36 and 37, arcadedb.serializer.fixedWidthFloatArrays, on by
default). Read from upstream: the setting's default and text at 26.11.1,
ArcadeData/arcadedb#12234 (26.10.x and 26.9.1 open such a database without an
error, read the arrays as null, and the next UPDATE drops them) and #12239
(fd18fce4, main only: the dictionary is labelled format version 2 while the
setting is on, at the first read-write open, and builds from 26.8.1 to 26.11.x
refuse it; setting it to false before that open keeps a rollback possible).

The page has no upgrade or downgrade section, so a new one goes on the
installation page, with the safe rule and the system property route that the
durability page already documents. No static release-notes file exists: the
release notes are built from pull request titles (scripts/release_notes.py).
Not run: the Antora build (the Docs workflow does it).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backup-restore Backup, restore, and export native-image GraalVM native image no-issue The PR links no issue severity:major A feature is broken or returns wrong results, with no practical workaround sql triage:lgtm PR triage: nothing blocking, ready for a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant