jpountz commented on a change in pull request #2109:
URL: https://github.com/apache/lucene-solr/pull/2109#discussion_r542333262



##########
File path: 
lucene/core/src/java/org/apache/lucene/codecs/lucene50/Lucene50CompoundFormat.java
##########
@@ -80,52 +89,46 @@ public void write(Directory dir, SegmentInfo si, IOContext 
context) throws IOExc
          IndexOutput entries = dir.createOutput(entriesFile, context)) {
       CodecUtil.writeIndexHeader(data,    DATA_CODEC, VERSION_CURRENT, 
si.getId(), "");
       CodecUtil.writeIndexHeader(entries, ENTRY_CODEC, VERSION_CURRENT, 
si.getId(), "");
-      
-      // write number of files
-      entries.writeVInt(si.files().size());
-      for (String file : si.files()) {
-        
-        // write bytes for file
-        long startOffset = data.getFilePointer();
-        try (ChecksumIndexInput in = dir.openChecksumInput(file, 
IOContext.READONCE)) {
-
-          // just copies the index header, verifying that its id matches what 
we expect
-          CodecUtil.verifyAndCopyIndexHeader(in, data, si.getId());
-          
-          // copy all bytes except the footer
-          long numBytesToCopy = in.length() - CodecUtil.footerLength() - 
in.getFilePointer();
-          data.copyBytes(in, numBytesToCopy);
-
-          // verify footer (checksum) matches for the incoming file we are 
copying
-          long checksum = CodecUtil.checkFooter(in);
 
-          // this is poached from CodecUtil.writeFooter, but we need to use 
our own checksum, not data.getChecksum(), but I think
-          // adding a public method to CodecUtil to do that is somewhat 
dangerous:
-          data.writeInt(CodecUtil.FOOTER_MAGIC);
-          data.writeInt(0);
-          data.writeLong(checksum);
-        }
-        long endOffset = data.getFilePointer();
-        
-        long length = endOffset - startOffset;
-        
-        // write entry for file
-        entries.writeString(IndexFileNames.stripSegmentName(file));
-        entries.writeLong(startOffset);
-        entries.writeLong(length);
-      }
+      writeSegmentInfo(entries, data, dir, si);

Review comment:
       call it `writeCompoundFile`?




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