Skip to content

Commit 20fffb9

Browse files
committed
Merge remote-tracking branch 'upstream/main' into pipeline
2 parents bf9b67a + 3125b94 commit 20fffb9

File tree

54 files changed

+221
-120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+221
-120
lines changed

buildSrc/version.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
opensearch = 3.0.0
2-
lucene = 9.10.0
2+
lucene = 9.11.0-snapshot-8a555eb
33

44
bundled_jdk_vendor = adoptium
55
bundled_jdk = 21.0.2+13

libs/core/licenses/lucene-core-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fe1cf5663be8bdb6aa757fd4101bc551684c90fb

libs/core/src/main/java/org/opensearch/Version.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public class Version implements Comparable<Version>, ToXContentFragment {
101101
public static final Version V_2_12_0 = new Version(2120099, org.apache.lucene.util.Version.LUCENE_9_9_2);
102102
public static final Version V_2_12_1 = new Version(2120199, org.apache.lucene.util.Version.LUCENE_9_9_2);
103103
public static final Version V_2_13_0 = new Version(2130099, org.apache.lucene.util.Version.LUCENE_9_10_0);
104-
public static final Version V_3_0_0 = new Version(3000099, org.apache.lucene.util.Version.LUCENE_9_10_0);
104+
public static final Version V_3_0_0 = new Version(3000099, org.apache.lucene.util.Version.LUCENE_9_11_0);
105105
public static final Version CURRENT = V_3_0_0;
106106

107107
public static Version fromId(int id) {

modules/lang-expression/licenses/lucene-expressions-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
00759eaff8f62b38ba66a05f26ab784c268908d3

plugins/analysis-icu/licenses/lucene-analysis-icu-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
44a4e095d7e047a9452d81b224905b72c830f8ae

plugins/analysis-kuromoji/licenses/lucene-analysis-kuromoji-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7f57fe7322e6d3a9b4edcc3da0b1ee0791a814ec

plugins/analysis-nori/licenses/lucene-analysis-nori-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9929da235100f8df323cfed165b8111fb2840093

plugins/analysis-phonetic/licenses/lucene-analysis-phonetic-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8564c86d880c6ce002250002e2fd0936cbfff61d

plugins/analysis-smartcn/licenses/lucene-analysis-smartcn-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7e71777cfb5beb4ffd5b03030576d2f062eef13c

plugins/analysis-stempel/licenses/lucene-analysis-stempel-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a597265bd6fb0a7e954e948a295d31507dd73cce

plugins/analysis-ukrainian/licenses/lucene-analysis-morfologik-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
c9e534845bb08985d7fa21e2e71a14bc68c46089

server/licenses/lucene-analysis-common-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6f0cfa07a5e4b36423e398cd1fd51c6825773d9c

server/licenses/lucene-backward-codecs-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ab201b997c8449db1ecd2fa88bd42d2f457286fa

server/licenses/lucene-core-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fe1cf5663be8bdb6aa757fd4101bc551684c90fb

server/licenses/lucene-grouping-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a988f92842e48195c75a49377432533c9170d93d

server/licenses/lucene-highlighter-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7c669e2c01565d3bdf175cd61a1e4d0bdfc44311

server/licenses/lucene-join-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
633a6d44b4cde8e149daa3407e8b8f644eece951

server/licenses/lucene-memory-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
25390259c9e5592354efbc2f250bb396402016b2

server/licenses/lucene-misc-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
056f87a3d30c223b08d2f45fe465ddf11210b85f

server/licenses/lucene-queries-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
e640f850b4fb13190be8422fe74c14c9d6603bb5

server/licenses/lucene-queryparser-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8eb57762bf408fa51d7511f5e3b917627be61d1d

server/licenses/lucene-sandbox-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
615b4a90c5402084c2d5916a4c1fadc9d9177782

server/licenses/lucene-spatial-extras-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
19b42cdb5f76f63dece3ef5128207ebdd3741d48

server/licenses/lucene-spatial3d-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
882691fe917e716fe6bcf8c0dd984b153495d015

server/licenses/lucene-suggest-9.10.0.jar.sha1

-1
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ef6d483960f776d5dbdd1009863786ee09ba5707

server/src/internalClusterTest/java/org/opensearch/snapshots/SearchableSnapshotIT.java

+31-5
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ protected Settings.Builder randomRepositorySettings() {
8585
return settings;
8686
}
8787

88-
private Settings.Builder chunkedRepositorySettings() {
88+
private Settings.Builder chunkedRepositorySettings(long chunkSize) {
8989
final Settings.Builder settings = Settings.builder();
9090
settings.put("location", randomRepoPath()).put("compress", randomBoolean());
91-
settings.put("chunk_size", 2 << 23, ByteSizeUnit.BYTES);
91+
settings.put("chunk_size", chunkSize, ByteSizeUnit.BYTES);
9292
return settings;
9393
}
9494

@@ -194,18 +194,44 @@ public void testSnapshottingSearchableSnapshots() throws Exception {
194194
}
195195

196196
/**
197-
* Tests a chunked repository scenario for searchable snapshots by creating an index,
197+
* Tests a default 8mib chunked repository scenario for searchable snapshots by creating an index,
198198
* taking a snapshot, restoring it as a searchable snapshot index.
199199
*/
200-
public void testCreateSearchableSnapshotWithChunks() throws Exception {
200+
public void testCreateSearchableSnapshotWithDefaultChunks() throws Exception {
201201
final int numReplicasIndex = randomIntBetween(1, 4);
202202
final String indexName = "test-idx";
203203
final String restoredIndexName = indexName + "-copy";
204204
final String repoName = "test-repo";
205205
final String snapshotName = "test-snap";
206206
final Client client = client();
207207

208-
Settings.Builder repositorySettings = chunkedRepositorySettings();
208+
Settings.Builder repositorySettings = chunkedRepositorySettings(2 << 23);
209+
210+
internalCluster().ensureAtLeastNumSearchAndDataNodes(numReplicasIndex + 1);
211+
createIndexWithDocsAndEnsureGreen(numReplicasIndex, 1000, indexName);
212+
createRepositoryWithSettings(repositorySettings, repoName);
213+
takeSnapshot(client, snapshotName, repoName, indexName);
214+
215+
deleteIndicesAndEnsureGreen(client, indexName);
216+
restoreSnapshotAndEnsureGreen(client, snapshotName, repoName);
217+
assertRemoteSnapshotIndexSettings(client, restoredIndexName);
218+
219+
assertDocCount(restoredIndexName, 1000L);
220+
}
221+
222+
/**
223+
* Tests a small 1000 bytes chunked repository scenario for searchable snapshots by creating an index,
224+
* taking a snapshot, restoring it as a searchable snapshot index.
225+
*/
226+
public void testCreateSearchableSnapshotWithSmallChunks() throws Exception {
227+
final int numReplicasIndex = randomIntBetween(1, 4);
228+
final String indexName = "test-idx";
229+
final String restoredIndexName = indexName + "-copy";
230+
final String repoName = "test-repo";
231+
final String snapshotName = "test-snap";
232+
final Client client = client();
233+
234+
Settings.Builder repositorySettings = chunkedRepositorySettings(1000);
209235

210236
internalCluster().ensureAtLeastNumSearchAndDataNodes(numReplicasIndex + 1);
211237
createIndexWithDocsAndEnsureGreen(numReplicasIndex, 1000, indexName);

server/src/main/java/org/opensearch/index/store/remote/file/OnDemandBlockSnapshotIndexInput.java

+34-12
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import org.opensearch.index.store.remote.utils.TransferManager;
1616

1717
import java.io.IOException;
18+
import java.util.ArrayList;
19+
import java.util.List;
1820

1921
/**
2022
* This is an implementation of {@link OnDemandBlockIndexInput} where this class provides the main IndexInput using shard snapshot files.
@@ -136,25 +138,45 @@ protected IndexInput fetchBlock(int blockId) throws IOException {
136138
final long blockStart = getBlockStart(blockId);
137139
final long blockEnd = blockStart + getActualBlockSize(blockId);
138140

139-
// If the snapshot file is chunked, we must account for this by
140-
// choosing the appropriate file part and updating the position
141-
// accordingly.
142-
final int part = (int) (blockStart / partSize);
143-
final long partStart = part * partSize;
144-
145-
final long position = blockStart - partStart;
146-
final long length = blockEnd - blockStart;
147-
141+
// Block may be present on multiple chunks of a file, so we need
142+
// to fetch each chunk/blob part separately to fetch an entire block.
148143
BlobFetchRequest blobFetchRequest = BlobFetchRequest.builder()
149-
.position(position)
150-
.length(length)
151-
.blobName(fileInfo.partName(part))
144+
.blobParts(getBlobParts(blockStart, blockEnd))
152145
.directory(directory)
153146
.fileName(blockFileName)
154147
.build();
155148
return transferManager.fetchBlob(blobFetchRequest);
156149
}
157150

151+
/**
152+
* Returns list of blob parts/chunks in a file for a given block.
153+
*/
154+
protected List<BlobFetchRequest.BlobPart> getBlobParts(long blockStart, long blockEnd) {
155+
// If the snapshot file is chunked, we must account for this by
156+
// choosing the appropriate file part and updating the position
157+
// accordingly.
158+
int partNum = (int) (blockStart / partSize);
159+
long pos = blockStart;
160+
long diff = (blockEnd - blockStart);
161+
162+
List<BlobFetchRequest.BlobPart> blobParts = new ArrayList<>();
163+
while (diff > 0) {
164+
long partStart = pos % partSize;
165+
long partEnd;
166+
if ((partStart + diff) > partSize) {
167+
partEnd = partSize;
168+
} else {
169+
partEnd = (partStart + diff);
170+
}
171+
long fetchBytes = partEnd - partStart;
172+
blobParts.add(new BlobFetchRequest.BlobPart(fileInfo.partName(partNum), partStart, fetchBytes));
173+
partNum++;
174+
pos = pos + fetchBytes;
175+
diff = (blockEnd - pos);
176+
}
177+
return blobParts;
178+
}
179+
158180
@Override
159181
public OnDemandBlockSnapshotIndexInput clone() {
160182
OnDemandBlockSnapshotIndexInput clone = buildSlice("clone", 0L, this.length);

0 commit comments

Comments
 (0)