[improvement](meta) allow to ignore unknown image module (#25450)

Add new FE config `ignore_unknown_metadata_module`. Default is false.
If set to true, when reading metadata image file, and there are unknown modules, these modules
will be ignored and skipped.
This is mainly used in downgrade operation, old version can be compatible with new version Image file.
This commit is contained in:
Mingyu Chen
2023-10-17 22:53:31 +08:00
committed by GitHub
parent 18c2a13e09
commit b76e23fb34
2 changed files with 27 additions and 3 deletions

View File

@ -18,6 +18,7 @@
package org.apache.doris.persist.meta;
import org.apache.doris.catalog.Env;
import org.apache.doris.common.Config;
import org.apache.doris.common.DdlException;
import com.google.common.base.Preconditions;
@ -101,7 +102,7 @@ public class MetaReader {
}
// skip deprecated modules
if (PersistMetaModules.DEPRECATED_MODULE_NAMES.contains(metaIndex.name)) {
LOG.warn("meta modules {} is deprecated, ignore and skip it");
LOG.warn("meta modules {} is deprecated, ignore and skip it", metaIndex.name);
// If this is the last module, nothing need to do.
if (i < metaFooter.metaIndices.size() - 1) {
IOUtils.skipFully(dis, metaFooter.metaIndices.get(i + 1).offset - metaIndex.offset);
@ -110,8 +111,17 @@ public class MetaReader {
}
MetaPersistMethod persistMethod = PersistMetaModules.MODULES_MAP.get(metaIndex.name);
if (persistMethod == null) {
throw new IOException("Unknown meta module: " + metaIndex.name + ". Known modules: "
+ PersistMetaModules.MODULE_NAMES);
if (Config.ignore_unknown_metadata_module) {
LOG.warn("meta modules {} is unknown, ignore and skip it", metaIndex.name);
// If this is the last module, nothing need to do.
if (i < metaFooter.metaIndices.size() - 1) {
IOUtils.skipFully(dis, metaFooter.metaIndices.get(i + 1).offset - metaIndex.offset);
}
continue;
} else {
throw new IOException("Unknown meta module: " + metaIndex.name + ". Known modules: "
+ PersistMetaModules.MODULE_NAMES);
}
}
checksum = (long) persistMethod.readMethod.invoke(env, dis, checksum);
}