-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUG] fix multi collection log purge
- Loading branch information
1 parent
9472830
commit 26bfdee
Showing
4 changed files
with
42 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from chromadb.api.client import Client | ||
from chromadb.config import System | ||
from chromadb.test.property import invariants | ||
|
||
|
||
def test_log_purge(sqlite_persistent: System) -> None: | ||
client = Client.from_system(sqlite_persistent) | ||
|
||
first_collection = client.create_collection( | ||
"first_collection", metadata={"hnsw:sync_threshold": 10, "hnsw:batch_size": 10} | ||
) | ||
second_collection = client.create_collection( | ||
"second_collection", metadata={"hnsw:sync_threshold": 10, "hnsw:batch_size": 10} | ||
) | ||
collections = [first_collection, second_collection] | ||
|
||
# (Does not trigger a purge) | ||
for i in range(5): | ||
first_collection.add(ids=str(i), embeddings=[i, i]) | ||
|
||
# (Should trigger a purge) | ||
for i in range(100): | ||
second_collection.add(ids=str(i), embeddings=[i, i]) | ||
|
||
# The purge of the second collection should not be blocked by the first | ||
invariants.log_size_below_max(client._system, collections, True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters