Skip to content

Commit 05d6e4b

Browse files
committed
fix compactor shortest path when there are no segments
1 parent b03db2d commit 05d6e4b

File tree

1 file changed

+7
-0
lines changed
  • libsql-wal/src/storage/compaction

1 file changed

+7
-0
lines changed

libsql-wal/src/storage/compaction/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,13 @@ pub struct AnalyzedSegments {
403403
impl AnalyzedSegments {
404404
/// returns a list of keys that covers frame_no 1 to last in the shortest amount of segments
405405
pub fn shortest_restore_path(&self) -> SegmentSet {
406+
if self.graph.node_count() == 0 {
407+
return SegmentSet {
408+
namespace: self.namespace.clone(),
409+
segments: Vec::new(),
410+
};
411+
}
412+
406413
let path = petgraph::algo::astar(
407414
&self.graph,
408415
1,

0 commit comments

Comments
 (0)