Skip to content

Commit 8de4075

Browse files
authored
Merge branch 'main' into remove-updatev9-reindex-request
2 parents 49842b8 + 24afbe3 commit 8de4075

File tree

6 files changed

+27
-14
lines changed

6 files changed

+27
-14
lines changed

libs/entitlement/src/main/java/org/elasticsearch/entitlement/bootstrap/EntitlementBootstrap.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ public record BootstrapArgs(
3838
Function<Class<?>, String> pluginResolver,
3939
Path[] dataDirs,
4040
Path configDir,
41-
Path tempDir
41+
Path tempDir,
42+
Path logsDir
4243
) {
4344
public BootstrapArgs {
4445
requireNonNull(pluginPolicies);
@@ -64,22 +65,24 @@ public static BootstrapArgs bootstrapArgs() {
6465
*
6566
* @param pluginPolicies a map holding policies for plugins (and modules), by plugin (or module) name.
6667
* @param pluginResolver a functor to map a Java Class to the plugin it belongs to (the plugin name).
67-
* @param dataDirs data directories for Elasticsearch
68-
* @param configDir the config directory for Elasticsearch
69-
* @param tempDir the temp directory for Elasticsearch
68+
* @param dataDirs data directories for Elasticsearch
69+
* @param configDir the config directory for Elasticsearch
70+
* @param tempDir the temp directory for Elasticsearch
71+
* @param logsDir the log directory for Elasticsearch
7072
*/
7173
public static void bootstrap(
7274
Map<String, Policy> pluginPolicies,
7375
Function<Class<?>, String> pluginResolver,
7476
Path[] dataDirs,
7577
Path configDir,
76-
Path tempDir
78+
Path tempDir,
79+
Path logsDir
7780
) {
7881
logger.debug("Loading entitlement agent");
7982
if (EntitlementBootstrap.bootstrapArgs != null) {
8083
throw new IllegalStateException("plugin data is already set");
8184
}
82-
EntitlementBootstrap.bootstrapArgs = new BootstrapArgs(pluginPolicies, pluginResolver, dataDirs, configDir, tempDir);
85+
EntitlementBootstrap.bootstrapArgs = new BootstrapArgs(pluginPolicies, pluginResolver, dataDirs, configDir, tempDir, logsDir);
8386
exportInitializationToAgent();
8487
loadAgent(findAgentJar());
8588
selfTest();

libs/entitlement/src/main/java/org/elasticsearch/entitlement/initialization/EntitlementInitialization.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ private static PolicyManager createPolicyManager() {
129129
EntitlementBootstrap.BootstrapArgs bootstrapArgs = EntitlementBootstrap.bootstrapArgs();
130130
Map<String, Policy> pluginPolicies = bootstrapArgs.pluginPolicies();
131131
var pathLookup = new PathLookup(bootstrapArgs.configDir(), bootstrapArgs.dataDirs(), bootstrapArgs.tempDir());
132+
Path logsDir = EntitlementBootstrap.bootstrapArgs().logsDir();
132133

133134
// TODO(ES-10031): Decide what goes in the elasticsearch default policy and extend it
134135
var serverPolicy = new Policy(
@@ -147,7 +148,10 @@ private static PolicyManager createPolicyManager() {
147148
new LoadNativeLibrariesEntitlement(),
148149
new ManageThreadsEntitlement(),
149150
new FilesEntitlement(
150-
List.of(FilesEntitlement.FileData.ofPath(EntitlementBootstrap.bootstrapArgs().tempDir(), READ_WRITE))
151+
List.of(
152+
FilesEntitlement.FileData.ofPath(EntitlementBootstrap.bootstrapArgs().tempDir(), READ_WRITE),
153+
FilesEntitlement.FileData.ofPath(EntitlementBootstrap.bootstrapArgs().logsDir(), READ_WRITE)
154+
)
151155
)
152156
)
153157
),

modules/transport-netty4/src/test/java/org/elasticsearch/transport/netty4/Netty4WriteThrottlingHandlerTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public void testThrottleLargeCompositeMessage() {
109109
Netty4WriteThrottlingHandler.MAX_BYTES_PER_WRITE * fullSizeChunks + extraChunkSize
110110
);
111111
int splitOffset = randomIntBetween(0, messageBytes.length);
112+
int lastChunkSizeOfTheFirstSplit = splitOffset % Netty4WriteThrottlingHandler.MAX_BYTES_PER_WRITE;
112113
final BytesReference message = CompositeBytesReference.of(
113114
new BytesArray(messageBytes, 0, splitOffset),
114115
new BytesArray(messageBytes, splitOffset, messageBytes.length - splitOffset)
@@ -120,7 +121,9 @@ public void testThrottleLargeCompositeMessage() {
120121
assertFalse(promise.isDone());
121122
embeddedChannel.flush();
122123
assertTrue(promise.isDone());
123-
assertThat(seen, hasSize(oneOf(fullSizeChunks, fullSizeChunks + 1)));
124+
// If the extra chunk size is greater than the last chunk size for the first half of the split, it means we will need to send
125+
// (extraChunkSize - lastChunkSizeOfTheFirstSplit) bytes as the very last chunk of the entire message.
126+
assertThat(seen, hasSize(oneOf(fullSizeChunks, fullSizeChunks + 1 + (extraChunkSize > lastChunkSizeOfTheFirstSplit ? 1 : 0))));
124127
assertTrue(capturingHandler.didWriteAfterThrottled);
125128
assertBufferEquals(Unpooled.compositeBuffer().addComponents(true, seen), message);
126129
}

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,12 @@ static TransportVersion def(int id) {
174174
public static final TransportVersion TIMEOUT_GET_PARAM_FOR_RESOLVE_CLUSTER = def(8_838_0_00);
175175
public static final TransportVersion INFERENCE_REQUEST_ADAPTIVE_RATE_LIMITING = def(8_839_0_00);
176176
public static final TransportVersion ML_INFERENCE_IBM_WATSONX_RERANK_ADDED = def(8_840_0_00);
177-
public static final TransportVersion COHERE_BIT_EMBEDDING_TYPE_SUPPORT_ADDED_BACKPORT_8_X = def(8_840_0_01);
178-
public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR_BACKPORT_8_X = def(8_840_0_02);
179-
public static final TransportVersion ESQL_RETRY_ON_SHARD_LEVEL_FAILURE_BACKPORT_8_19 = def(8_840_0_03);
180-
public static final TransportVersion ESQL_SUPPORT_PARTIAL_RESULTS_BACKPORT_8_19 = def(8_840_0_04);
181-
public static final TransportVersion ELASTICSEARCH_9_0 = def(9_000_0_00);
177+
public static final TransportVersion INITIAL_ELASTICSEARCH_8_19 = def(8_841_0_00);
178+
public static final TransportVersion COHERE_BIT_EMBEDDING_TYPE_SUPPORT_ADDED_BACKPORT_8_X = def(8_841_0_01);
179+
public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR_BACKPORT_8_X = def(8_841_0_02);
180+
public static final TransportVersion ESQL_RETRY_ON_SHARD_LEVEL_FAILURE_BACKPORT_8_19 = def(8_841_0_03);
181+
public static final TransportVersion ESQL_SUPPORT_PARTIAL_RESULTS_BACKPORT_8_19 = def(8_841_0_04);
182+
public static final TransportVersion INITIAL_ELASTICSEARCH_9_0 = def(9_000_0_00);
182183
public static final TransportVersion REMOVE_SNAPSHOT_FAILURES_90 = def(9_000_0_01);
183184
public static final TransportVersion TRANSPORT_STATS_HANDLING_TIME_REQUIRED_90 = def(9_000_0_02);
184185
public static final TransportVersion REMOVE_DESIRED_NODE_VERSION_90 = def(9_000_0_03);

server/src/main/java/org/elasticsearch/bootstrap/Elasticsearch.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ private static void initPhase2(Bootstrap bootstrap) throws IOException {
247247
pluginsResolver::resolveClassToPluginName,
248248
nodeEnv.dataDirs(),
249249
nodeEnv.configDir(),
250-
nodeEnv.tmpDir()
250+
nodeEnv.tmpDir(),
251+
nodeEnv.logsDir()
251252
);
252253
} else {
253254
assert RuntimeVersionFeature.isSecurityManagerAvailable();

test/framework/src/main/java/org/elasticsearch/repositories/blobstore/AbstractBlobContainerRetriesTestCase.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ public void testReadBlobWithPrematureConnectionClose() {
354354
containsString("premature end of chunk coded message body: closing chunk expected"),
355355
containsString("premature end of content-length delimited message body"),
356356
containsString("connection closed prematurely"),
357+
containsString("premature eof"),
357358
// if we didn't call exchange.getResponseBody().flush() then we might not even have sent the response headers:
358359
alwaysFlushBody ? never() : containsString("the target server failed to respond")
359360
)

0 commit comments

Comments
 (0)