Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fe/src/main/java/org/apache/doris/PaloFe.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ public static void start(String dorisHomeDir, String pidDir, String[] args) {
ExecuteEnv.setup();

// init catalog and wait it be ready
Catalog.getInstance().initialize(args);
Catalog.getInstance().waitForReady();
Catalog.getCurrentCatalog().initialize(args);
Catalog.getCurrentCatalog().waitForReady();

// init and start:
// 1. QeService for MySQL Server
Expand Down
22 changes: 11 additions & 11 deletions fe/src/main/java/org/apache/doris/alter/Alter.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void processCreateMaterializedView(CreateMaterializedViewStmt stmt)
String tableName = stmt.getBaseIndexName();
// check db
String dbName = stmt.getDBName();
Database db = Catalog.getInstance().getDb(dbName);
Database db = Catalog.getCurrentCatalog().getDb(dbName);
if (db == null) {
ErrorReport.reportDdlException(ErrorCode.ERR_BAD_DB_ERROR, dbName);
}
Expand Down Expand Up @@ -113,7 +113,7 @@ public void processCreateMaterializedView(CreateMaterializedViewStmt stmt)
public void processDropMaterializedView(DropMaterializedViewStmt stmt) throws DdlException, MetaNotFoundException {
// check db
String dbName = stmt.getTableName().getDb();
Database db = Catalog.getInstance().getDb(dbName);
Database db = Catalog.getCurrentCatalog().getDb(dbName);
if (db == null) {
ErrorReport.reportDdlException(ErrorCode.ERR_BAD_DB_ERROR, dbName);
}
Expand Down Expand Up @@ -150,7 +150,7 @@ public void processAlterTable(AlterTableStmt stmt) throws UserException {
String dbName = dbTableName.getDb();
final String clusterName = stmt.getClusterName();

Database db = Catalog.getInstance().getDb(dbName);
Database db = Catalog.getCurrentCatalog().getDb(dbName);
if (db == null) {
ErrorReport.reportDdlException(ErrorCode.ERR_BAD_DB_ERROR, dbName);
}
Expand Down Expand Up @@ -198,7 +198,7 @@ public void processAlterTable(AlterTableStmt stmt) throws UserException {
if (!((DropPartitionClause) alterClause).isTempPartition()) {
DynamicPartitionUtil.checkAlterAllowed((OlapTable) db.getTable(tableName));
}
Catalog.getInstance().dropPartition(db, olapTable, ((DropPartitionClause) alterClause));
Catalog.getCurrentCatalog().dropPartition(db, olapTable, ((DropPartitionClause) alterClause));
} else if (alterClause instanceof ReplacePartitionClause) {
Catalog.getCurrentCatalog().replaceTempPartition(db, tableName, (ReplacePartitionClause) alterClause);
} else if (alterClause instanceof ModifyPartitionClause) {
Expand All @@ -208,7 +208,7 @@ public void processAlterTable(AlterTableStmt stmt) throws UserException {
needProcessOutsideDatabaseLock = true;
} else {
String partitionName = clause.getPartitionName();
Catalog.getInstance().modifyPartitionProperty(db, olapTable, partitionName, properties);
Catalog.getCurrentCatalog().modifyPartitionProperty(db, olapTable, partitionName, properties);
}
} else if (alterClause instanceof AddPartitionClause) {
needProcessOutsideDatabaseLock = true;
Expand Down Expand Up @@ -267,7 +267,7 @@ public void processAlterView(AlterViewStmt stmt, ConnectContext ctx) throws User
TableName dbTableName = stmt.getTbl();
String dbName = dbTableName.getDb();

Database db = Catalog.getInstance().getDb(dbName);
Database db = Catalog.getCurrentCatalog().getDb(dbName);
if (db == null) {
ErrorReport.reportDdlException(ErrorCode.ERR_BAD_DB_ERROR, dbName);
}
Expand Down Expand Up @@ -306,7 +306,7 @@ private void modifyViewDef(Database db, View view, String inlineViewDef, long sq
db.createTable(view);

AlterViewInfo alterViewInfo = new AlterViewInfo(db.getId(), view.getId(), inlineViewDef, newFullSchema, sqlMode);
Catalog.getInstance().getEditLog().logModifyViewDef(alterViewInfo);
Catalog.getCurrentCatalog().getEditLog().logModifyViewDef(alterViewInfo);
LOG.info("modify view[{}] definition to {}", viewName, inlineViewDef);
}

Expand Down Expand Up @@ -345,16 +345,16 @@ public void processAlterCluster(AlterSystemStmt stmt) throws UserException {
private void processRename(Database db, OlapTable table, List<AlterClause> alterClauses) throws DdlException {
for (AlterClause alterClause : alterClauses) {
if (alterClause instanceof TableRenameClause) {
Catalog.getInstance().renameTable(db, table, (TableRenameClause) alterClause);
Catalog.getCurrentCatalog().renameTable(db, table, (TableRenameClause) alterClause);
break;
} else if (alterClause instanceof RollupRenameClause) {
Catalog.getInstance().renameRollup(db, table, (RollupRenameClause) alterClause);
Catalog.getCurrentCatalog().renameRollup(db, table, (RollupRenameClause) alterClause);
break;
} else if (alterClause instanceof PartitionRenameClause) {
Catalog.getInstance().renamePartition(db, table, (PartitionRenameClause) alterClause);
Catalog.getCurrentCatalog().renamePartition(db, table, (PartitionRenameClause) alterClause);
break;
} else if (alterClause instanceof ColumnRenameClause) {
Catalog.getInstance().renameColumn(db, table, (ColumnRenameClause) alterClause);
Catalog.getCurrentCatalog().renameColumn(db, table, (ColumnRenameClause) alterClause);
break;
} else {
Preconditions.checkState(false);
Expand Down
2 changes: 1 addition & 1 deletion fe/src/main/java/org/apache/doris/alter/AlterHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ public void handleFinishAlterTask(AlterReplicaTask task) throws MetaNotFoundExce
replica.getDataSize(), replica.getRowCount(),
replica.getLastFailedVersion(), replica.getLastFailedVersionHash(),
replica.getLastSuccessVersion(), replica.getLastSuccessVersionHash());
Catalog.getInstance().getEditLog().logUpdateReplica(info);
Catalog.getCurrentCatalog().getEditLog().logUpdateReplica(info);
}

LOG.info("after handle alter task tablet: {}, replica: {}", task.getSignature(), replica);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public synchronized int tryFinishJob() {
if (decommissionType == DecommissionType.ClusterDecommission) {
for (String clusterName : clusterBackendsMap.keySet()) {
final Map<Long, Backend> idToBackend = clusterBackendsMap.get(clusterName);
final Cluster cluster = Catalog.getInstance().getCluster(clusterName);
final Cluster cluster = Catalog.getCurrentCatalog().getCluster(clusterName);
List<Long> backendList = Lists.newArrayList();
for (long id : idToBackend.keySet()) {
final Backend backend = idToBackend.get(id);
Expand All @@ -236,15 +236,15 @@ public synchronized int tryFinishJob() {
cluster.removeBackend(id);
}
BackendIdsUpdateInfo updateInfo = new BackendIdsUpdateInfo(backendList);
Catalog.getInstance().getEditLog().logUpdateClusterAndBackendState(updateInfo);
Catalog.getCurrentCatalog().getEditLog().logUpdateClusterAndBackendState(updateInfo);
}
}
}

this.finishedTime = System.currentTimeMillis();
this.state = JobState.FINISHED;

Catalog.getInstance().getEditLog().logFinishDecommissionBackend(this);
Catalog.getCurrentCatalog().getEditLog().logFinishDecommissionBackend(this);

LOG.info("finished {} decommission {} backends: {}", decommissionType.toString(),
allClusterBackendIds.size(), getBackendIdsString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,7 @@ public void processBatchDropRollup(List<AlterClause> dropRollupClauses, Database
}

// batch log drop rollup operation
EditLog editLog = Catalog.getInstance().getEditLog();
EditLog editLog = Catalog.getCurrentCatalog().getEditLog();
long dbId = db.getId();
long tableId = olapTable.getId();
editLog.logBatchDropRollup(new BatchDropInfo(dbId, tableId, indexIdSet));
Expand All @@ -699,7 +699,7 @@ public void processDropMaterializedView(DropMaterializedViewStmt dropMaterialize
// Step2; drop data in memory
long mvIndexId = dropMaterializedView(mvName, olapTable);
// Step3: log drop mv operation
EditLog editLog = Catalog.getInstance().getEditLog();
EditLog editLog = Catalog.getCurrentCatalog().getEditLog();
editLog.logDropRollup(new DropInfo(db.getId(), olapTable.getId(), mvIndexId));
LOG.info("finished drop materialized view [{}] in table [{}]", mvName, olapTable.getName());
} catch (MetaNotFoundException e) {
Expand Down Expand Up @@ -1009,7 +1009,7 @@ private void runOldAlterJob() {

// handle cancelled rollup jobs
for (AlterJob rollupJob : cancelledJobs) {
Database db = Catalog.getInstance().getDb(rollupJob.getDbId());
Database db = Catalog.getCurrentCatalog().getDb(rollupJob.getDbId());
if (db == null) {
cancelInternal(rollupJob, null, null);
continue;
Expand All @@ -1034,7 +1034,7 @@ private void runOldAlterJob() {
// then schema change job will be failed.
alterJob.finishJob();
jobDone(alterJob);
Catalog.getInstance().getEditLog().logFinishRollup((RollupJob) alterJob);
Catalog.getCurrentCatalog().getEditLog().logFinishRollup((RollupJob) alterJob);
}
}

Expand Down Expand Up @@ -1133,7 +1133,7 @@ public void cancel(CancelStmt stmt) throws DdlException {
Preconditions.checkState(!Strings.isNullOrEmpty(dbName));
Preconditions.checkState(!Strings.isNullOrEmpty(tableName));

Database db = Catalog.getInstance().getDb(dbName);
Database db = Catalog.getCurrentCatalog().getDb(dbName);
if (db == null) {
ErrorReport.reportDdlException(ErrorCode.ERR_BAD_DB_ERROR, dbName);
}
Expand Down
12 changes: 6 additions & 6 deletions fe/src/main/java/org/apache/doris/alter/RollupJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public int checkOrResendClearTasks() {
if (!clearFailed && batchClearAlterTask != null) {
return 1;
}
Database db = Catalog.getInstance().getDb(dbId);
Database db = Catalog.getCurrentCatalog().getDb(dbId);
if (db == null) {
cancelMsg = "db[" + dbId + "] does not exist";
LOG.warn(cancelMsg);
Expand Down Expand Up @@ -405,7 +405,7 @@ public boolean sendTasks() {
// here we just rejoin tasks to AgentTaskQueue.
// task report process will later resend these tasks

Database db = Catalog.getInstance().getDb(dbId);
Database db = Catalog.getCurrentCatalog().getDb(dbId);
if (db == null) {
cancelMsg = "db[" + dbId + "] does not exist";
LOG.warn(cancelMsg);
Expand Down Expand Up @@ -512,7 +512,7 @@ public synchronized void cancel(OlapTable olapTable, String msg) {
this.finishedTime = System.currentTimeMillis();

// log
Catalog.getInstance().getEditLog().logCancelRollup(this);
Catalog.getCurrentCatalog().getEditLog().logCancelRollup(this);
LOG.debug("cancel rollup job[{}] finished. because: {}", tableId, cancelMsg);
}

Expand Down Expand Up @@ -621,7 +621,7 @@ public int tryFinishJob() {
return 0;
}

Database db = Catalog.getInstance().getDb(dbId);
Database db = Catalog.getCurrentCatalog().getDb(dbId);
if (db == null) {
cancelMsg = "Db[" + dbId + "] does not exist";
LOG.warn(cancelMsg);
Expand Down Expand Up @@ -760,7 +760,7 @@ public int tryFinishJob() {
db.writeUnlock();
}

Catalog.getInstance().getEditLog().logFinishingRollup(this);
Catalog.getCurrentCatalog().getEditLog().logFinishingRollup(this);
LOG.info("rollup job[{}] is finishing.", this.getTableId());

return 1;
Expand Down Expand Up @@ -938,7 +938,7 @@ public void replayCancel(Database db) {

@Override
public void finishJob() {
Database db = Catalog.getInstance().getDb(dbId);
Database db = Catalog.getCurrentCatalog().getDb(dbId);
if (db == null) {
cancelMsg = String.format("database %d does not exist", dbId);
LOG.warn(cancelMsg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ private void createJob(long dbId, OlapTable olapTable, Map<Long, LinkedList<Colu
addAlterJobV2(schemaChangeJob);

// 3. write edit log
Catalog.getInstance().getEditLog().logAlterJob(schemaChangeJob);
Catalog.getCurrentCatalog().getEditLog().logAlterJob(schemaChangeJob);
LOG.info("finished to create schema change job: {}", schemaChangeJob.getJobId());
}

Expand Down Expand Up @@ -1257,7 +1257,7 @@ private void runOldAlterJob() {

// handle cancelled schema change jobs
for (AlterJob alterJob : cancelledJobs) {
Database db = Catalog.getInstance().getDb(alterJob.getDbId());
Database db = Catalog.getCurrentCatalog().getDb(alterJob.getDbId());
if (db == null) {
cancelInternal(alterJob, null, null);
continue;
Expand All @@ -1281,7 +1281,7 @@ private void runOldAlterJob() {
((SchemaChangeJob) alterJob).deleteAllTableHistorySchema();
((SchemaChangeJob) alterJob).finishJob();
jobDone(alterJob);
Catalog.getInstance().getEditLog().logFinishSchemaChange((SchemaChangeJob) alterJob);
Catalog.getCurrentCatalog().getEditLog().logFinishSchemaChange((SchemaChangeJob) alterJob);
}
}

Expand Down Expand Up @@ -1577,7 +1577,7 @@ public void cancel(CancelStmt stmt) throws DdlException {
Preconditions.checkState(!Strings.isNullOrEmpty(dbName));
Preconditions.checkState(!Strings.isNullOrEmpty(tableName));

Database db = Catalog.getInstance().getDb(dbName);
Database db = Catalog.getCurrentCatalog().getDb(dbName);
if (db == null) {
throw new DdlException("Database[" + dbName + "] does not exist");
}
Expand Down
18 changes: 9 additions & 9 deletions fe/src/main/java/org/apache/doris/alter/SchemaChangeJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public synchronized int getFinishedReplicaNumByIndexId(long indexId) {
}

public void deleteAllTableHistorySchema() {
Database db = Catalog.getInstance().getDb(dbId);
Database db = Catalog.getCurrentCatalog().getDb(dbId);
if (db == null) {
LOG.warn("db[{}] does not exist", dbId);
return;
Expand Down Expand Up @@ -312,7 +312,7 @@ public int checkOrResendClearTasks() {
return 1;
}

Database db = Catalog.getInstance().getDb(dbId);
Database db = Catalog.getCurrentCatalog().getDb(dbId);
if (db == null) {
cancelMsg = "db[" + dbId + "] does not exist";
LOG.warn(cancelMsg);
Expand Down Expand Up @@ -374,7 +374,7 @@ public boolean sendTasks() {

LOG.info("sending schema change job {}, start txn id: {}", tableId, transactionId);

Database db = Catalog.getInstance().getDb(dbId);
Database db = Catalog.getCurrentCatalog().getDb(dbId);
if (db == null) {
String msg = "db[" + dbId + "] does not exist";
setMsg(msg);
Expand Down Expand Up @@ -544,7 +544,7 @@ public synchronized void cancel(OlapTable olapTable, String msg) {
this.finishedTime = System.currentTimeMillis();

// 2. log
Catalog.getInstance().getEditLog().logCancelSchemaChange(this);
Catalog.getCurrentCatalog().getEditLog().logCancelSchemaChange(this);
LOG.info("cancel schema change job[{}] finished, because: {}",
olapTable == null ? -1 : olapTable.getId(), cancelMsg);
}
Expand Down Expand Up @@ -580,7 +580,7 @@ public void handleFinishedReplica(AgentTask task, TTabletInfo finishTabletInfo,
long replicaId = schemaChangeTask.getReplicaId();

// update replica's info
Database db = Catalog.getInstance().getDb(dbId);
Database db = Catalog.getCurrentCatalog().getDb(dbId);
if (db == null) {
throw new MetaNotFoundException("Cannot find db[" + dbId + "]");
}
Expand Down Expand Up @@ -654,7 +654,7 @@ public int tryFinishJob() {
return 0;
}

Database db = Catalog.getInstance().getDb(dbId);
Database db = Catalog.getCurrentCatalog().getDb(dbId);
if (db == null) {
cancelMsg = String.format("database %d does not exist", dbId);
LOG.warn(cancelMsg);
Expand Down Expand Up @@ -865,14 +865,14 @@ public int tryFinishJob() {
db.writeUnlock();
}

Catalog.getInstance().getEditLog().logFinishingSchemaChange(this);
Catalog.getCurrentCatalog().getEditLog().logFinishingSchemaChange(this);
LOG.info("schema change job is finishing. finishing txn id: {} table {}", transactionId, tableId);
return 1;
}

@Override
public void finishJob() {
Database db = Catalog.getInstance().getDb(dbId);
Database db = Catalog.getCurrentCatalog().getDb(dbId);
if (db == null) {
cancelMsg = String.format("database %d does not exist", dbId);
LOG.warn(cancelMsg);
Expand Down Expand Up @@ -1153,7 +1153,7 @@ public void getJobInfo(List<List<Comparable>> jobInfos, OlapTable tbl) {

indexState.put(indexId, idxState);

if (Catalog.getInstance().isMaster() && state == JobState.RUNNING && totalReplicaNum != 0) {
if (Catalog.getCurrentCatalog().isMaster() && state == JobState.RUNNING && totalReplicaNum != 0) {
indexProgress.put(indexId, (finishedReplicaNum * 100 / totalReplicaNum) + "%");
} else {
indexProgress.put(indexId, "0%");
Expand Down
Loading