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 2021/01/29 09:43:31 UTC

[GitHub] [lucene-solr] iverase opened a new pull request #2268: LUCENE-9705: Move Lucene50CompoundFormat to Lucene90CompoundFormat

iverase opened a new pull request #2268:
URL: https://github.com/apache/lucene-solr/pull/2268


   see https://issues.apache.org/jira/browse/LUCENE-9705


----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] jtibshirani commented on a change in pull request #2268: LUCENE-9705: Move Lucene50CompoundFormat to Lucene90CompoundFormat

Posted by GitBox <gi...@apache.org>.
jtibshirani commented on a change in pull request #2268:
URL: https://github.com/apache/lucene-solr/pull/2268#discussion_r567116775



##########
File path: lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene50/Lucene50CompoundFormat.java
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.backward_codecs.lucene50;
+
+import java.io.IOException;
+import org.apache.lucene.codecs.CodecUtil;
+import org.apache.lucene.codecs.CompoundDirectory;
+import org.apache.lucene.codecs.CompoundFormat;
+import org.apache.lucene.index.SegmentInfo;
+import org.apache.lucene.store.DataOutput;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IOContext;
+
+/**
+ * Lucene 5.0 compound file format
+ *
+ * <p>Files:
+ *
+ * <ul>
+ *   <li><code>.cfs</code>: An optional "virtual" file consisting of all the other index files for
+ *       systems that frequently run out of file handles.
+ *   <li><code>.cfe</code>: The "virtual" compound file's entry table holding all entries in the
+ *       corresponding .cfs file.
+ * </ul>
+ *
+ * <p>Description:
+ *
+ * <ul>
+ *   <li>Compound (.cfs) --&gt; Header, FileData <sup>FileCount</sup>, Footer
+ *   <li>Compound Entry Table (.cfe) --&gt; Header, FileCount, &lt;FileName, DataOffset,
+ *       DataLength&gt; <sup>FileCount</sup>
+ *   <li>Header --&gt; {@link CodecUtil#writeIndexHeader IndexHeader}
+ *   <li>FileCount --&gt; {@link DataOutput#writeVInt VInt}
+ *   <li>DataOffset,DataLength,Checksum --&gt; {@link DataOutput#writeLong UInt64}
+ *   <li>FileName --&gt; {@link DataOutput#writeString String}
+ *   <li>FileData --&gt; raw file data
+ *   <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter}
+ * </ul>
+ *
+ * <p>Notes:
+ *
+ * <ul>
+ *   <li>FileCount indicates how many files are contained in this compound file. The entry table
+ *       that follows has that many entries.
+ *   <li>Each directory entry contains a long pointer to the start of this file's data section, the
+ *       files length, and a String with that file's name.
+ * </ul>
+ */
+public final class Lucene50CompoundFormat extends CompoundFormat {
+
+  /** Extension of compound file */
+  static final String DATA_EXTENSION = "cfs";
+  /** Extension of compound file entries */
+  static final String ENTRIES_EXTENSION = "cfe";
+
+  static final String DATA_CODEC = "Lucene50CompoundData";
+  static final String ENTRY_CODEC = "Lucene50CompoundEntries";
+  static final int VERSION_START = 0;

Review comment:
       Do we still want to keep this internal versioning? Or could we simplify and remove it entirely?




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] jpountz commented on a change in pull request #2268: LUCENE-9705: Move Lucene50CompoundFormat to Lucene90CompoundFormat

Posted by GitBox <gi...@apache.org>.
jpountz commented on a change in pull request #2268:
URL: https://github.com/apache/lucene-solr/pull/2268#discussion_r568617447



##########
File path: lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene50/Lucene50CompoundFormat.java
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.backward_codecs.lucene50;
+
+import java.io.IOException;
+import org.apache.lucene.codecs.CodecUtil;
+import org.apache.lucene.codecs.CompoundDirectory;
+import org.apache.lucene.codecs.CompoundFormat;
+import org.apache.lucene.index.SegmentInfo;
+import org.apache.lucene.store.DataOutput;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IOContext;
+
+/**
+ * Lucene 5.0 compound file format
+ *
+ * <p>Files:
+ *
+ * <ul>
+ *   <li><code>.cfs</code>: An optional "virtual" file consisting of all the other index files for
+ *       systems that frequently run out of file handles.
+ *   <li><code>.cfe</code>: The "virtual" compound file's entry table holding all entries in the
+ *       corresponding .cfs file.
+ * </ul>
+ *
+ * <p>Description:
+ *
+ * <ul>
+ *   <li>Compound (.cfs) --&gt; Header, FileData <sup>FileCount</sup>, Footer
+ *   <li>Compound Entry Table (.cfe) --&gt; Header, FileCount, &lt;FileName, DataOffset,
+ *       DataLength&gt; <sup>FileCount</sup>
+ *   <li>Header --&gt; {@link CodecUtil#writeIndexHeader IndexHeader}
+ *   <li>FileCount --&gt; {@link DataOutput#writeVInt VInt}
+ *   <li>DataOffset,DataLength,Checksum --&gt; {@link DataOutput#writeLong UInt64}
+ *   <li>FileName --&gt; {@link DataOutput#writeString String}
+ *   <li>FileData --&gt; raw file data
+ *   <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter}
+ * </ul>
+ *
+ * <p>Notes:
+ *
+ * <ul>
+ *   <li>FileCount indicates how many files are contained in this compound file. The entry table
+ *       that follows has that many entries.
+ *   <li>Each directory entry contains a long pointer to the start of this file's data section, the
+ *       files length, and a String with that file's name.
+ * </ul>
+ */
+public final class Lucene50CompoundFormat extends CompoundFormat {
+
+  /** Extension of compound file */
+  static final String DATA_EXTENSION = "cfs";
+  /** Extension of compound file entries */
+  static final String ENTRIES_EXTENSION = "cfe";
+
+  static final String DATA_CODEC = "Lucene50CompoundData";
+  static final String ENTRY_CODEC = "Lucene50CompoundEntries";
+  static final int VERSION_START = 0;

Review comment:
       I'd like to keep it for now, even if the version is always 0. My gut feeling is that we should fork file formats more aggressively than we do today but I still don't have full confidence that we will never use the internal versioning again.




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] iverase commented on a change in pull request #2268: LUCENE-9705: Move Lucene50CompoundFormat to Lucene90CompoundFormat

Posted by GitBox <gi...@apache.org>.
iverase commented on a change in pull request #2268:
URL: https://github.com/apache/lucene-solr/pull/2268#discussion_r566697969



##########
File path: lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50CompoundFormat.java
##########
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.backward_codecs.lucene50;
+
+import org.apache.lucene.backward_codecs.Lucene87.Lucene87RWCodec;
+import org.apache.lucene.codecs.Codec;
+import org.apache.lucene.index.BaseCompoundFormatTestCase;
+
+public class TestLucene50CompoundFormat extends BaseCompoundFormatTestCase {
+  ;
+
+  @Override
+  protected Codec getCodec() {
+    return new Lucene87RWCodec();

Review comment:
       We could use other codecs as well?




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] iverase commented on a change in pull request #2268: LUCENE-9705: Move Lucene50CompoundFormat to Lucene90CompoundFormat

Posted by GitBox <gi...@apache.org>.
iverase commented on a change in pull request #2268:
URL: https://github.com/apache/lucene-solr/pull/2268#discussion_r571865100



##########
File path: lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90CompoundFormat.java
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.codecs.lucene90;
+
+import java.io.IOException;
+import org.apache.lucene.codecs.CodecUtil;
+import org.apache.lucene.codecs.CompoundDirectory;
+import org.apache.lucene.codecs.CompoundFormat;
+import org.apache.lucene.index.IndexFileNames;
+import org.apache.lucene.index.SegmentInfo;
+import org.apache.lucene.store.ChecksumIndexInput;
+import org.apache.lucene.store.DataOutput;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IOContext;
+import org.apache.lucene.store.IndexOutput;
+
+/**
+ * Lucene 9.0 compound file format
+ *
+ * <p>Files:
+ *
+ * <ul>
+ *   <li><code>.cfs</code>: An optional "virtual" file consisting of all the other index files for
+ *       systems that frequently run out of file handles.
+ *   <li><code>.cfe</code>: The "virtual" compound file's entry table holding all entries in the
+ *       corresponding .cfs file.
+ * </ul>
+ *
+ * <p>Description:
+ *
+ * <ul>
+ *   <li>Compound (.cfs) --&gt; Header, FileData <sup>FileCount</sup>, Footer
+ *   <li>Compound Entry Table (.cfe) --&gt; Header, FileCount, &lt;FileName, DataOffset,
+ *       DataLength&gt; <sup>FileCount</sup>
+ *   <li>Header --&gt; {@link CodecUtil#writeIndexHeader IndexHeader}
+ *   <li>FileCount --&gt; {@link DataOutput#writeVInt VInt}
+ *   <li>DataOffset,DataLength,Checksum --&gt; {@link DataOutput#writeLong UInt64}
+ *   <li>FileName --&gt; {@link DataOutput#writeString String}
+ *   <li>FileData --&gt; raw file data
+ *   <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter}
+ * </ul>
+ *
+ * <p>Notes:
+ *
+ * <ul>
+ *   <li>FileCount indicates how many files are contained in this compound file. The entry table
+ *       that follows has that many entries.
+ *   <li>Each directory entry contains a long pointer to the start of this file's data section, the
+ *       files length, and a String with that file's name.
+ * </ul>
+ */
+public final class Lucene90CompoundFormat extends CompoundFormat {
+
+  /** Extension of compound file */
+  static final String DATA_EXTENSION = "cfs";
+  /** Extension of compound file entries */
+  static final String ENTRIES_EXTENSION = "cfe";
+

Review comment:
       I guess the only benefit is that you can distinguish the files from the new codec vs previous codec by name.




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] iverase commented on a change in pull request #2268: LUCENE-9705: Move Lucene50CompoundFormat to Lucene90CompoundFormat

Posted by GitBox <gi...@apache.org>.
iverase commented on a change in pull request #2268:
URL: https://github.com/apache/lucene-solr/pull/2268#discussion_r572056659



##########
File path: lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90CompoundFormat.java
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.codecs.lucene90;
+
+import java.io.IOException;
+import org.apache.lucene.codecs.CodecUtil;
+import org.apache.lucene.codecs.CompoundDirectory;
+import org.apache.lucene.codecs.CompoundFormat;
+import org.apache.lucene.index.IndexFileNames;
+import org.apache.lucene.index.SegmentInfo;
+import org.apache.lucene.store.ChecksumIndexInput;
+import org.apache.lucene.store.DataOutput;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IOContext;
+import org.apache.lucene.store.IndexOutput;
+
+/**
+ * Lucene 9.0 compound file format
+ *
+ * <p>Files:
+ *
+ * <ul>
+ *   <li><code>.cfs</code>: An optional "virtual" file consisting of all the other index files for
+ *       systems that frequently run out of file handles.
+ *   <li><code>.cfe</code>: The "virtual" compound file's entry table holding all entries in the
+ *       corresponding .cfs file.
+ * </ul>
+ *
+ * <p>Description:
+ *
+ * <ul>
+ *   <li>Compound (.cfs) --&gt; Header, FileData <sup>FileCount</sup>, Footer
+ *   <li>Compound Entry Table (.cfe) --&gt; Header, FileCount, &lt;FileName, DataOffset,
+ *       DataLength&gt; <sup>FileCount</sup>
+ *   <li>Header --&gt; {@link CodecUtil#writeIndexHeader IndexHeader}
+ *   <li>FileCount --&gt; {@link DataOutput#writeVInt VInt}
+ *   <li>DataOffset,DataLength,Checksum --&gt; {@link DataOutput#writeLong UInt64}
+ *   <li>FileName --&gt; {@link DataOutput#writeString String}
+ *   <li>FileData --&gt; raw file data
+ *   <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter}
+ * </ul>
+ *
+ * <p>Notes:
+ *
+ * <ul>
+ *   <li>FileCount indicates how many files are contained in this compound file. The entry table
+ *       that follows has that many entries.
+ *   <li>Each directory entry contains a long pointer to the start of this file's data section, the
+ *       files length, and a String with that file's name.
+ * </ul>
+ */
+public final class Lucene90CompoundFormat extends CompoundFormat {
+
+  /** Extension of compound file */
+  static final String DATA_EXTENSION = "cfs";
+  /** Extension of compound file entries */
+  static final String ENTRIES_EXTENSION = "cfe";
+

Review comment:
       Sounds good to me




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] iverase commented on a change in pull request #2268: LUCENE-9705: Move Lucene50CompoundFormat to Lucene90CompoundFormat

Posted by GitBox <gi...@apache.org>.
iverase commented on a change in pull request #2268:
URL: https://github.com/apache/lucene-solr/pull/2268#discussion_r566697337



##########
File path: lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90CompoundFormat.java
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.codecs.lucene90;
+
+import java.io.IOException;
+import org.apache.lucene.codecs.CodecUtil;
+import org.apache.lucene.codecs.CompoundDirectory;
+import org.apache.lucene.codecs.CompoundFormat;
+import org.apache.lucene.index.IndexFileNames;
+import org.apache.lucene.index.SegmentInfo;
+import org.apache.lucene.store.ChecksumIndexInput;
+import org.apache.lucene.store.DataOutput;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IOContext;
+import org.apache.lucene.store.IndexOutput;
+
+/**
+ * Lucene 9.0 compound file format
+ *
+ * <p>Files:
+ *
+ * <ul>
+ *   <li><code>.cfs</code>: An optional "virtual" file consisting of all the other index files for
+ *       systems that frequently run out of file handles.
+ *   <li><code>.cfe</code>: The "virtual" compound file's entry table holding all entries in the
+ *       corresponding .cfs file.
+ * </ul>
+ *
+ * <p>Description:
+ *
+ * <ul>
+ *   <li>Compound (.cfs) --&gt; Header, FileData <sup>FileCount</sup>, Footer
+ *   <li>Compound Entry Table (.cfe) --&gt; Header, FileCount, &lt;FileName, DataOffset,
+ *       DataLength&gt; <sup>FileCount</sup>
+ *   <li>Header --&gt; {@link CodecUtil#writeIndexHeader IndexHeader}
+ *   <li>FileCount --&gt; {@link DataOutput#writeVInt VInt}
+ *   <li>DataOffset,DataLength,Checksum --&gt; {@link DataOutput#writeLong UInt64}
+ *   <li>FileName --&gt; {@link DataOutput#writeString String}
+ *   <li>FileData --&gt; raw file data
+ *   <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter}
+ * </ul>
+ *
+ * <p>Notes:
+ *
+ * <ul>
+ *   <li>FileCount indicates how many files are contained in this compound file. The entry table
+ *       that follows has that many entries.
+ *   <li>Each directory entry contains a long pointer to the start of this file's data section, the
+ *       files length, and a String with that file's name.
+ * </ul>
+ */
+public final class Lucene90CompoundFormat extends CompoundFormat {
+
+  /** Extension of compound file */
+  static final String DATA_EXTENSION = "cfs";
+  /** Extension of compound file entries */
+  static final String ENTRIES_EXTENSION = "cfe";
+

Review comment:
       Shall we keep the extensions or use new ones?




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] iverase merged pull request #2268: LUCENE-9705: Move Lucene50CompoundFormat to Lucene90CompoundFormat

Posted by GitBox <gi...@apache.org>.
iverase merged pull request #2268:
URL: https://github.com/apache/lucene-solr/pull/2268


   


----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] jtibshirani commented on a change in pull request #2268: LUCENE-9705: Move Lucene50CompoundFormat to Lucene90CompoundFormat

Posted by GitBox <gi...@apache.org>.
jtibshirani commented on a change in pull request #2268:
URL: https://github.com/apache/lucene-solr/pull/2268#discussion_r570454164



##########
File path: lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene50/Lucene50CompoundFormat.java
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.backward_codecs.lucene50;
+
+import java.io.IOException;
+import org.apache.lucene.codecs.CodecUtil;
+import org.apache.lucene.codecs.CompoundDirectory;
+import org.apache.lucene.codecs.CompoundFormat;
+import org.apache.lucene.index.SegmentInfo;
+import org.apache.lucene.store.DataOutput;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IOContext;
+
+/**
+ * Lucene 5.0 compound file format
+ *
+ * <p>Files:
+ *
+ * <ul>
+ *   <li><code>.cfs</code>: An optional "virtual" file consisting of all the other index files for
+ *       systems that frequently run out of file handles.
+ *   <li><code>.cfe</code>: The "virtual" compound file's entry table holding all entries in the
+ *       corresponding .cfs file.
+ * </ul>
+ *
+ * <p>Description:
+ *
+ * <ul>
+ *   <li>Compound (.cfs) --&gt; Header, FileData <sup>FileCount</sup>, Footer
+ *   <li>Compound Entry Table (.cfe) --&gt; Header, FileCount, &lt;FileName, DataOffset,
+ *       DataLength&gt; <sup>FileCount</sup>
+ *   <li>Header --&gt; {@link CodecUtil#writeIndexHeader IndexHeader}
+ *   <li>FileCount --&gt; {@link DataOutput#writeVInt VInt}
+ *   <li>DataOffset,DataLength,Checksum --&gt; {@link DataOutput#writeLong UInt64}
+ *   <li>FileName --&gt; {@link DataOutput#writeString String}
+ *   <li>FileData --&gt; raw file data
+ *   <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter}
+ * </ul>
+ *
+ * <p>Notes:
+ *
+ * <ul>
+ *   <li>FileCount indicates how many files are contained in this compound file. The entry table
+ *       that follows has that many entries.
+ *   <li>Each directory entry contains a long pointer to the start of this file's data section, the
+ *       files length, and a String with that file's name.
+ * </ul>
+ */
+public final class Lucene50CompoundFormat extends CompoundFormat {
+
+  /** Extension of compound file */
+  static final String DATA_EXTENSION = "cfs";
+  /** Extension of compound file entries */
+  static final String ENTRIES_EXTENSION = "cfe";
+
+  static final String DATA_CODEC = "Lucene50CompoundData";
+  static final String ENTRY_CODEC = "Lucene50CompoundEntries";
+  static final int VERSION_START = 0;

Review comment:
       Thanks, this helps clarify our current thinking. It's also nice that all file formats have the same header structure.

##########
File path: lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90CompoundFormat.java
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.codecs.lucene90;
+
+import java.io.IOException;
+import org.apache.lucene.codecs.CodecUtil;
+import org.apache.lucene.codecs.CompoundDirectory;
+import org.apache.lucene.codecs.CompoundFormat;
+import org.apache.lucene.index.IndexFileNames;
+import org.apache.lucene.index.SegmentInfo;
+import org.apache.lucene.store.ChecksumIndexInput;
+import org.apache.lucene.store.DataOutput;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IOContext;
+import org.apache.lucene.store.IndexOutput;
+
+/**
+ * Lucene 9.0 compound file format
+ *
+ * <p>Files:
+ *
+ * <ul>
+ *   <li><code>.cfs</code>: An optional "virtual" file consisting of all the other index files for
+ *       systems that frequently run out of file handles.
+ *   <li><code>.cfe</code>: The "virtual" compound file's entry table holding all entries in the
+ *       corresponding .cfs file.
+ * </ul>
+ *
+ * <p>Description:
+ *
+ * <ul>
+ *   <li>Compound (.cfs) --&gt; Header, FileData <sup>FileCount</sup>, Footer
+ *   <li>Compound Entry Table (.cfe) --&gt; Header, FileCount, &lt;FileName, DataOffset,
+ *       DataLength&gt; <sup>FileCount</sup>
+ *   <li>Header --&gt; {@link CodecUtil#writeIndexHeader IndexHeader}
+ *   <li>FileCount --&gt; {@link DataOutput#writeVInt VInt}
+ *   <li>DataOffset,DataLength,Checksum --&gt; {@link DataOutput#writeLong UInt64}
+ *   <li>FileName --&gt; {@link DataOutput#writeString String}
+ *   <li>FileData --&gt; raw file data
+ *   <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter}
+ * </ul>
+ *
+ * <p>Notes:
+ *
+ * <ul>
+ *   <li>FileCount indicates how many files are contained in this compound file. The entry table
+ *       that follows has that many entries.
+ *   <li>Each directory entry contains a long pointer to the start of this file's data section, the
+ *       files length, and a String with that file's name.
+ * </ul>
+ */
+public final class Lucene90CompoundFormat extends CompoundFormat {
+
+  /** Extension of compound file */
+  static final String DATA_EXTENSION = "cfs";
+  /** Extension of compound file entries */
+  static final String ENTRIES_EXTENSION = "cfe";
+

Review comment:
       What would be the motivation? Do you have an idea for improved names?




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] jpountz commented on a change in pull request #2268: LUCENE-9705: Move Lucene50CompoundFormat to Lucene90CompoundFormat

Posted by GitBox <gi...@apache.org>.
jpountz commented on a change in pull request #2268:
URL: https://github.com/apache/lucene-solr/pull/2268#discussion_r570105057



##########
File path: lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50CompoundFormat.java
##########
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.backward_codecs.lucene50;
+
+import org.apache.lucene.backward_codecs.Lucene87.Lucene87RWCodec;
+import org.apache.lucene.codecs.Codec;
+import org.apache.lucene.index.BaseCompoundFormatTestCase;
+
+public class TestLucene50CompoundFormat extends BaseCompoundFormatTestCase {
+  ;
+
+  @Override
+  protected Codec getCodec() {
+    return new Lucene87RWCodec();

Review comment:
       For simplicity I'd rather only test the most recent codec that uses the Lucene50 compound format like here.

##########
File path: lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene50/Lucene50CompoundFormat.java
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.backward_codecs.lucene50;
+
+import java.io.IOException;
+import org.apache.lucene.codecs.CodecUtil;
+import org.apache.lucene.codecs.CompoundDirectory;
+import org.apache.lucene.codecs.CompoundFormat;
+import org.apache.lucene.index.SegmentInfo;
+import org.apache.lucene.store.DataOutput;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IOContext;
+
+/**
+ * Lucene 5.0 compound file format
+ *
+ * <p>Files:
+ *
+ * <ul>
+ *   <li><code>.cfs</code>: An optional "virtual" file consisting of all the other index files for
+ *       systems that frequently run out of file handles.
+ *   <li><code>.cfe</code>: The "virtual" compound file's entry table holding all entries in the
+ *       corresponding .cfs file.
+ * </ul>
+ *
+ * <p>Description:
+ *
+ * <ul>
+ *   <li>Compound (.cfs) --&gt; Header, FileData <sup>FileCount</sup>, Footer
+ *   <li>Compound Entry Table (.cfe) --&gt; Header, FileCount, &lt;FileName, DataOffset,
+ *       DataLength&gt; <sup>FileCount</sup>
+ *   <li>Header --&gt; {@link CodecUtil#writeIndexHeader IndexHeader}
+ *   <li>FileCount --&gt; {@link DataOutput#writeVInt VInt}
+ *   <li>DataOffset,DataLength,Checksum --&gt; {@link DataOutput#writeLong UInt64}
+ *   <li>FileName --&gt; {@link DataOutput#writeString String}
+ *   <li>FileData --&gt; raw file data
+ *   <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter}
+ * </ul>
+ *
+ * <p>Notes:
+ *
+ * <ul>
+ *   <li>FileCount indicates how many files are contained in this compound file. The entry table
+ *       that follows has that many entries.
+ *   <li>Each directory entry contains a long pointer to the start of this file's data section, the
+ *       files length, and a String with that file's name.
+ * </ul>
+ */
+public final class Lucene50CompoundFormat extends CompoundFormat {
+
+  /** Extension of compound file */
+  static final String DATA_EXTENSION = "cfs";
+  /** Extension of compound file entries */
+  static final String ENTRIES_EXTENSION = "cfe";
+
+  static final String DATA_CODEC = "Lucene50CompoundData";
+  static final String ENTRY_CODEC = "Lucene50CompoundEntries";
+  static final int VERSION_START = 0;

Review comment:
       FWIW we have a tests that checks this structure: `TestAllFilesHaveCodecHeader`.




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] jpountz commented on a change in pull request #2268: LUCENE-9705: Move Lucene50CompoundFormat to Lucene90CompoundFormat

Posted by GitBox <gi...@apache.org>.
jpountz commented on a change in pull request #2268:
URL: https://github.com/apache/lucene-solr/pull/2268#discussion_r570105057



##########
File path: lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene50/TestLucene50CompoundFormat.java
##########
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.backward_codecs.lucene50;
+
+import org.apache.lucene.backward_codecs.Lucene87.Lucene87RWCodec;
+import org.apache.lucene.codecs.Codec;
+import org.apache.lucene.index.BaseCompoundFormatTestCase;
+
+public class TestLucene50CompoundFormat extends BaseCompoundFormatTestCase {
+  ;
+
+  @Override
+  protected Codec getCodec() {
+    return new Lucene87RWCodec();

Review comment:
       For simplicity I'd rather only test the most recent codec that uses the Lucene50 compound format like here.

##########
File path: lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene50/Lucene50CompoundFormat.java
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.backward_codecs.lucene50;
+
+import java.io.IOException;
+import org.apache.lucene.codecs.CodecUtil;
+import org.apache.lucene.codecs.CompoundDirectory;
+import org.apache.lucene.codecs.CompoundFormat;
+import org.apache.lucene.index.SegmentInfo;
+import org.apache.lucene.store.DataOutput;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IOContext;
+
+/**
+ * Lucene 5.0 compound file format
+ *
+ * <p>Files:
+ *
+ * <ul>
+ *   <li><code>.cfs</code>: An optional "virtual" file consisting of all the other index files for
+ *       systems that frequently run out of file handles.
+ *   <li><code>.cfe</code>: The "virtual" compound file's entry table holding all entries in the
+ *       corresponding .cfs file.
+ * </ul>
+ *
+ * <p>Description:
+ *
+ * <ul>
+ *   <li>Compound (.cfs) --&gt; Header, FileData <sup>FileCount</sup>, Footer
+ *   <li>Compound Entry Table (.cfe) --&gt; Header, FileCount, &lt;FileName, DataOffset,
+ *       DataLength&gt; <sup>FileCount</sup>
+ *   <li>Header --&gt; {@link CodecUtil#writeIndexHeader IndexHeader}
+ *   <li>FileCount --&gt; {@link DataOutput#writeVInt VInt}
+ *   <li>DataOffset,DataLength,Checksum --&gt; {@link DataOutput#writeLong UInt64}
+ *   <li>FileName --&gt; {@link DataOutput#writeString String}
+ *   <li>FileData --&gt; raw file data
+ *   <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter}
+ * </ul>
+ *
+ * <p>Notes:
+ *
+ * <ul>
+ *   <li>FileCount indicates how many files are contained in this compound file. The entry table
+ *       that follows has that many entries.
+ *   <li>Each directory entry contains a long pointer to the start of this file's data section, the
+ *       files length, and a String with that file's name.
+ * </ul>
+ */
+public final class Lucene50CompoundFormat extends CompoundFormat {
+
+  /** Extension of compound file */
+  static final String DATA_EXTENSION = "cfs";
+  /** Extension of compound file entries */
+  static final String ENTRIES_EXTENSION = "cfe";
+
+  static final String DATA_CODEC = "Lucene50CompoundData";
+  static final String ENTRY_CODEC = "Lucene50CompoundEntries";
+  static final int VERSION_START = 0;

Review comment:
       FWIW we have a tests that checks this structure: `TestAllFilesHaveCodecHeader`.




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] jpountz commented on a change in pull request #2268: LUCENE-9705: Move Lucene50CompoundFormat to Lucene90CompoundFormat

Posted by GitBox <gi...@apache.org>.
jpountz commented on a change in pull request #2268:
URL: https://github.com/apache/lucene-solr/pull/2268#discussion_r572048722



##########
File path: lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90CompoundFormat.java
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.codecs.lucene90;
+
+import java.io.IOException;
+import org.apache.lucene.codecs.CodecUtil;
+import org.apache.lucene.codecs.CompoundDirectory;
+import org.apache.lucene.codecs.CompoundFormat;
+import org.apache.lucene.index.IndexFileNames;
+import org.apache.lucene.index.SegmentInfo;
+import org.apache.lucene.store.ChecksumIndexInput;
+import org.apache.lucene.store.DataOutput;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IOContext;
+import org.apache.lucene.store.IndexOutput;
+
+/**
+ * Lucene 9.0 compound file format
+ *
+ * <p>Files:
+ *
+ * <ul>
+ *   <li><code>.cfs</code>: An optional "virtual" file consisting of all the other index files for
+ *       systems that frequently run out of file handles.
+ *   <li><code>.cfe</code>: The "virtual" compound file's entry table holding all entries in the
+ *       corresponding .cfs file.
+ * </ul>
+ *
+ * <p>Description:
+ *
+ * <ul>
+ *   <li>Compound (.cfs) --&gt; Header, FileData <sup>FileCount</sup>, Footer
+ *   <li>Compound Entry Table (.cfe) --&gt; Header, FileCount, &lt;FileName, DataOffset,
+ *       DataLength&gt; <sup>FileCount</sup>
+ *   <li>Header --&gt; {@link CodecUtil#writeIndexHeader IndexHeader}
+ *   <li>FileCount --&gt; {@link DataOutput#writeVInt VInt}
+ *   <li>DataOffset,DataLength,Checksum --&gt; {@link DataOutput#writeLong UInt64}
+ *   <li>FileName --&gt; {@link DataOutput#writeString String}
+ *   <li>FileData --&gt; raw file data
+ *   <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter}
+ * </ul>
+ *
+ * <p>Notes:
+ *
+ * <ul>
+ *   <li>FileCount indicates how many files are contained in this compound file. The entry table
+ *       that follows has that many entries.
+ *   <li>Each directory entry contains a long pointer to the start of this file's data section, the
+ *       files length, and a String with that file's name.
+ * </ul>
+ */
+public final class Lucene90CompoundFormat extends CompoundFormat {
+
+  /** Extension of compound file */
+  static final String DATA_EXTENSION = "cfs";
+  /** Extension of compound file entries */
+  static final String ENTRIES_EXTENSION = "cfe";
+

Review comment:
       We would like to avoid sharing file extensions across file formats, e.g. given that `.liv` is used by live docs today, it could be confusing to use it for stored fields in the future.
   
   However I don't feel the need to change extensions as we iterate on a given file format, even if we changed completely the way it works. This is something we did in Lucene 5.x for postings, moving from `.frq`/`.prox` to `.doc`/`.pos` but this is not a requirement at all, by the way we changed stored fields in Lucene 4.x and kept the same `.fdt` extension even though the new file format had very little in common with the previous one.
   
   I think we can keep the same file extensions here. It's easy enough to read the first bytes of a `cfs`/`cfe` file in case of doubt to check out the name in the codec header.




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] jtibshirani commented on a change in pull request #2268: LUCENE-9705: Move Lucene50CompoundFormat to Lucene90CompoundFormat

Posted by GitBox <gi...@apache.org>.
jtibshirani commented on a change in pull request #2268:
URL: https://github.com/apache/lucene-solr/pull/2268#discussion_r570461309



##########
File path: lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90CompoundFormat.java
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.codecs.lucene90;
+
+import java.io.IOException;
+import org.apache.lucene.codecs.CodecUtil;
+import org.apache.lucene.codecs.CompoundDirectory;
+import org.apache.lucene.codecs.CompoundFormat;
+import org.apache.lucene.index.IndexFileNames;
+import org.apache.lucene.index.SegmentInfo;
+import org.apache.lucene.store.ChecksumIndexInput;
+import org.apache.lucene.store.DataOutput;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IOContext;
+import org.apache.lucene.store.IndexOutput;
+
+/**
+ * Lucene 9.0 compound file format
+ *
+ * <p>Files:
+ *
+ * <ul>
+ *   <li><code>.cfs</code>: An optional "virtual" file consisting of all the other index files for
+ *       systems that frequently run out of file handles.
+ *   <li><code>.cfe</code>: The "virtual" compound file's entry table holding all entries in the
+ *       corresponding .cfs file.
+ * </ul>
+ *
+ * <p>Description:
+ *
+ * <ul>
+ *   <li>Compound (.cfs) --&gt; Header, FileData <sup>FileCount</sup>, Footer
+ *   <li>Compound Entry Table (.cfe) --&gt; Header, FileCount, &lt;FileName, DataOffset,
+ *       DataLength&gt; <sup>FileCount</sup>
+ *   <li>Header --&gt; {@link CodecUtil#writeIndexHeader IndexHeader}
+ *   <li>FileCount --&gt; {@link DataOutput#writeVInt VInt}
+ *   <li>DataOffset,DataLength,Checksum --&gt; {@link DataOutput#writeLong UInt64}
+ *   <li>FileName --&gt; {@link DataOutput#writeString String}
+ *   <li>FileData --&gt; raw file data
+ *   <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter}
+ * </ul>
+ *
+ * <p>Notes:
+ *
+ * <ul>
+ *   <li>FileCount indicates how many files are contained in this compound file. The entry table
+ *       that follows has that many entries.
+ *   <li>Each directory entry contains a long pointer to the start of this file's data section, the
+ *       files length, and a String with that file's name.
+ * </ul>
+ */
+public final class Lucene90CompoundFormat extends CompoundFormat {
+
+  /** Extension of compound file */
+  static final String DATA_EXTENSION = "cfs";
+  /** Extension of compound file entries */
+  static final String ENTRIES_EXTENSION = "cfe";
+

Review comment:
       What would be the motivation? Do you have an idea for improved names?




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] jtibshirani commented on a change in pull request #2268: LUCENE-9705: Move Lucene50CompoundFormat to Lucene90CompoundFormat

Posted by GitBox <gi...@apache.org>.
jtibshirani commented on a change in pull request #2268:
URL: https://github.com/apache/lucene-solr/pull/2268#discussion_r570454164



##########
File path: lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene50/Lucene50CompoundFormat.java
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.backward_codecs.lucene50;
+
+import java.io.IOException;
+import org.apache.lucene.codecs.CodecUtil;
+import org.apache.lucene.codecs.CompoundDirectory;
+import org.apache.lucene.codecs.CompoundFormat;
+import org.apache.lucene.index.SegmentInfo;
+import org.apache.lucene.store.DataOutput;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IOContext;
+
+/**
+ * Lucene 5.0 compound file format
+ *
+ * <p>Files:
+ *
+ * <ul>
+ *   <li><code>.cfs</code>: An optional "virtual" file consisting of all the other index files for
+ *       systems that frequently run out of file handles.
+ *   <li><code>.cfe</code>: The "virtual" compound file's entry table holding all entries in the
+ *       corresponding .cfs file.
+ * </ul>
+ *
+ * <p>Description:
+ *
+ * <ul>
+ *   <li>Compound (.cfs) --&gt; Header, FileData <sup>FileCount</sup>, Footer
+ *   <li>Compound Entry Table (.cfe) --&gt; Header, FileCount, &lt;FileName, DataOffset,
+ *       DataLength&gt; <sup>FileCount</sup>
+ *   <li>Header --&gt; {@link CodecUtil#writeIndexHeader IndexHeader}
+ *   <li>FileCount --&gt; {@link DataOutput#writeVInt VInt}
+ *   <li>DataOffset,DataLength,Checksum --&gt; {@link DataOutput#writeLong UInt64}
+ *   <li>FileName --&gt; {@link DataOutput#writeString String}
+ *   <li>FileData --&gt; raw file data
+ *   <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter}
+ * </ul>
+ *
+ * <p>Notes:
+ *
+ * <ul>
+ *   <li>FileCount indicates how many files are contained in this compound file. The entry table
+ *       that follows has that many entries.
+ *   <li>Each directory entry contains a long pointer to the start of this file's data section, the
+ *       files length, and a String with that file's name.
+ * </ul>
+ */
+public final class Lucene50CompoundFormat extends CompoundFormat {
+
+  /** Extension of compound file */
+  static final String DATA_EXTENSION = "cfs";
+  /** Extension of compound file entries */
+  static final String ENTRIES_EXTENSION = "cfe";
+
+  static final String DATA_CODEC = "Lucene50CompoundData";
+  static final String ENTRY_CODEC = "Lucene50CompoundEntries";
+  static final int VERSION_START = 0;

Review comment:
       Thanks, this helps clarify our current thinking. It's also nice that all file formats have the same header structure.




----------------------------------------------------------------
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:
users@infra.apache.org



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


[GitHub] [lucene-solr] jpountz commented on a change in pull request #2268: LUCENE-9705: Move Lucene50CompoundFormat to Lucene90CompoundFormat

Posted by GitBox <gi...@apache.org>.
jpountz commented on a change in pull request #2268:
URL: https://github.com/apache/lucene-solr/pull/2268#discussion_r568617447



##########
File path: lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene50/Lucene50CompoundFormat.java
##########
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.lucene.backward_codecs.lucene50;
+
+import java.io.IOException;
+import org.apache.lucene.codecs.CodecUtil;
+import org.apache.lucene.codecs.CompoundDirectory;
+import org.apache.lucene.codecs.CompoundFormat;
+import org.apache.lucene.index.SegmentInfo;
+import org.apache.lucene.store.DataOutput;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IOContext;
+
+/**
+ * Lucene 5.0 compound file format
+ *
+ * <p>Files:
+ *
+ * <ul>
+ *   <li><code>.cfs</code>: An optional "virtual" file consisting of all the other index files for
+ *       systems that frequently run out of file handles.
+ *   <li><code>.cfe</code>: The "virtual" compound file's entry table holding all entries in the
+ *       corresponding .cfs file.
+ * </ul>
+ *
+ * <p>Description:
+ *
+ * <ul>
+ *   <li>Compound (.cfs) --&gt; Header, FileData <sup>FileCount</sup>, Footer
+ *   <li>Compound Entry Table (.cfe) --&gt; Header, FileCount, &lt;FileName, DataOffset,
+ *       DataLength&gt; <sup>FileCount</sup>
+ *   <li>Header --&gt; {@link CodecUtil#writeIndexHeader IndexHeader}
+ *   <li>FileCount --&gt; {@link DataOutput#writeVInt VInt}
+ *   <li>DataOffset,DataLength,Checksum --&gt; {@link DataOutput#writeLong UInt64}
+ *   <li>FileName --&gt; {@link DataOutput#writeString String}
+ *   <li>FileData --&gt; raw file data
+ *   <li>Footer --&gt; {@link CodecUtil#writeFooter CodecFooter}
+ * </ul>
+ *
+ * <p>Notes:
+ *
+ * <ul>
+ *   <li>FileCount indicates how many files are contained in this compound file. The entry table
+ *       that follows has that many entries.
+ *   <li>Each directory entry contains a long pointer to the start of this file's data section, the
+ *       files length, and a String with that file's name.
+ * </ul>
+ */
+public final class Lucene50CompoundFormat extends CompoundFormat {
+
+  /** Extension of compound file */
+  static final String DATA_EXTENSION = "cfs";
+  /** Extension of compound file entries */
+  static final String ENTRIES_EXTENSION = "cfe";
+
+  static final String DATA_CODEC = "Lucene50CompoundData";
+  static final String ENTRY_CODEC = "Lucene50CompoundEntries";
+  static final int VERSION_START = 0;

Review comment:
       I'd like to keep it for now, even if the version is always 0. My gut feeling is that we should fork file formats more aggressively than we do today but I still don't have full confidence that we will never use the internal versioning again.




----------------------------------------------------------------
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:
users@infra.apache.org



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