Skip to content

Commit

Permalink
[fix](Nereids): don't log edit log when replaying (#30578)
Browse files Browse the repository at this point in the history
* don't log edit log when replaying
  • Loading branch information
keanji-x authored Jan 30, 2024
1 parent c5e4337 commit c4e6669
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ default void replayAddConstraint(Constraint constraint) {
}
}

default void dropConstraint(String name) {
default void dropConstraint(String name, boolean replay) {
writeLock();
try {
Map<String, Constraint> constraintMap = getConstraintsMapUnsafe();
Expand All @@ -341,7 +341,9 @@ default void dropConstraint(String name) {
((PrimaryKeyConstraint) constraint).getForeignTables()
.forEach(t -> t.dropFKReferringPK(this, (PrimaryKeyConstraint) constraint));
}
Env.getCurrentEnv().getEditLog().logDropConstraint(new AlterConstraintLog(constraint, this));
if (!replay) {
Env.getCurrentEnv().getEditLog().logDropConstraint(new AlterConstraintLog(constraint, this));
}
} finally {
writeUnlock();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public DropConstraintCommand(String name, LogicalPlan plan) {
@Override
public void run(ConnectContext ctx, StmtExecutor executor) throws Exception {
TableIf table = extractTable(ctx, plan);
table.dropConstraint(name);
table.dropConstraint(name, false);
}

private TableIf extractTable(ConnectContext ctx, LogicalPlan plan) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,7 @@ public static void loadJournal(Env env, Long logId, JournalEntity journal) {
}
case OperationType.OP_DROP_CONSTRAINT: {
final AlterConstraintLog log = (AlterConstraintLog) journal.getData();
log.getTableIf().dropConstraint(log.getConstraint().getName());
log.getTableIf().dropConstraint(log.getConstraint().getName(), true);
break;
}
case OperationType.OP_ALTER_USER: {
Expand Down

0 comments on commit c4e6669

Please sign in to comment.