Skip to content

Commit 04ca505

Browse files
Fix LogsDB plugin initialisation of cluster.logsdb.enabled (#116825)
1 parent bcd690f commit 04ca505

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

modules/data-streams/src/javaRestTest/java/org/elasticsearch/datastreams/AbstractDataStreamIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public abstract class AbstractDataStreamIT extends ESRestTestCase {
4545
// tests such as testIgnoreDynamicBeyondLimit.
4646
.setting("xpack.apm_data.enabled", "false")
4747
.setting("xpack.otel_data.registry.enabled", "false")
48+
.setting("cluster.logsdb.enabled", "false")
4849
.build();
4950
protected RestClient client;
5051

x-pack/plugin/logsdb/src/main/java/org/elasticsearch/xpack/logsdb/LogsDBPlugin.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ public LogsDBPlugin(Settings settings) {
4848
public Collection<?> createComponents(PluginServices services) {
4949
licenseService.setLicenseState(XPackPlugin.getSharedLicenseState());
5050
var clusterSettings = services.clusterService().getClusterSettings();
51+
// The `cluster.logsdb.enabled` setting is registered by this plugin, but its value may be updated by other plugins
52+
// before this plugin registers its settings update consumer below. This means we might miss updates that occurred earlier.
53+
// To handle this, we explicitly fetch the current `cluster.logsdb.enabled` setting value from the cluster settings
54+
// and update it, ensuring we capture any prior changes.
55+
logsdbIndexModeSettingsProvider.updateClusterIndexModeLogsdbEnabled(clusterSettings.get(CLUSTER_LOGSDB_ENABLED));
5156
clusterSettings.addSettingsUpdateConsumer(FALLBACK_SETTING, licenseService::setSyntheticSourceFallback);
5257
clusterSettings.addSettingsUpdateConsumer(
5358
CLUSTER_LOGSDB_ENABLED,

0 commit comments

Comments
 (0)