Signed-off-by: Alex Chi Z <chi@neon.tech>
This commit is contained in:
Alex Chi Z
2023-06-29 14:48:54 -04:00
parent 647b7a70a8
commit d28e309c06
2 changed files with 21 additions and 14 deletions

View File

@@ -285,18 +285,14 @@ impl LayerMap {
let img_lsn = image.get_lsn_range().start;
let image_is_newer = image.get_lsn_range().end >= delta.get_lsn_range().end;
let image_exact_match = img_lsn + 1 == end_lsn;
if !image_exact_match && image_is_newer {
Some((
SearchResult {
layer: image,
lsn_floor: img_lsn,
},
None,
))
} else {
let lsn_floor =
std::cmp::max(delta.get_lsn_range().start, image.get_lsn_range().start + 1);
if image_exact_match {
if image_is_newer || image_exact_match {
if img_lsn + 1 == delta.get_lsn_range().end {
// incremental, image lsn N, if it does not contain the image, we should start with
// delta lsn N+1 instead of N.
let lsn_floor = std::cmp::max(
delta.get_lsn_range().start,
image.get_lsn_range().start + 1,
);
Some((
SearchResult {
layer: image,
@@ -310,12 +306,22 @@ impl LayerMap {
} else {
Some((
SearchResult {
layer: delta,
lsn_floor,
layer: image,
lsn_floor: img_lsn,
},
None,
))
}
} else {
let lsn_floor =
std::cmp::max(delta.get_lsn_range().start, image.get_lsn_range().start + 1);
Some((
SearchResult {
layer: delta,
lsn_floor,
},
None,
))
}
}
}

View File

@@ -2620,6 +2620,7 @@ impl Timeline {
let old_layer = layer.clone();
// if is incremental image layer and not found, try again with delta layer
if let Some(SearchResult { lsn_floor, layer }) = next {
println!("TRIGGERED!");
traversal_path.push((
result,
cont_lsn,