You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mark files stored in the PersistentCache as reused in RecoveryState (#67559)
Before this commit we were marking all files as recovered during searchable
snapshots pre-warm phase. After introducing the persistent cache, it's possible
that some of these files are already on disk and are in fact reused. This commit
takes that fact into account and mark files that are in the persistent cache as
reused.
Backport of #67425
Copy file name to clipboardExpand all lines: x-pack/plugin/searchable-snapshots/src/internalClusterTest/java/org/elasticsearch/xpack/searchablesnapshots/SearchableSnapshotRecoveryStateIntegrationTests.java
Copy file name to clipboardExpand all lines: x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/SearchableSnapshotDirectory.java
Copy file name to clipboardExpand all lines: x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/CachedBlobContainerIndexInput.java
Copy file name to clipboardExpand all lines: x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/index/store/cache/SparseFileTracker.java
+18Lines changed: 18 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,12 @@ public class SparseFileTracker {
37
37
38
38
privatefinallonglength;
39
39
40
+
/**
41
+
* Number of bytes that were initially present in the case where the sparse file tracker was initialized with some completed ranges.
42
+
* See {@link #SparseFileTracker(String, long, SortedSet)}
43
+
*/
44
+
privatefinallonginitialLength;
45
+
40
46
/**
41
47
* Creates a new empty {@link SparseFileTracker}
42
48
*
@@ -60,6 +66,7 @@ public SparseFileTracker(String description, long length, SortedSet<Tuple<Long,
60
66
if (length < 0) {
61
67
thrownewIllegalArgumentException("Length [" + length + "] must be equal to or greater than 0 for [" + description + "]");
62
68
}
69
+
longinitialLength = 0;
63
70
if (ranges.isEmpty() == false) {
64
71
synchronized (mutex) {
65
72
Rangeprevious = null;
@@ -77,10 +84,12 @@ public SparseFileTracker(String description, long length, SortedSet<Tuple<Long,
77
84
finalbooleanadded = this.ranges.add(range);
78
85
assertadded : range + " already exist in " + this.ranges;
79
86
previous = range;
87
+
initialLength += range.end - range.start;
80
88
}
81
89
assertinvariant();
82
90
}
83
91
}
92
+
this.initialLength = initialLength;
84
93
}
85
94
86
95
publiclonggetLength() {
@@ -104,6 +113,15 @@ public SortedSet<Tuple<Long, Long>> getCompletedRanges() {
Copy file name to clipboardExpand all lines: x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/indices/recovery/SearchableSnapshotRecoveryState.java
+15Lines changed: 15 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,11 @@ public synchronized void ignoreFile(String name) {
0 commit comments