Skip to content

Commit 451aa5b

Browse files
sjuddConvex, Inc.
authored and
Convex, Inc.
committed
Write the old backfilling text index format for rollback compatibility (#25816)
GitOrigin-RevId: eca1ce33573aa19b72d523cfb6e0bf80db50cb21
1 parent e7f1366 commit 451aa5b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

crates/common/src/bootstrap_model/index/search_index/index_state.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,19 @@ impl TryFrom<SearchIndexState> for SerializedSearchIndexState {
4848

4949
fn try_from(state: SearchIndexState) -> Result<Self, Self::Error> {
5050
Ok(match state {
51-
SearchIndexState::Backfilling(state) => SerializedSearchIndexState::Backfilling2 {
52-
backfill_state: state.try_into()?,
51+
SearchIndexState::Backfilling(state) => {
52+
// Maintain rollback compatibility with the old format by writing empty
53+
// backfilling states using the old format. Since we don't
54+
// currently use the new format, all states should be empty, so
55+
// we should always write the old format. TODO(CX-6465): Clean
56+
// this up.
57+
if state.segments.is_empty() && state.cursor.is_none() {
58+
SerializedSearchIndexState::Backfilling
59+
} else {
60+
SerializedSearchIndexState::Backfilling2 {
61+
backfill_state: state.try_into()?,
62+
}
63+
}
5364
},
5465
SearchIndexState::Backfilled(snapshot) => SerializedSearchIndexState::Backfilled {
5566
snapshot: snapshot.try_into()?,

0 commit comments

Comments
 (0)