Skip to content

Commit

Permalink
[fix](udf) avoid exception when fail to find udf in replay logic (apa…
Browse files Browse the repository at this point in the history
…che#25965)

When replaying drop function edit log, the function may not be found, causing runtime exception and
FE will fail to start.
The function SHOULD be exist, but the reason is still unknown.
I change the logic to NOT throw exception if function is not found.
This is a workaround to make sure FE can start, and add some log for later debug.
  • Loading branch information
morningman authored Oct 26, 2023
1 parent a2a157f commit 9faa6e0
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -740,13 +740,20 @@ public synchronized void dropFunction(FunctionSearchDesc function, boolean ifExi
if (FunctionUtil.dropFunctionImpl(function, ifExists, name2Function)) {
Env.getCurrentEnv().getEditLog().logDropFunction(function);
FunctionUtil.dropFromNereids(this.getFullName(), function);
LOG.info("finished to drop function {}", function.getName().getFunction());
}
}

public synchronized void replayDropFunction(FunctionSearchDesc functionSearchDesc) {
try {
FunctionUtil.dropFunctionImpl(functionSearchDesc, false, name2Function);
// Set ifExists to true to avoid throw exception if function is not found.
// It should not happen but the reason is unknown, so add warn log for debug.
if (!FunctionUtil.dropFunctionImpl(functionSearchDesc, true, name2Function)) {
LOG.warn("failed to find function to drop: {} when replay, skip",
functionSearchDesc.getName().getFunction());
}
FunctionUtil.dropFromNereids(this.getFullName(), functionSearchDesc);
LOG.info("finished to replay drop function {}", functionSearchDesc.getName().getFunction());
} catch (UserException e) {
throw new RuntimeException(e);
}
Expand Down

0 comments on commit 9faa6e0

Please sign in to comment.