You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ja...@apache.org on 2024/12/02 09:31:05 UTC
(lucene) branch branch_9_12 updated: Make SegmentInfos#readCommit(Directory, String, int) public (#14027)
This is an automated email from the ASF dual-hosted git repository.
javanna pushed a commit to branch branch_9_12
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/branch_9_12 by this push:
new c443cc9e1c3 Make SegmentInfos#readCommit(Directory, String, int) public (#14027)
c443cc9e1c3 is described below
commit c443cc9e1c398e151134584a59a4937ec3759016
Author: Luca Cavanna <ja...@apache.org>
AuthorDate: Mon Dec 2 10:24:56 2024 +0100
Make SegmentInfos#readCommit(Directory, String, int) public (#14027)
The corresponding readLatestCommit method is public and can be used to
read segment infos from indices that are older than N - 1.
The same should be possible for readCommit, but that requires the method
that takes the minimum supported version as an argument to be public.
---
lucene/CHANGES.txt | 2 ++
.../core/src/java/org/apache/lucene/index/SegmentInfos.java | 11 +++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index fbe6d40bc8a..0f75cce7374 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -31,6 +31,8 @@ Bug Fixes
* GITHUB#14008: Counts provided by taxonomy facets in addition to another aggregation are now returned together with
their corresponding ordinals. (Paul King)
+* GITHUB#14027: Make SegmentInfos#readCommit(Directory, String, int) public (Luca Cavanna)
+
API Changes
---------------------
diff --git a/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java b/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
index b6db5bcdf9c..ea90cee4b91 100644
--- a/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
+++ b/lucene/core/src/java/org/apache/lucene/index/SegmentInfos.java
@@ -293,7 +293,14 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentCommitInfo
return readCommit(directory, segmentFileName, Version.MIN_SUPPORTED_MAJOR);
}
- static final SegmentInfos readCommit(
+ /**
+ * Read a particular segmentFileName, as long as the commit's {@link
+ * SegmentInfos#getIndexCreatedVersionMajor()} is strictly greater than the provided minimum
+ * supported major version. If the commit's version is older, an {@link
+ * IndexFormatTooOldException} will be thrown. Note that this may throw an IOException if a commit
+ * is in process.
+ */
+ public static final SegmentInfos readCommit(
Directory directory, String segmentFileName, int minSupportedMajorVersion)
throws IOException {
@@ -317,7 +324,7 @@ public final class SegmentInfos implements Cloneable, Iterable<SegmentCommitInfo
}
/** Read the commit from the provided {@link ChecksumIndexInput}. */
- static final SegmentInfos readCommit(
+ public static final SegmentInfos readCommit(
Directory directory, ChecksumIndexInput input, long generation, int minSupportedMajorVersion)
throws IOException {
Throwable priorE = null;