This is an automated email from the ASF dual-hosted git repository.

kxiao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 9faa6e083b1 [fix](udf) avoid exception when fail to find udf in replay 
logic (#25965)
9faa6e083b1 is described below

commit 9faa6e083b114e6268bd648225341524a5dc92b7
Author: Mingyu Chen <[email protected]>
AuthorDate: Thu Oct 26 21:19:13 2023 +0800

    [fix](udf) avoid exception when fail to find udf in replay logic (#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.
---
 fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java
index 14e72edf767..74b8608760c 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java
@@ -740,13 +740,20 @@ public class Database extends MetaObject implements 
Writable, DatabaseIf<Table>
         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);
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to