[fix](multi-catalog) should load datasource before loading cluster (#10330)
A temp DataSourceMgr is created when catalog intializes, and will be updated in the loadCluster process. However, the loadDatasource process will create a new DataSourceMgr with no cluster updated, and write such DatasourceMgr to image. Finally, when the doris starts to recover, no cluster is available.
This commit is contained in:
@ -1878,15 +1878,13 @@ public class Catalog {
|
||||
* Load datasource through file.
|
||||
**/
|
||||
public long loadDatasource(DataInputStream in, long checksum) throws IOException {
|
||||
if (Config.enable_multi_catalog) {
|
||||
DataSourceMgr mgr = DataSourceMgr.read(in);
|
||||
// When enable the multi catalog in the first time, the mgr will be a null value.
|
||||
// So ignore it to use default datasource manager.
|
||||
if (mgr != null) {
|
||||
this.dataSourceMgr = mgr;
|
||||
}
|
||||
LOG.info("finished replay datasource from image");
|
||||
DataSourceMgr mgr = DataSourceMgr.read(in);
|
||||
// When enable the multi catalog in the first time, the mgr will be a null value.
|
||||
// So ignore it to use default datasource manager.
|
||||
if (mgr != null) {
|
||||
this.dataSourceMgr = mgr;
|
||||
}
|
||||
LOG.info("finished replay datasource from image");
|
||||
return checksum;
|
||||
}
|
||||
|
||||
@ -2159,10 +2157,7 @@ public class Catalog {
|
||||
* Save datasource image.
|
||||
*/
|
||||
public long saveDatasource(CountingDataOutputStream out, long checksum) throws IOException {
|
||||
// Do not write datasource image when enable multi catalog is false.
|
||||
if (Config.enable_multi_catalog) {
|
||||
Catalog.getCurrentCatalog().getDataSourceMgr().write(out);
|
||||
}
|
||||
Catalog.getCurrentCatalog().getDataSourceMgr().write(out);
|
||||
return checksum;
|
||||
}
|
||||
|
||||
|
||||
@ -34,11 +34,11 @@ public class PersistMetaModules {
|
||||
// The write and read of meta modules should be in same order.
|
||||
public static final List<MetaPersistMethod> MODULES_IN_ORDER;
|
||||
|
||||
public static final ImmutableList<String> MODULE_NAMES = ImmutableList.copyOf(
|
||||
new String[] {"masterInfo", "frontends", "backends", "db", "loadJob", "alterJob", "recycleBin",
|
||||
"globalVariable", "cluster", "broker", "resources", "exportJob", "syncJob", "backupHandler",
|
||||
"paloAuth", "transactionState", "colocateTableIndex", "routineLoadJobs", "loadJobV2", "smallFiles",
|
||||
"plugins", "deleteHandler", "sqlBlockRule", "policy", "datasource"});
|
||||
public static final ImmutableList<String> MODULE_NAMES = ImmutableList.of(
|
||||
"masterInfo", "frontends", "backends", "datasource", "db", "loadJob", "alterJob", "recycleBin",
|
||||
"globalVariable", "cluster", "broker", "resources", "exportJob", "syncJob", "backupHandler",
|
||||
"paloAuth", "transactionState", "colocateTableIndex", "routineLoadJobs", "loadJobV2", "smallFiles",
|
||||
"plugins", "deleteHandler", "sqlBlockRule", "policy");
|
||||
|
||||
static {
|
||||
MODULES_MAP = Maps.newHashMap();
|
||||
|
||||
Reference in New Issue
Block a user