add exceptin in registerMerge && fixed test

This commit is contained in:
luyuncheng 2023-04-27 14:12:21 +08:00 committed by GitHub
parent cac2e633b2
commit d14f5d4a25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -4761,7 +4761,11 @@ public class IndexWriter
+ segString(info)
+ " does not exist in live infos");
}
return false;
throw new MergePolicy.MergeException(
"MergePolicy selected a segment ("
+ info.info.name
+ ") that is not in the current index "
+ segString());
}
if (info.info.dir != directoryOrig) {
isExternal = true;

View File

@ -454,7 +454,7 @@ public class TestConcurrentMergeScheduler extends LuceneTestCase {
// return many merges.
MergeSpecification spec = new MergeSpecification();
List<SegmentCommitInfo> oneMerge = new ArrayList<>();
for (SegmentCommitInfo sci : segmentsToMerge.keySet()) {
for (SegmentCommitInfo sci : segmentInfos) {
oneMerge.add(sci);
if (oneMerge.size() >= 10) {
spec.add(new OneMerge(new ArrayList<>(oneMerge)));