[fix](Nereids): don't log edit log when replaying (#30578)

* don't log edit log when replaying
This commit is contained in:
谢健
2024-01-30 17:18:48 +08:00
committed by yiguolei
parent b983cbd02d
commit 6376b24300
3 changed files with 6 additions and 4 deletions

View File

@ -327,7 +327,7 @@ public interface TableIf {
}
}
default void dropConstraint(String name) {
default void dropConstraint(String name, boolean replay) {
writeLock();
try {
Map<String, Constraint> constraintMap = getConstraintsMapUnsafe();
@ -341,7 +341,9 @@ public interface TableIf {
((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();
}

View File

@ -56,7 +56,7 @@ public class DropConstraintCommand extends Command implements ForwardWithSync {
@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) {

View File

@ -983,7 +983,7 @@ public class EditLog {
}
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: {