-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Allow a tsdb data stream to rolled over to a logsdb data stream #126640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2a93c8a
Allow a tsdb data stream to rolled over to a logsdb data stream
martijnvg be6801e
Merge remote-tracking branch 'es/main' into ds_rollover_tsdb_to_logsdb
martijnvg 1ade709
Merge remote-tracking branch 'es/main' into ds_rollover_tsdb_to_logsdb
martijnvg 078968b
added warning logging
martijnvg 18f4503
Merge remote-tracking branch 'es/main' into ds_rollover_tsdb_to_logsdb
martijnvg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ | |
*/ | ||
package org.elasticsearch.cluster.metadata; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.apache.lucene.document.LongPoint; | ||
import org.apache.lucene.index.DocValuesSkipIndexType; | ||
import org.apache.lucene.index.DocValuesSkipper; | ||
|
@@ -71,6 +73,8 @@ | |
|
||
public final class DataStream implements SimpleDiffable<DataStream>, ToXContentObject, IndexAbstraction { | ||
|
||
private static final Logger LOGGER = LogManager.getLogger(DataStream.class); | ||
|
||
public static final boolean FAILURE_STORE_FEATURE_FLAG = new FeatureFlag("failure_store").isEnabled(); | ||
public static final TransportVersion ADDED_FAILURE_STORE_TRANSPORT_VERSION = TransportVersions.V_8_12_0; | ||
public static final TransportVersion ADDED_AUTO_SHARDING_EVENT_VERSION = TransportVersions.V_8_14_0; | ||
|
@@ -610,6 +614,12 @@ public DataStream unsafeRollover( | |
} else if (dsIndexMode == IndexMode.LOGSDB && (indexModeFromTemplate == null || indexModeFromTemplate == IndexMode.STANDARD)) { | ||
// Allow downgrading a time series data stream to a regular data stream | ||
dsIndexMode = null; | ||
} else if (dsIndexMode == IndexMode.TIME_SERIES && indexModeFromTemplate == IndexMode.LOGSDB) { | ||
dsIndexMode = IndexMode.LOGSDB; | ||
LOGGER.warn("Changing [{}] index mode from [{}] to [{}]", name, indexModeFromTemplate, dsIndexMode); | ||
} else if (dsIndexMode == IndexMode.LOGSDB && indexModeFromTemplate == IndexMode.TIME_SERIES) { | ||
dsIndexMode = IndexMode.TIME_SERIES; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we be adding a warning too? Just in case this is done by mistake.. |
||
LOGGER.warn("Changing [{}] index mode from [{}] to [{}]", name, indexModeFromTemplate, dsIndexMode); | ||
} | ||
|
||
List<Index> backingIndices = new ArrayList<>(this.backingIndices.indices); | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is
dsIndexMode
the index mode of the write index?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It indicates whether a data stream is a tsdb data stream or a logsdb data stream. It isn't always the index mode of the most recent backing index, because the standard and lookup mode are never set as index mode of a data stream (there is no such thing as a lookup data stream). There is logic that checks the index mode (all checks are for time series iirc) of the data stream without having the to lookup the most recent
IndexMetadata
.But if a data stream's index mode is logsdb or time series, then the most recent backing index's index mode should also be time series of logsdb.