Skip to content

Commit cf7e8d1

Browse files
committed
Better name for base backup id
1 parent 314a2db commit cf7e8d1

5 files changed

Lines changed: 53 additions & 17 deletions

File tree

integration/test_backup_v4.py

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

683683

684+
def test_incremental_backup(client: weaviate.WeaviateClient, request: SubRequest) -> None:
685+
"""Create and restore incremental backup."""
686+
backup_id = unique_backup_id(request.node.name)
687+
base_backup_id = backup_id + "_base"
688+
689+
# create base backup
690+
client.backup.create(
691+
backup_id=base_backup_id,
692+
backend=BACKEND,
693+
include_collections=["Article"],
694+
wait_for_completion=True,
695+
)
696+
697+
# create incremental backup
698+
client.backup.create(
699+
backup_id=backup_id,
700+
backend=BACKEND,
701+
include_collections=["Article"],
702+
wait_for_completion=True,
703+
incremental_backup_base_id=base_backup_id,
704+
)
705+
706+
# remove existing class
707+
client.collections.delete("Article")
708+
709+
# restore incremental backup
710+
client.backup.restore(
711+
backup_id=backup_id,
712+
backend=BACKEND,
713+
include_collections=["Article"],
714+
wait_for_completion=True,
715+
)
716+
717+
# check data exists again
718+
assert len(client.collections.use("Article")) == len(ARTICLES_IDS)
719+
720+
684721
# This test has been disabled temporarily until the behaviour of this scenario is clarified.
685722
# It worked in version 1.33.0-rc.1, but broken in version 1.33.0+
686723
# def test_overwrite_alias_false(

test/collection/test_config_methods.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
2-
import pytest
31
from weaviate.collections.classes.config_methods import _collection_configs_simple_from_json
42

3+
54
def test_collection_config_simple_from_json_with_none_vectorizer_config() -> None:
65
"""Test that _collection_configs_simple_from_json handles None vectorizer config."""
76
schema = {
@@ -10,9 +9,7 @@ def test_collection_config_simple_from_json_with_none_vectorizer_config() -> Non
109
"class": "TestCollection",
1110
"vectorConfig": {
1211
"default": {
13-
"vectorizer": {
14-
"text2vec-transformers": None
15-
},
12+
"vectorizer": {"text2vec-transformers": None},
1613
"vectorIndexType": "hnsw",
1714
"vectorIndexConfig": {
1815
"skip": False,
@@ -25,15 +22,15 @@ def test_collection_config_simple_from_json_with_none_vectorizer_config() -> Non
2522
"dynamicEfFactor": 8,
2623
"vectorCacheMaxObjects": 1000000000000,
2724
"flatSearchCutoff": 40000,
28-
"distance": "cosine"
29-
}
25+
"distance": "cosine",
26+
},
3027
}
3128
},
3229
"properties": [],
3330
"invertedIndexConfig": {
34-
"bm25": {"b": 0.75, "k1": 1.2},
35-
"cleanupIntervalSeconds": 60,
36-
"stopwords": {"preset": "en", "additions": None, "removals": None}
31+
"bm25": {"b": 0.75, "k1": 1.2},
32+
"cleanupIntervalSeconds": 60,
33+
"stopwords": {"preset": "en", "additions": None, "removals": None},
3734
},
3835
"replicationConfig": {"factor": 1, "deletionStrategy": "NoAutomatedResolution"},
3936
"shardingConfig": {
@@ -44,7 +41,7 @@ def test_collection_config_simple_from_json_with_none_vectorizer_config() -> Non
4441
"actualVirtualCount": 128,
4542
"key": "_id",
4643
"strategy": "hash",
47-
"function": "murmur3"
44+
"function": "murmur3",
4845
},
4946
"vectorIndexType": "hnsw",
5047
"vectorIndexConfig": {
@@ -58,8 +55,8 @@ def test_collection_config_simple_from_json_with_none_vectorizer_config() -> Non
5855
"dynamicEfFactor": 8,
5956
"vectorCacheMaxObjects": 1000000000000,
6057
"flatSearchCutoff": 40000,
61-
"distance": "cosine"
62-
}
58+
"distance": "cosine",
59+
},
6360
}
6461
]
6562
}

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)