zddr commented on code in PR #45045: URL: https://github.com/apache/doris/pull/45045#discussion_r1883720606
########## fe/fe-core/src/main/java/org/apache/doris/common/proc/PartitionsProcDir.java: ########## @@ -243,6 +243,7 @@ private List<Pair<List<Comparable>, TRow>> getPartitionInfosInrernal() throws An List<Pair<List<Comparable>, TRow>> partitionInfos = new ArrayList<Pair<List<Comparable>, TRow>>(); Map<Long, List<String>> partitionsUnSyncTables = null; String mtmvPartitionSyncErrorMsg = null; + olapTable.readLock(); Review Comment: need lock of relatedTable? ########## fe/fe-core/src/main/java/org/apache/doris/catalog/TableIf.java: ########## @@ -381,40 +352,31 @@ default void replayDropConstraint(String name) { } default void dropConstraint(String name, boolean replay) { - writeLock(); - try { - Map<String, Constraint> constraintMap = getConstraintsMapUnsafe(); - if (!constraintMap.containsKey(name)) { - throw new AnalysisException( - String.format("Unknown constraint %s on table %s.", name, this.getName())); - } - Constraint constraint = constraintMap.get(name); - constraintMap.remove(name); - if (constraint instanceof PrimaryKeyConstraint) { - ((PrimaryKeyConstraint) constraint).getForeignTables() - .forEach(t -> t.dropFKReferringPK(this, (PrimaryKeyConstraint) constraint)); - } - if (!replay) { - Env.getCurrentEnv().getEditLog().logDropConstraint(new AlterConstraintLog(constraint, this)); - } - } finally { - writeUnlock(); + Map<String, Constraint> constraintMap = getConstraintsMapUnsafe(); + if (!constraintMap.containsKey(name)) { + throw new AnalysisException( + String.format("Unknown constraint %s on table %s.", name, this.getName())); + } + Constraint constraint = constraintMap.get(name); + constraintMap.remove(name); + if (constraint instanceof PrimaryKeyConstraint) { + ((PrimaryKeyConstraint) constraint).getForeignTables() + .forEach(t -> t.dropFKReferringPK(this, (PrimaryKeyConstraint) constraint)); + } + if (!replay) { + Env.getCurrentEnv().getEditLog().logDropConstraint(new AlterConstraintLog(constraint, this)); } } default void dropFKReferringPK(TableIf table, PrimaryKeyConstraint constraint) { - writeLock(); - try { - Map<String, Constraint> constraintMap = getConstraintsMapUnsafe(); - Set<String> fkName = constraintMap.entrySet().stream() - .filter(e -> e.getValue() instanceof ForeignKeyConstraint - && ((ForeignKeyConstraint) e.getValue()).isReferringPK(table, constraint)) - .map(Entry::getKey) - .collect(Collectors.toSet()); - fkName.forEach(constraintMap::remove); - } finally { - writeUnlock(); - } + Map<String, Constraint> constraintMap = getConstraintsMapUnsafe(); Review Comment: Where did the logic of locking move to ########## fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java: ########## @@ -844,22 +845,28 @@ private static TFetchSchemaTableDataResult mtmvMetadataResult(TMetadataTableRequ } MTMV mv = (MTMV) table; if (LOG.isDebugEnabled()) { - LOG.debug("mv: " + mv.toInfoString()); + LOG.debug("mv: {}", mv.toInfoString()); } TRow trow = new TRow(); - trow.addToColumnValue(new TCell().setLongVal(mv.getId())); - trow.addToColumnValue(new TCell().setStringVal(mv.getName())); - trow.addToColumnValue(new TCell().setStringVal(mv.getJobInfo().getJobName())); - trow.addToColumnValue(new TCell().setStringVal(mv.getStatus().getState().name())); - trow.addToColumnValue(new TCell().setStringVal(mv.getStatus().getSchemaChangeDetail())); - trow.addToColumnValue(new TCell().setStringVal(mv.getStatus().getRefreshState().name())); - trow.addToColumnValue(new TCell().setStringVal(mv.getRefreshInfo().toString())); - trow.addToColumnValue(new TCell().setStringVal(mv.getQuerySql())); - trow.addToColumnValue(new TCell().setStringVal(mv.getMvProperties().toString())); - trow.addToColumnValue(new TCell().setStringVal(mv.getMvPartitionInfo().toNameString())); - trow.addToColumnValue(new TCell().setBoolVal(MTMVPartitionUtil.isMTMVSync(mv))); - if (LOG.isDebugEnabled()) { - LOG.debug("mvend: " + mv.getName()); + mv.readLock(); Review Comment: need readLock of relatedTable? -- 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: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org