-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[branch-2.0](binlog) Support drop view binlog (#39781) #43408
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 |
---|---|---|
|
@@ -916,23 +916,26 @@ public void dropTable(DropTableStmt stmt) throws DdlException { | |
} | ||
} | ||
|
||
dropTableInternal(db, table, stmt.isForceDrop()); | ||
dropTableInternal(db, table, stmt.isView(), stmt.isForceDrop(), watch, costTimes); | ||
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. only pick the necessary parameters. |
||
} catch (UserException e) { | ||
throw new DdlException(e.getMessage(), e.getMysqlErrorCode()); | ||
} finally { | ||
db.writeUnlock(); | ||
} | ||
LOG.info("finished dropping table: {} from db: {}, is force: {}", tableName, dbName, stmt.isForceDrop()); | ||
watch.stop(); | ||
costTimes.put("6:total", watch.getTime()); | ||
LOG.info("finished dropping table: {} from db: {}, is view: {}, is force: {}, cost: {}", | ||
tableName, dbName, stmt.isView(), stmt.isForceDrop(), costTimes); | ||
Comment on lines
+925
to
+928
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. should merge this conflict manually, eg:
|
||
} | ||
|
||
// drop table without any check. | ||
public void dropTableWithoutCheck(Database db, Table table, boolean forceDrop) throws DdlException { | ||
public void dropTableWithoutCheck(Database db, Table table, boolean isView, boolean forceDrop) throws DdlException { | ||
if (!db.writeLockIfExist()) { | ||
return; | ||
} | ||
try { | ||
LOG.info("drop table {} without check, force: {}", table.getQualifiedName(), forceDrop); | ||
dropTableInternal(db, table, forceDrop); | ||
dropTableInternal(db, table, isView, forceDrop, null, null); | ||
} catch (Exception e) { | ||
LOG.warn("drop table without check", e); | ||
throw e; | ||
|
@@ -942,7 +945,8 @@ public void dropTableWithoutCheck(Database db, Table table, boolean forceDrop) t | |
} | ||
|
||
// Drop a table, the db lock must hold. | ||
private void dropTableInternal(Database db, Table table, boolean forceDrop) throws DdlException { | ||
private void dropTableInternal(Database db, Table table, boolean isView, boolean forceDrop, | ||
StopWatch watch, Map<String, Long> costTimes) throws DdlException { | ||
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. remove |
||
table.writeLock(); | ||
String tableName = table.getName(); | ||
long recycleTime = 0; | ||
|
@@ -955,7 +959,9 @@ private void dropTableInternal(Database db, Table table, boolean forceDrop) thro | |
table.writeUnlock(); | ||
} | ||
|
||
DropInfo info = new DropInfo(db.getId(), table.getId(), tableName, -1L, forceDrop, recycleTime); | ||
Env.getCurrentEnv().getQueryStats().clear(Env.getCurrentEnv().getCurrentCatalog().getId(), | ||
db.getId(), table.getId()); | ||
DropInfo info = new DropInfo(db.getId(), table.getId(), tableName, -1L, isView, forceDrop, recycleTime); | ||
Env.getCurrentEnv().getEditLog().logDropTable(info); | ||
Env.getCurrentEnv().getQueryStats().clear(Env.getCurrentEnv().getCurrentCatalog().getId(), | ||
db.getId(), table.getId()); | ||
|
@@ -2732,7 +2738,7 @@ private boolean createOlapTable(Database db, CreateTableStmt stmt) throws UserEx | |
try { | ||
dropTable(db, tableId, true, false, 0L); | ||
if (hadLogEditCreateTable) { | ||
DropInfo info = new DropInfo(db.getId(), tableId, olapTable.getName(), -1L, true, 0L); | ||
DropInfo info = new DropInfo(db.getId(), tableId, olapTable.getName(), -1L, false, true, 0L); | ||
Env.getCurrentEnv().getEditLog().logDropTable(info); | ||
} | ||
} catch (Exception ex) { | ||
|
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.
@wyxxxcat This patch is staled, please update.