Skip to content

Commit fa8d0aa

Browse files
authored
Merge pull request #1928 from weaviate/incremental_backup_support
Add support for incremental backups
2 parents bd488bb + 7d62030 commit fa8d0aa

6 files changed

Lines changed: 51 additions & 1 deletion

File tree

.github/workflows/main.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ env:
2727
WEAVIATE_133: 1.33.10
2828
WEAVIATE_134: 1.34.5
2929
WEAVIATE_135: 1.35.0
30-
WEAVIATE_136: 1.36.0-rc.0
30+
WEAVIATE_136: 1.36.0
31+
WEAVIATE_137: 1.37.0-dev-29d5c87.amd64
3132

3233

3334
jobs:
@@ -310,6 +311,7 @@ jobs:
310311
$WEAVIATE_134,
311312
$WEAVIATE_135,
312313
$WEAVIATE_136
314+
$WEAVIATE_137
313315
]
314316
steps:
315317
- name: Checkout

ci/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ services:
3030
DISABLE_TELEMETRY: 'true'
3131
DISABLE_LAZY_LOAD_SHARDS: 'true'
3232
GRPC_MAX_MESSAGE_SIZE: 100000000 # 100mb
33+
OBJECTS_TTL_DELETE_SCHEDULE: "@every 12h" # for objectTTL tests to work
34+
3335
contextionary:
3436
environment:
3537
OCCURRENCE_WEIGHT_LINEAR_FACTOR: 0.75

integration/test_backup_v4.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,46 @@ 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+
if client._connection._weaviate_version.is_lower_than(1, 37, 0):
748+
pytest.skip("List backups is only supported from 1.37.0")
749+
750+
backup_id = unique_backup_id(request.node.name)
751+
base_backup_id = backup_id + "_base"
752+
753+
# create base backup
754+
client.backup.create(
755+
backup_id=base_backup_id,
756+
backend=BACKEND,
757+
include_collections=["Article"],
758+
wait_for_completion=True,
759+
)
760+
761+
# create incremental backup
762+
client.backup.create(
763+
backup_id=backup_id,
764+
backend=BACKEND,
765+
include_collections=["Article"],
766+
wait_for_completion=True,
767+
incremental_backup_base_id=base_backup_id,
768+
)
769+
770+
# remove existing class
771+
client.collections.delete("Article")
772+
773+
# restore incremental backup
774+
client.backup.restore(
775+
backup_id=backup_id,
776+
backend=BACKEND,
777+
include_collections=["Article"],
778+
wait_for_completion=True,
779+
)
780+
781+
# check data exists again
782+
assert len(client.collections.use("Article")) == len(ARTICLES_IDS)
783+
784+
745785
# This test has been disabled temporarily until the behaviour of this scenario is clarified.
746786
# It worked in version 1.33.0-rc.1, but broken in version 1.33.0+
747787
# def test_overwrite_alias_false(

weaviate/backup/async_.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +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+
incremental_base_backup_id: Optional[str] = None,
2324
wait_for_completion: bool = False,
2425
config: Optional[BackupConfigCreate] = None,
2526
backup_location: Optional[BackupLocationType] = None,

weaviate/backup/executor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +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+
incremental_base_backup_id: Optional[str] = None,
5051
wait_for_completion: bool = False,
5152
config: Optional[BackupConfigCreate] = None,
5253
backup_location: Optional[BackupLocationType] = None,
@@ -60,6 +61,8 @@ def create(
6061
collections will be included. Either `include_collections` or `exclude_collections` can be set. By default None.
6162
exclude_collections: The collection/list of collections to be excluded in the backup.
6263
Either `include_collections` or `exclude_collections` can be set. By default None.
64+
incremental_base_backup_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.
6366
wait_for_completion: Whether to wait until the backup is done. By default False.
6467
config: The configuration of the backup creation. By default None.
6568
backup_location: The dynamic location of a backup. By default None.
@@ -89,6 +92,7 @@ def create(
8992
"id": backup_id,
9093
"include": include_collections,
9194
"exclude": exclude_collections,
95+
"incremental_base_backup_id": incremental_base_backup_id,
9296
}
9397

9498
if config is not None:

weaviate/backup/sync.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +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+
incremental_base_backup_id: Optional[str] = None,
2324
wait_for_completion: bool = False,
2425
config: Optional[BackupConfigCreate] = None,
2526
backup_location: Optional[BackupLocationType] = None,

0 commit comments

Comments
 (0)