Skip to content

Add incremental backup support - #459

Open
dudanogueira wants to merge 3 commits into
weaviate:mainfrom
dudanogueira:feat/incremental-backups
Open

Add incremental backup support#459
dudanogueira wants to merge 3 commits into
weaviate:mainfrom
dudanogueira:feat/incremental-backups

Conversation

@dudanogueira

Copy link
Copy Markdown
Contributor

Exposes Weaviate's file-based incremental backups (server v1.37.0+) in the client:

const base = await client.backup.create({
  backupId: 'base-backup',
  backend: 'filesystem',
  waitForCompletion: true,
});

await client.backup.create({
  backupId: 'incremental-backup',
  backend: 'filesystem',
  incrementalBaseBackupId: base.id, // or any existing backup ID string
  waitForCompletion: true,
});

Changes

  • incrementalBaseBackupId on client.backup.create() and collection.backup.create(), plus .withIncrementalBaseBackupId() on the v2 builder.
  • Gated client-side by DbVersionSupport.supportsIncrementalBackups() — throws WeaviateUnsupportedFeatureError below 1.37.0, matching the Python client.
  • Validates that the base ID differs from the backup being created (the server otherwise returns a bare 500), and lowercases it.
  • The base backup ID is read back on getCreateStatus() and list(). Weaviate only returns it to root users, so it may be undefined even for an incremental backup.

Notes for reviewers

  • backup(connection) now takes dbVersionSupport as a second argument (same for backupCollection). Both are internal factories — only types are re-exported publicly.
  • list() no longer returns the raw payload verbatim: incremental_base_backup_id is mapped to incrementalBaseBackupId. Everything else is passed through unchanged.

Testing

Mock tests cover the request payload, lowercasing, the version gate (1.36 vs 1.37) and response parsing. Integration tests create an incremental backup on top of a base backup and restore it — verified against Weaviate 1.38.0.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Gc9nJTnKeYs41fidZAYWf6

Adds .withIncrementalBaseBackupId() to BackupCreator so the
incremental_base_backup_id field is sent on backup creation, plus
validation rejecting an empty base ID or one equal to the backup
being created.
client.backup.create() and collection.backup.create() now accept
incrementalBaseBackupId. The request is gated client-side on Weaviate
>=1.37.0 via DbVersionSupport.supportsIncrementalBackups() and throws
WeaviateUnsupportedFeatureError on older servers.

The base backup ID is also surfaced on getCreateStatus() and list(),
which Weaviate only returns to root users.
Mock tests assert the payload sent on create, the lowercasing of the
base ID, the >=1.37.0 gate and the parsing of the base ID in list() and
getCreateStatus(). Integration tests create an incremental backup on top
of a base backup and restore it.

@orca-security-eu orca-security-eu Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant