wyxxxcat commented on code in PR #70581:
URL: https://github.com/apache/doris/pull/70581#discussion_r4581361805
##########
fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java:
##########
@@ -610,53 +610,38 @@ public void replayDropDb(String dbName, boolean
isForceDrop, Long recycleTime) t
}
public void recoverDatabase(String dbName, long dbId, String newDbName)
throws DdlException {
- // check is new db with same name already exist
- if (!Strings.isNullOrEmpty(newDbName)) {
- if (getDb(newDbName).isPresent()) {
- throw new DdlException("Database[" + newDbName + "] already
exist.");
- }
- } else {
- if (getDb(dbName).isPresent()) {
- throw new DdlException("Database[" + dbName + "] already
exist.");
- }
- }
-
- Database db = Env.getCurrentRecycleBin().recoverDatabase(dbName, dbId);
-
- // add db to catalog
if (!tryLock(false)) {
throw new DdlException("Failed to acquire catalog lock. Try
again");
}
- db.writeLock();
- List<Table> tableList = db.getTablesOnIdOrder();
- MetaLockUtils.writeLockTables(tableList);
+ Database db;
Review Comment:
`Database db;` is declared outside the outer `try` only so the final
`LOG.info` can use it. Move the log line inside the `try` and scope `db` there.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]