Skip to content

Commit 27b7292

Browse files
committed
test that reinserted collections compact
1 parent f1a7249 commit 27b7292

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

chromadb/test/property/test_add.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,31 @@
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+
)
35+
def test_add_miniscule(
36+
client: ClientAPI,
37+
collection: strategies.Collection,
38+
record_set: strategies.RecordSet,
39+
) -> None:
40+
if (
41+
client.get_settings().chroma_api_impl
42+
== "chromadb.api.async_fastapi.AsyncFastAPI"
43+
):
44+
pytest.skip(
45+
"TODO @jai, come back and debug why CI runners fail with async + sync"
46+
)
47+
_test_add(client, collection, record_set, True)
48+
2449

2550
# Hypothesis tends to generate smaller values so we explicitly segregate the
2651
# the tests into tiers, Small, Medium. Hypothesis struggles to generate large

rust/log-service/src/lib.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -361,18 +361,11 @@ impl RollupPerCollection {
361361
self.start_log_position = witness
362362
.map(|x| x.cursor.position)
363363
.unwrap_or(LogPosition::from_offset(1));
364-
if self.start_log_position > self.limit_log_position {
365-
tracing::error!(
366-
"invariant violation; will patch: {:?} > {:?}",
367-
self.start_log_position,
368-
self.limit_log_position
369-
);
370-
}
371364
self.limit_log_position = self.limit_log_position.max(self.start_log_position);
372365
}
373366

374367
fn is_empty(&self) -> bool {
375-
self.start_log_position == self.limit_log_position
368+
self.start_log_position >= self.limit_log_position
376369
}
377370

378371
fn dirty_marker(&self, collection_id: CollectionUuid) -> DirtyMarker {
@@ -905,7 +898,7 @@ impl LogServer {
905898
rollup.start_log_position,
906899
LogPosition::from_offset(adjusted_log_offset as u64),
907900
);
908-
if rollup.start_log_position >= rollup.limit_log_position {
901+
if rollup.is_empty() {
909902
entry.remove();
910903
}
911904
}
@@ -1571,7 +1564,7 @@ impl LogServer {
15711564
format!("max_offset={:?} < offset={:?}", max_offset, offset),
15721565
));
15731566
}
1574-
if offset != max_offset{
1567+
if offset != max_offset {
15751568
let mark_dirty = MarkDirty {
15761569
collection_id: target_collection_id,
15771570
dirty_log: Arc::clone(&self.dirty_log),

0 commit comments

Comments
 (0)