Skip to content

Commit c7d01a4

Browse files
authored
[BUG] Fix failing fork on empty collection (#4366)
## Description of changes *Summarize the changes made by this PR.* - Improvements & Bug fixes - The log service will error during fork if the source colletion is not initialized yet (i.e. no data is added yet), because the compaction and enumeration offset does not exist. This PR fixes this edge case. - New functionality - ... ## Test plan *How are these changes tested?* - [ ] Tests pass locally with `pytest` for python, `yarn test` for js, `cargo test` for rust ## Documentation Changes *Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the [docs repository](https://github.com/chroma-core/docs)?*
1 parent e5edb1f commit c7d01a4

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

go/pkg/log/store/db/queries.sql.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/pkg/log/store/queries/queries.sql

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ FROM record_log r
4646
WHERE r.collection_id = $1;
4747

4848
-- name: GetBoundsForCollection :one
49-
SELECT
50-
COALESCE(record_compaction_offset_position, 0) AS record_compaction_offset_position,
51-
COALESCE(record_enumeration_offset_position, 0) AS record_enumeration_offset_position
49+
SELECT CAST(COALESCE(MIN(record_compaction_offset_position), 0) as bigint) AS record_compaction_offset_position, CAST(COALESCE(MAX(record_enumeration_offset_position), 0) as bigint) AS record_enumeration_offset_position
5250
FROM collection
5351
WHERE id = $1;
5452

0 commit comments

Comments
 (0)