Re: Format metadata versioning vs. new named Formats

2024-04-12 Thread Adrien Grand
These are indeed two ways to change the on-disk layout of our file formats.

In general, I try to follow the following rules:
 - If the format is not bw-compatible (e.g. formats in lucene/codecs), do
the change in-place and bump both VERSION_START and VERSION_CURRENT to make
sure users get a proper error when opening old indexes with a new Lucene
version.
 - If the format is bw compatible:
   - If the change is substantial: create a new format.
   - For smaller changes, incrementing VERSION_CURRENT is an option, but we
should make sure we retain test coverage for the previous version.
See Lucene90RWPostingsFormat for an example of this, it passes an old
version to Lucene90BlockTreeTermsWriter. And we also
have TestLucene90PostingsFormat that tests this format.

On Fri, Apr 12, 2024 at 2:00 PM Benjamin Trent 
wrote:

> Hey y'all,
>
> I am confused about when we should supply a new format name (e.g.
> Lucene911... vs. Lucene99) versus using a new metadata header version
> (incrementing VERSION_CURRENT).
>
> Are there general rules to follow?
>
> At first glance, using a new Lucene format name prefix is functionally the
> same as adjusting the metadata header version. Older versions won't be able
> to read it. Newer versions will be able to read it and will be able to read
> older formats (both named and via metadata versioning).
>
> Thanks!
>
> Ben
>
>
>

-- 
Adrien


Format metadata versioning vs. new named Formats

2024-04-12 Thread Benjamin Trent
Hey y'all,

I am confused about when we should supply a new format name (e.g.
Lucene911... vs. Lucene99) versus using a new metadata header version
(incrementing VERSION_CURRENT).

Are there general rules to follow?

At first glance, using a new Lucene format name prefix is functionally the
same as adjusting the metadata header version. Older versions won't be able
to read it. Newer versions will be able to read it and will be able to read
older formats (both named and via metadata versioning).

Thanks!

Ben