Skip to content

Commit 0c8a821

Browse files
committed
Better name for base backup id
1 parent 3bce16e commit 0c8a821

4 files changed

Lines changed: 43 additions & 4 deletions

File tree

integration/test_backup_v4.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,43 @@ def test_overwrite_alias_true(
742742
assert literature.collection == "Article", "alias must point to the original collection"
743743

744744

745+
def test_incremental_backup(client: weaviate.WeaviateClient, request: SubRequest) -> None:
746+
"""Create and restore incremental backup."""
747+
backup_id = unique_backup_id(request.node.name)
748+
base_backup_id = backup_id + "_base"
749+
750+
# create base backup
751+
client.backup.create(
752+
backup_id=base_backup_id,
753+
backend=BACKEND,
754+
include_collections=["Article"],
755+
wait_for_completion=True,
756+
)
757+
758+
# create incremental backup
759+
client.backup.create(
760+
backup_id=backup_id,
761+
backend=BACKEND,
762+
include_collections=["Article"],
763+
wait_for_completion=True,
764+
incremental_backup_base_id=base_backup_id,
765+
)
766+
767+
# remove existing class
768+
client.collections.delete("Article")
769+
770+
# restore incremental backup
771+
client.backup.restore(
772+
backup_id=backup_id,
773+
backend=BACKEND,
774+
include_collections=["Article"],
775+
wait_for_completion=True,
776+
)
777+
778+
# check data exists again
779+
assert len(client.collections.use("Article")) == len(ARTICLES_IDS)
780+
781+
745782
# This test has been disabled temporarily until the behaviour of this scenario is clarified.
746783
# It worked in version 1.33.0-rc.1, but broken in version 1.33.0+
747784
# def test_overwrite_alias_false(

weaviate/backup/async_.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class _BackupAsync(_BackupExecutor[ConnectionAsync]):
2020
backend: BackupStorage,
2121
include_collections: Union[List[str], str, None] = None,
2222
exclude_collections: Union[List[str], str, None] = None,
23-
base_backup_id: Optional[str] = None,
23+
incremental_backup_base_id: Optional[str] = None,
2424
wait_for_completion: bool = False,
2525
config: Optional[BackupConfigCreate] = None,
2626
backup_location: Optional[BackupLocationType] = None,

weaviate/backup/executor.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def create(
4747
backend: BackupStorage,
4848
include_collections: Union[List[str], str, None] = None,
4949
exclude_collections: Union[List[str], str, None] = None,
50-
base_backup_id: Optional[str] = None,
50+
incremental_backup_base_id: Optional[str] = None,
5151
wait_for_completion: bool = False,
5252
config: Optional[BackupConfigCreate] = None,
5353
backup_location: Optional[BackupLocationType] = None,
@@ -61,6 +61,8 @@ def create(
6161
collections will be included. Either `include_collections` or `exclude_collections` can be set. By default None.
6262
exclude_collections: The collection/list of collections to be excluded in the backup.
6363
Either `include_collections` or `exclude_collections` can be set. By default None.
64+
incremental_backup_base_id: The identifier name of the base backup for an incremental backup. Files that are identical
65+
to the base backup will not be included in the incremental backup and restored from the base. By default None.
6466
wait_for_completion: Whether to wait until the backup is done. By default False.
6567
config: The configuration of the backup creation. By default None.
6668
backup_location: The dynamic location of a backup. By default None.
@@ -90,7 +92,7 @@ def create(
9092
"id": backup_id,
9193
"include": include_collections,
9294
"exclude": exclude_collections,
93-
"incremental_backup_base_id": base_backup_id,
95+
"incremental_backup_base_id": incremental_backup_base_id,
9496
}
9597

9698
if config is not None:

weaviate/backup/sync.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class _Backup(_BackupExecutor[ConnectionSync]):
2020
backend: BackupStorage,
2121
include_collections: Union[List[str], str, None] = None,
2222
exclude_collections: Union[List[str], str, None] = None,
23-
base_backup_id: Optional[str] = None,
23+
incremental_backup_base_id: Optional[str] = None,
2424
wait_for_completion: bool = False,
2525
config: Optional[BackupConfigCreate] = None,
2626
backup_location: Optional[BackupLocationType] = None,

0 commit comments

Comments
 (0)