[fix](fe) fix several blocking bugs #37756 (#37757)

bp #37756
This commit is contained in:
Mingyu Chen
2024-07-15 15:56:01 +08:00
committed by GitHub
parent 8360e3f6cf
commit ff7a04093e
3 changed files with 16 additions and 3 deletions

View File

@ -2444,7 +2444,6 @@ public class FunctionCallExpr extends Expr {
int result = super.hashCode();
result = 31 * result + Objects.hashCode(opcode);
result = 31 * result + Objects.hashCode(fnName);
result = 31 * result + Objects.hashCode(fnParams);
return result;
}

View File

@ -598,6 +598,11 @@ public abstract class ExternalCatalog
// Should not return null.
// Because replyInitCatalog can only be called when `use_meta_cache` is false.
// And if `use_meta_cache` is false, getDbForReplay() will not return null
if (!db.isPresent()) {
LOG.warn("met invalid db id {} in replayInitCatalog, catalog: {}, ignore it to skip bug.",
log.getRefreshDbIds().get(i), name);
continue;
}
Preconditions.checkNotNull(db.get());
tmpDbNameToId.put(db.get().getFullName(), db.get().getId());
tmpIdToDb.put(db.get().getId(), db.get());

View File

@ -64,11 +64,20 @@ public class MasterCatalogExecutor {
boolean isReturnToPool = false;
try {
TInitExternalCtlMetaResult result = client.initExternalCtlMeta(request);
Env.getCurrentEnv().getJournalObservable().waitOn(result.maxJournalId, waitTimeoutMs);
if (!result.getStatus().equalsIgnoreCase(STATUS_OK)) {
throw new UserException(result.getStatus());
} else {
// DO NOT wait on journal replayed, this may cause deadlock.
// 1. hold table read lock
// 2. wait on journal replayed
// 3. previous journal (eg, txn journal) replayed need to hold table write lock
// 4. deadlock
// But no waiting on journal replayed may cause some request on non-master FE failed for some time.
// There is no good solution for this.
// In feature version, this whole process is refactored, so we temporarily remove this waiting.
// Env.getCurrentEnv().getJournalObservable().waitOn(result.maxJournalId, timeoutMs);
isReturnToPool = true;
}
isReturnToPool = true;
} catch (Exception e) {
LOG.warn("Failed to finish forward init operation, please try again. ", e);
throw e;