You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2021/03/29 16:29:46 UTC
[lucene] branch main updated: LUCENE-9888: re-enable CheckIndex
verification that indexSort is the same across all segments (#49)
This is an automated email from the ASF dual-hosted git repository.
mikemccand pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/main by this push:
new 4d16ff2 LUCENE-9888: re-enable CheckIndex verification that indexSort is the same across all segments (#49)
4d16ff2 is described below
commit 4d16ff21b2654bf447d278461d0962ba4029006a
Author: Michael McCandless <mi...@apache.org>
AuthorDate: Mon Mar 29 12:29:40 2021 -0400
LUCENE-9888: re-enable CheckIndex verification that indexSort is the same across all segments (#49)
---
lucene/core/src/java/org/apache/lucene/index/CheckIndex.java | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
index e9c4514..88d62fe 100644
--- a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
+++ b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java
@@ -606,6 +606,8 @@ public final class CheckIndex implements Closeable {
result.newSegments.clear();
result.maxSegmentName = -1;
+ Sort previousIndexSort = null;
+
for (int i = 0; i < numSegments; i++) {
final SegmentCommitInfo info = sis.info(i);
long segmentName = Long.parseLong(info.info.name.substring(1), Character.MAX_RADIX);
@@ -651,6 +653,14 @@ public final class CheckIndex implements Closeable {
Sort indexSort = info.info.getIndexSort();
if (indexSort != null) {
msg(infoStream, " sort=" + indexSort);
+ if (previousIndexSort != null) {
+ if (previousIndexSort.equals(indexSort) == false) {
+ throw new RuntimeException(
+ "index sort changed from " + previousIndexSort + " to " + indexSort);
+ }
+ } else {
+ previousIndexSort = indexSort;
+ }
}
segInfoStat.numFiles = info.files().size();
segInfoStat.sizeMB = info.sizeInBytes() / (1024. * 1024.);