jpountz commented on code in PR #14333: URL: https://github.com/apache/lucene/pull/14333#discussion_r1987259134
########## lucene/core/src/java/org/apache/lucene/codecs/lucene90/blocktree/SegmentTermsEnum.java: ########## @@ -857,123 +768,126 @@ public SeekStatus seekCeil(BytesRef target) throws IOException { } } - @SuppressWarnings("unused") - private void printSeekState(PrintStream out) throws IOException { - if (currentFrame == staticFrame) { - out.println(" no prior seek"); - } else { - out.println(" prior seek state:"); - int ord = 0; - boolean isSeekFrame = true; - while (true) { - SegmentTermsEnumFrame f = getFrame(ord); - assert f != null; - final BytesRef prefix = new BytesRef(term.get().bytes, 0, f.prefixLength); - if (f.nextEnt == -1) { - out.println( - " frame " - + (isSeekFrame ? "(seek)" : "(next)") - + " ord=" - + ord - + " fp=" - + f.fp - + (f.isFloor ? (" (fpOrig=" + f.fpOrig + ")") : "") - + " prefixLen=" - + f.prefixLength - + " prefix=" - + prefix - + (f.nextEnt == -1 ? "" : (" (of " + f.entCount + ")")) - + " hasTerms=" - + f.hasTerms - + " isFloor=" - + f.isFloor - + " code=" - + ((f.fp << Lucene90BlockTreeTermsReader.OUTPUT_FLAGS_NUM_BITS) - + (f.hasTerms ? Lucene90BlockTreeTermsReader.OUTPUT_FLAG_HAS_TERMS : 0) - + (f.isFloor ? Lucene90BlockTreeTermsReader.OUTPUT_FLAG_IS_FLOOR : 0)) - + " isLastInFloor=" - + f.isLastInFloor - + " mdUpto=" - + f.metaDataUpto - + " tbOrd=" - + f.getTermBlockOrd()); - } else { - out.println( - " frame " - + (isSeekFrame ? "(seek, loaded)" : "(next, loaded)") - + " ord=" - + ord - + " fp=" - + f.fp - + (f.isFloor ? (" (fpOrig=" + f.fpOrig + ")") : "") - + " prefixLen=" - + f.prefixLength - + " prefix=" - + prefix - + " nextEnt=" - + f.nextEnt - + (f.nextEnt == -1 ? "" : (" (of " + f.entCount + ")")) - + " hasTerms=" - + f.hasTerms - + " isFloor=" - + f.isFloor - + " code=" - + ((f.fp << Lucene90BlockTreeTermsReader.OUTPUT_FLAGS_NUM_BITS) - + (f.hasTerms ? Lucene90BlockTreeTermsReader.OUTPUT_FLAG_HAS_TERMS : 0) - + (f.isFloor ? Lucene90BlockTreeTermsReader.OUTPUT_FLAG_IS_FLOOR : 0)) - + " lastSubFP=" - + f.lastSubFP - + " isLastInFloor=" - + f.isLastInFloor - + " mdUpto=" - + f.metaDataUpto - + " tbOrd=" - + f.getTermBlockOrd()); - } - if (fr.index != null) { - assert !isSeekFrame || f.arc != null : "isSeekFrame=" + isSeekFrame + " f.arc=" + f.arc; - if (f.prefixLength > 0 - && isSeekFrame - && f.arc.label() != (term.byteAt(f.prefixLength - 1) & 0xFF)) { - out.println( - " broken seek state: arc.label=" - + (char) f.arc.label() - + " vs term byte=" - + (char) (term.byteAt(f.prefixLength - 1) & 0xFF)); - throw new RuntimeException("seek state is broken"); - } - BytesRef output = Util.get(fr.index, prefix); - if (output == null) { - out.println(" broken seek state: prefix is not final in index"); - throw new RuntimeException("seek state is broken"); - } else if (isSeekFrame && !f.isFloor) { - final ByteArrayDataInput reader = - new ByteArrayDataInput(output.bytes, output.offset, output.length); - final long codeOrig = fr.readVLongOutput(reader); - final long code = - (f.fp << Lucene90BlockTreeTermsReader.OUTPUT_FLAGS_NUM_BITS) - | (f.hasTerms ? Lucene90BlockTreeTermsReader.OUTPUT_FLAG_HAS_TERMS : 0) - | (f.isFloor ? Lucene90BlockTreeTermsReader.OUTPUT_FLAG_IS_FLOOR : 0); - if (codeOrig != code) { - out.println( - " broken seek state: output code=" - + codeOrig - + " doesn't match frame code=" - + code); - throw new RuntimeException("seek state is broken"); - } - } - } - if (f == currentFrame) { - break; - } - if (f.prefixLength == validIndexPrefix) { - isSeekFrame = false; - } - ord++; - } - } - } + /* Review Comment: Should we remove this block or comment it out? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org