Skip to content

Commit

Permalink
Merge pull request #1745 from tursodatabase/fix-compactor-shortest-path
Browse files Browse the repository at this point in the history
fix compactor shortest path when there are no segments
  • Loading branch information
MarinPostma authored Sep 19, 2024
2 parents cd9d365 + 05d6e4b commit 7ab5dc0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libsql-wal/src/storage/compaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,13 @@ pub struct AnalyzedSegments {
impl AnalyzedSegments {
/// returns a list of keys that covers frame_no 1 to last in the shortest amount of segments
pub fn shortest_restore_path(&self) -> SegmentSet {
if self.graph.node_count() == 0 {
return SegmentSet {
namespace: self.namespace.clone(),
segments: Vec::new(),
};
}

let path = petgraph::algo::astar(
&self.graph,
1,
Expand Down

0 comments on commit 7ab5dc0

Please sign in to comment.