Skip to content

Commit 3d9e3d0

Browse files
authored
Report recovered files as recovered from snapshot for fully mounted searchable snapshots (elastic#92976)
Files recovered for fully mounted searchable snapshots indices are reported in the same manner as files recover from disk for regular indices. This can be confusing for users because we later introduced a recovered_from_snapshot_in_bytes (for snapshot based peer recoveries, that is not applicable to searchable snapshots indices) and this field is always 0 for searchable snapshots indices. This commit changes the Recovery file details so that recovered_from_snapshot_in_bytes is now populated for files recovered for fully mounted searchable snapshots indices, which I think makes more sense now we have this recovered_from_snapshot_in_bytes field.
1 parent a907d3d commit 3d9e3d0

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

docs/changelog/92976.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 92976
2+
summary: Report recovered files as recovered from snapshot for fully mounted searchable
3+
snapshots
4+
area: Recovery
5+
type: bug
6+
issues: []

x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/recovery/SearchableSnapshotRecoveryStateIntegrationTests.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ public void testRecoveryStateRecoveredBytesMatchPhysicalCacheState() throws Exce
105105

106106
assertThat("Physical cache size doesn't match with recovery state data", physicalCacheSize, equalTo(recoveredBytes));
107107
assertThat("Expected to recover 100% of files", recoveryState.getIndex().recoveredBytesPercent(), equalTo(100.0f));
108+
assertThat(recoveryState.getIndex().recoveredFromSnapshotBytes(), equalTo(recoveredBytes));
109+
assertThat(recoveryState.getIndex().recoveredBytes(), equalTo(recoveredBytes));
108110
}
109111

110112
public void testFilesStoredInThePersistentCacheAreMarkedAsReusedInRecoveryState() throws Exception {
@@ -198,6 +200,7 @@ public void testFilesStoredInThePersistentCacheAreMarkedAsReusedInRecoveryState(
198200
assertThat(physicalCacheSize, equalTo(expectedPhysicalCacheSize));
199201
assertThat(physicalCacheSize + inMemoryCacheSize, equalTo(recoveryState.getIndex().reusedBytes()));
200202
assertThat("Expected to recover 100% of files", recoveryState.getIndex().recoveredBytesPercent(), equalTo(100.0f));
203+
assertThat(recoveryState.getIndex().recoveredFromSnapshotBytes(), equalTo(0L));
201204

202205
for (RecoveryState.FileDetail fileDetail : recoveryState.getIndex().fileDetails()) {
203206
assertThat(fileDetail.name() + " wasn't mark as reused", fileDetail.reused(), equalTo(true));

x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/store/SearchableSnapshotDirectory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ private void prewarmCache(ActionListener<Void> listener) {
532532
if (persistentCacheLength == file.length()) {
533533
recoveryState.markIndexFileAsReused(file.physicalName());
534534
} else {
535-
recoveryState.getIndex().addRecoveredBytesToFile(file.physicalName(), file.partBytes(part));
535+
recoveryState.getIndex().addRecoveredFromSnapshotBytesToFile(file.physicalName(), file.partBytes(part));
536536
}
537537

538538
logger.trace(

0 commit comments

Comments
 (0)