github-actions[bot] commented on code in PR #65100:
URL: https://github.com/apache/doris/pull/65100#discussion_r3505102407
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java:
##########
@@ -771,13 +771,13 @@ public void setName(String name) {
public synchronized void addFunction(Function function, boolean
ifNotExists) throws UserException {
function.checkWritable();
if (FunctionUtil.addFunctionImpl(function, ifNotExists, false,
name2Function)) {
- Env.getCurrentEnv().getEditLog().logAddFunction(function);
try {
FunctionUtil.translateToNereidsThrows(this.getFullName(),
function);
} catch (Exception e) {
- name2Function.remove(function.getFunctionName().getFunction());
+ FunctionUtil.removeFunctionImpl(function, name2Function);
throw e;
}
+ Env.getCurrentEnv().getEditLog().logAddFunction(function);
Review Comment:
This still leaves `CREATE TABLES FUNCTION` non-atomic.
`CreateFunctionCommand.run()` first calls `db.addFunction(function, ...)` for
the base UDTF, then clones it as `<name>_outer` and calls
`db.addFunction(outerFunction, ...)`. With this per-function log point, the
base function has already been translated to Nereids and written to the edit
log before the `_outer` add succeeds. If the second call fails, for example
because an existing `<name>_outer` overload conflicts or because Nereids
translation fails for the companion, the statement returns an error but the
base UDTF remains visible and durable. Please make the local table-function
path transactional as a pair, either by deferring both edit-log writes until
both registrations succeed or by rolling back the base catalog/Nereids state
and durable log when the companion add fails.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]