-
Notifications
You must be signed in to change notification settings - Fork 3.9k
branch-4.1: [fix](fe) block inverted index V1 creation in FE #64522 #67342
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
base: branch-4.1
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
|
|
||
| package org.apache.doris.common; | ||
|
|
||
| import java.lang.reflect.Field; | ||
|
|
||
| public final class InvertedIndexStorageFormatValidator { | ||
| private InvertedIndexStorageFormatValidator() { | ||
| } | ||
|
|
||
| public static void rejectRuntimeV1(String confVal) throws ConfigException { | ||
| String normalizedConfVal = confVal.trim(); | ||
| if ("V1".equalsIgnoreCase(normalizedConfVal)) { | ||
| throw new ConfigException("Inverted index V1 is deprecated and no longer allowed" | ||
| + " for new index creation. Please use inverted index V2."); | ||
| } | ||
| } | ||
|
|
||
| public static void rejectStartupV1(String confVal) throws ConfigException { | ||
| String normalizedConfVal = confVal.trim(); | ||
| if ("V1".equalsIgnoreCase(normalizedConfVal)) { | ||
| throw new ConfigException( | ||
| "inverted_index_storage_format=V1 is no longer supported. " | ||
| + "Please update fe.conf (or fe_custom.conf): set inverted_index_storage_format=V2."); | ||
| } | ||
| } | ||
|
|
||
| public static class RuntimeConfigHandler extends ConfigBase.DefaultConfHandler { | ||
| @Override | ||
| public void handle(Field field, String confVal) throws Exception { | ||
| rejectRuntimeV1(confVal); | ||
| super.handle(field, confVal.trim()); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2816,6 +2816,13 @@ private boolean processAddIndex(CreateIndexClause alterClause, OlapTable olapTab | |
| AnnIndexPropertiesChecker.checkProperties(indexDef.getProperties()); | ||
| } | ||
|
|
||
| if (indexDef.getIndexType() == IndexType.INVERTED | ||
| && olapTable.getInvertedIndexFileStorageFormat() == TInvertedIndexFileStorageFormat.V1) { | ||
|
Contributor
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. [P1] Treat the legacy DEFAULT sentinel as V1 Tables created before this property existed deserialize its missing FE value as
Member
Author
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. Thanks — I checked this against master and the same code is there: So the legacy |
||
| throw new DdlException("Inverted index V1 is deprecated and no longer allowed for new index creation." | ||
| + " Upgrading inverted_index_storage_format via ALTER TABLE is not supported;" | ||
| + " recreate the table with inverted_index_storage_format = V2."); | ||
| } | ||
|
|
||
| for (String col : indexDef.getColumns()) { | ||
| Column column = olapTable.getColumn(col); | ||
| if (column != null) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1283,25 +1283,23 @@ public static TInvertedIndexFileStorageFormat analyzeInvertedIndexFileStorageFor | |
| invertedIndexFileStorageFormat = properties.get(PROPERTIES_INVERTED_INDEX_STORAGE_FORMAT); | ||
| properties.remove(PROPERTIES_INVERTED_INDEX_STORAGE_FORMAT); | ||
| } else { | ||
| if (Config.inverted_index_storage_format.equalsIgnoreCase("V1")) { | ||
| return TInvertedIndexFileStorageFormat.V1; | ||
| } else if (Config.inverted_index_storage_format.equalsIgnoreCase("V2")) { | ||
| if (Config.inverted_index_storage_format.equalsIgnoreCase("V2")) { | ||
| return TInvertedIndexFileStorageFormat.V2; | ||
| } else { | ||
| return TInvertedIndexFileStorageFormat.V3; | ||
| } | ||
| } | ||
|
|
||
| if (invertedIndexFileStorageFormat.equalsIgnoreCase("v1")) { | ||
| return TInvertedIndexFileStorageFormat.V1; | ||
| throw new AnalysisException( | ||
|
airborne12 marked this conversation as resolved.
Contributor
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. [P1] Preserve synchronized replay of existing V1 tables
Member
Author
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. Verified against master and this is upstream-identical, not backport-specific: master PropertyAnalyzer has the exact same unconditional throw for v1 (lines 1240-1243 there vs 1293-1296 here, byte-identical text), and this PR ports that hunk verbatim. So CCR/binlog replay of an existing explicit-V1 table hits the same rejection on master today. I am keeping the backport faithful rather than adding a 4.1-only sync/is_being_synced compatibility path, which would make the branches diverge on a user-visible behaviour. That said, this is the most impactful of the findings for 4.1 users, since CCR replay of pre-existing V1 tables is a real upgrade scenario. Flagging it for the maintainers as a follow-up that should land on master first and then be picked here in the same shape. Leaving this thread open for that reason. |
||
| "Inverted index V1 is deprecated and no longer allowed for new index creation." | ||
| + " Please use inverted index V2."); | ||
| } else if (invertedIndexFileStorageFormat.equalsIgnoreCase("v2")) { | ||
| return TInvertedIndexFileStorageFormat.V2; | ||
| } else if (invertedIndexFileStorageFormat.equalsIgnoreCase("v3")) { | ||
| return TInvertedIndexFileStorageFormat.V3; | ||
| } else if (invertedIndexFileStorageFormat.equalsIgnoreCase("default")) { | ||
| if (Config.inverted_index_storage_format.equalsIgnoreCase("V1")) { | ||
| return TInvertedIndexFileStorageFormat.V1; | ||
| } else if (Config.inverted_index_storage_format.equalsIgnoreCase("V2")) { | ||
| if (Config.inverted_index_storage_format.equalsIgnoreCase("V2")) { | ||
| return TInvertedIndexFileStorageFormat.V2; | ||
| } else { | ||
| return TInvertedIndexFileStorageFormat.V3; | ||
|
|
||
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.
[P1] Keep a rejected V1 update from resetting persisted configs
For direct
_set_config?inverted_index_storage_format=V1&persist=true, this callback rejects the only value, leavingsetConfigsempty, butSetConfigActionstill callspersistConfig(setConfigs, true). That reset path truncatesfe_custom.conf, so a failed V1 update can erase every unrelated persisted override (and may expose a V1 value fromfe.confat the next startup). Please avoid reset persistence when validation produced errors, or make the request transactional, and add a test that the custom file is unchanged after this rejection.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.
Same upstream-parity situation: master Config.java declares this field with the identical callback = InvertedIndexStorageFormatValidator.RuntimeConfigHandler.class, so the _set_config persist reset-persistence interaction you describe exists on master after #64522 as well. The only local adaptation in this hunk was keeping branch-4.1 bilingual description array (plus re-indentation for checkstyle); the callback wiring is verbatim.
Fixing the SetConfigAction / persistConfig interaction is a genuine improvement but it belongs on master first so both branches behave the same. Leaving this thread open for maintainer visibility.