Skip to content

Commit 8cd29b9

Browse files
authored
Fix bootstrap case when we treat absent metadata as metadata with gen=0 (#2154)
2 parents 6e55668 + 7308215 commit 8cd29b9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

libsql/src/sync.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,6 @@ impl SyncContext {
172172
remote_encryption,
173173
};
174174
me.read_metadata().await?;
175-
if me.durable_generation == 0 {
176-
return Err(SyncError::InvalidLocalState("generation is 0".to_string()).into());
177-
}
178175
Ok(me)
179176
}
180177

@@ -575,6 +572,10 @@ impl SyncContext {
575572
metadata
576573
);
577574

575+
if metadata.generation == 0 {
576+
return Err(SyncError::InvalidLocalState("generation is 0".to_string()).into());
577+
}
578+
578579
self.durable_generation = metadata.generation;
579580
self.durable_frame_num = metadata.durable_frame_num;
580581

@@ -991,7 +992,8 @@ pub async fn try_pull(
991992
if !insert_handle.in_session() {
992993
tracing::debug!(
993994
"pull_frames: generation={}, frame={}, start wal transaction session",
994-
generation, next_frame_no
995+
generation,
996+
next_frame_no
995997
);
996998
insert_handle.begin()?;
997999
}

0 commit comments

Comments
 (0)