Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Sachin Kale <kalsac@amazon.com>
  • Loading branch information
Sachin Kale committed Nov 29, 2022
1 parent 58a125f commit 47db802
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void afterRefresh(boolean didRefresh) {
.filter(file -> file.startsWith(IndexFileNames.SEGMENTS))
.collect(Collectors.toList());
Optional<String> latestSegmentInfos = segmentInfosFiles.stream()
.max(Comparator.comparingLong(IndexFileNames::parseGeneration));
.max(Comparator.comparingLong(SegmentInfos::generationFromSegmentsFileName));

if (latestSegmentInfos.isPresent()) {
Set<String> segmentFilesFromSnapshot = new HashSet<>(refreshedLocalFiles);
Expand Down Expand Up @@ -182,7 +182,7 @@ String uploadSegmentInfosSnapshot(String latestSegmentsNFilename, SegmentInfos s
userData.put(SequenceNumbers.MAX_SEQ_NO, Long.toString(processedLocalCheckpoint));
segmentInfosSnapshot.setUserData(userData, false);

long commitGeneration = IndexFileNames.parseGeneration(latestSegmentsNFilename);
long commitGeneration = SegmentInfos.generationFromSegmentsFileName(latestSegmentsNFilename);
String segmentInfoSnapshotFilename = SEGMENT_INFO_SNAPSHOT_FILENAME_PREFIX + "__" + commitGeneration;
try (IndexOutput indexOutput = storeDirectory.createOutput(segmentInfoSnapshotFilename, IOContext.DEFAULT)) {
segmentInfosSnapshot.write(indexOutput);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ private void recoverFromRemoteStore(IndexShard indexShard) throws IndexShardReco
SegmentInfos infosSnapshot = SegmentInfos.readCommit(
store.directory(),
indexInput,
Integer.parseInt(segmentInfosSnapshotFilename.split("__")[1])
Long.parseLong(segmentInfosSnapshotFilename.split("__")[1])
);
long processedLocalCheckpoint = Long.parseLong(infosSnapshot.getUserData().get(LOCAL_CHECKPOINT_KEY));
store.commitSegmentInfos(infosSnapshot, processedLocalCheckpoint, processedLocalCheckpoint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private void verifyUploadedSegments(RemoteSegmentStoreDirectory remoteSegmentSto
assertTrue(
uploadedSegments.keySet()
.stream()
.anyMatch(s -> s.startsWith(SEGMENT_INFO_SNAPSHOT_FILENAME_PREFIX + "__" + commitGeneration))
.anyMatch(s -> s.startsWith(SEGMENT_INFO_SNAPSHOT_FILENAME_PREFIX + "__" + Long.parseLong(commitGeneration, Character.MAX_RADIX)))
);
}
}
Expand Down

0 comments on commit 47db802

Please sign in to comment.