Skip to content

Commit 236b62c

Browse files
authored
[ENH] Make roll dirty log always converge to coalesce everything. (#4927)
## Description of changes The dirty log was not guaranteed to converge even in the absence of further writes. I confirmed this empirically with local testing and inspection of the dirty log. Post-patch it always converges within one rollup. ## Test plan CI - [X] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo nextest` for rust ## Documentation Changes _Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the [docs section](https://github.com/chroma-core/chroma/tree/main/docs/docs.trychroma.com)?_
1 parent b3d5fbf commit 236b62c

File tree

8 files changed

+372
-146
lines changed

8 files changed

+372
-146
lines changed

chromadb/test/property/test_add.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,32 @@
2121

2222
collection_st = st.shared(strategies.collections(with_hnsw_params=True), key="coll")
2323

24+
@given(
25+
collection=collection_st,
26+
record_set=strategies.recordsets(collection_st, min_size=1, max_size=5),
27+
)
28+
@settings(
29+
deadline=None,
30+
parent=override_hypothesis_profile(
31+
normal=hypothesis.settings(max_examples=500),
32+
fast=hypothesis.settings(max_examples=200),
33+
),
34+
max_examples=2
35+
)
36+
def test_add_miniscule(
37+
client: ClientAPI,
38+
collection: strategies.Collection,
39+
record_set: strategies.RecordSet,
40+
) -> None:
41+
if (
42+
client.get_settings().chroma_api_impl
43+
== "chromadb.api.async_fastapi.AsyncFastAPI"
44+
):
45+
pytest.skip(
46+
"TODO @jai, come back and debug why CI runners fail with async + sync"
47+
)
48+
_test_add(client, collection, record_set, True, always_compact=True)
49+
2450

2551
# Hypothesis tends to generate smaller values so we explicitly segregate the
2652
# the tests into tiers, Small, Medium. Hypothesis struggles to generate large
@@ -104,6 +130,7 @@ def _test_add(
104130
record_set: strategies.RecordSet,
105131
should_compact: bool,
106132
batch_ann_accuracy: bool = False,
133+
always_compact: bool = False,
107134
) -> None:
108135
create_isolated_database(client)
109136

@@ -132,7 +159,7 @@ def _test_add(
132159
if (
133160
not NOT_CLUSTER_ONLY
134161
and should_compact
135-
and len(normalized_record_set["ids"]) > 10
162+
and (len(normalized_record_set["ids"]) > 10 or always_compact)
136163
):
137164
# Wait for the model to be updated
138165
wait_for_version_increase(client, collection.name, initial_version)

rust/log-service/src/bin/chroma-inspect-dirty-log.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async fn main() {
1515
.connect()
1616
.await
1717
.expect("could not connect to log service");
18-
let mut client = LogServiceClient::new(logservice);
18+
let mut client = LogServiceClient::new(logservice).max_decoding_message_size(256 << 20);
1919
let dirty = client
2020
.inspect_dirty_log(InspectDirtyLogRequest {})
2121
.await

0 commit comments

Comments
 (0)