juanka588 commented on a change in pull request #1473:
URL: https://github.com/apache/lucene-solr/pull/1473#discussion_r419449861



##########
File path: 
lucene/core/src/java/org/apache/lucene/codecs/blocktree/BlockTreeTermsWriter.java
##########
@@ -1060,36 +1052,35 @@ public void close() throws IOException {
       return;
     }
     closed = true;
-    
+
+    final String metaName = 
IndexFileNames.segmentFileName(state.segmentInfo.name, state.segmentSuffix, 
BlockTreeTermsReader.TERMS_META_EXTENSION);
     boolean success = false;
-    try {
-      
-      final long dirStart = termsOut.getFilePointer();
-      final long indexDirStart = indexOut.getFilePointer();
+    try (IndexOutput metaOut = state.directory.createOutput(metaName, 
state.context)) {
+      CodecUtil.writeIndexHeader(metaOut, 
BlockTreeTermsReader.TERMS_META_CODEC_NAME, 
BlockTreeTermsReader.VERSION_CURRENT,
+          state.segmentInfo.getId(), state.segmentSuffix);
 
-      termsOut.writeVInt(fields.size());
+      metaOut.writeVInt(fields.size());

Review comment:
       yes but maybe is the opportunity to move the code and add more 
testability in BlockTreeTermsReader.java 




----------------------------------------------------------------
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.

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

Reply via email to