You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/01/18 17:26:39 UTC

[GitHub] [lucene] jpountz commented on a change in pull request #607: LUCENE-10288: Check BKD tree shape for lucene pre-8.6 1D indexes

jpountz commented on a change in pull request #607:
URL: https://github.com/apache/lucene/pull/607#discussion_r786988227



##########
File path: lucene/core/src/java/org/apache/lucene/util/bkd/BKDReader.java
##########
@@ -105,6 +107,51 @@ public BKDReader(IndexInput metaIn, IndexInput indexIn, IndexInput dataIn) throw
     }
     this.packedIndex = indexIn.slice("packedIndex", indexStartPointer, numIndexBytes);
     this.in = dataIn;
+    this.isTreeBalanced = isTreeBalanced();
+  }
+
+  private boolean isTreeBalanced() throws IOException {
+    if (version >= BKDWriter.VERSION_META_FILE || numLeaves == 1) {
+      // since lucene 8.6 all trees are unbalanced.
+      // for only one leaf we can assume unbalanced.
+      return false;
+    }

Review comment:
       I don't think this is correct. Merging has these lines of code:
   
   ```
       for (PointsReader reader : mergeState.pointsReaders) {
         if (reader instanceof Lucene60PointsReader == false) {
           // We can only bulk merge when all to-be-merged segments use our format:
           super.merge(mergeState);
           return;
         }
       }
   ```
   
   and the default merge implementation (`super.merge`) would create a balanced tree with pre-8.6, even in the 1D case.




-- 
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-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org