Skip to content

Commit

Permalink
IGNITE-24157 index check fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
maksaska committed Jan 25, 2025
1 parent 5c3a795 commit 5666b96
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,11 @@ private int walArchiveSegments() {
/** @return Last archived file absolute index, 0-based. */
private long lastArchivedSegment() {
if (!metricsEnabled)
return 0;
return -1;

IgniteWriteAheadLogManager walMgr = this.wal;

return walMgr == null ? 0 : walMgr.lastArchivedSegment();
return walMgr == null ? -1 : walMgr.lastArchivedSegment();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,12 +540,16 @@ private void checkWalArchiveAndTotalSize(IgniteEx igniteEx, boolean hasWalArchiv

assertEquals(totalSize, dsMetricRegistry(igniteEx).<LongGauge>findMetric("WalTotalSize").value());

long lastArchivedSegIdx = dsMetricRegistry(igniteEx).<LongGauge>findMetric("LastArchivedSegment").value();

if (router.hasArchive()) {
long cdcWalArchiveSegments = walFiles(walMgr.walCdcDirectory()).length;

// Count of segments = LastArchivedSegmentIndex + 1
assertEquals(cdcWalArchiveSegments, dsMetricRegistry(igniteEx).<LongGauge>findMetric("LastArchivedSegment").value() + 1);
assertEquals(cdcWalArchiveSegments, lastArchivedSegIdx + 1);
}
else
assertEquals(-1, lastArchivedSegIdx);
}

/**
Expand Down

0 comments on commit 5666b96

Please sign in to comment.