You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ni...@apache.org on 2020/02/18 09:45:05 UTC

[kylin] branch master updated: KYLIN-4307 WriteConflictException when build cube by layer

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 78deee8  KYLIN-4307 WriteConflictException when build cube by layer
78deee8 is described below

commit 78deee8fc431cc32d67d9384423cf4f09196b605
Author: yaqian.zhang <59...@qq.com>
AuthorDate: Tue Feb 18 15:54:32 2020 +0800

    KYLIN-4307 WriteConflictException when build cube by layer
---
 .../java/org/apache/kylin/job/dao/ExecutableDao.java | 20 +++++++++++++++++---
 pom.xml                                              |  2 +-
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/core-job/src/main/java/org/apache/kylin/job/dao/ExecutableDao.java b/core-job/src/main/java/org/apache/kylin/job/dao/ExecutableDao.java
index 3774908..ff03977 100644
--- a/core-job/src/main/java/org/apache/kylin/job/dao/ExecutableDao.java
+++ b/core-job/src/main/java/org/apache/kylin/job/dao/ExecutableDao.java
@@ -31,6 +31,7 @@ import org.apache.kylin.common.persistence.ContentReader;
 import org.apache.kylin.common.persistence.JsonSerializer;
 import org.apache.kylin.common.persistence.ResourceStore;
 import org.apache.kylin.common.persistence.Serializer;
+import org.apache.kylin.common.persistence.WriteConflictException;
 import org.apache.kylin.common.util.AutoReadWriteLock;
 import org.apache.kylin.job.exception.PersistentException;
 import org.apache.kylin.job.execution.AbstractExecutable;
@@ -440,9 +441,22 @@ public class ExecutableDao {
 
     public void updateJobOutput(ExecutableOutputPO output) throws PersistentException {
         try {
-            writeJobOutputResource(pathOfJobOutput(output.getUuid()), output);
-            if (!isTaskExecutableOutput(output.getUuid()))
-                executableOutputDigestMap.put(output.getUuid(), output);
+            int retry = 7;
+            while (retry-- > 0) {
+                try {
+                    writeJobOutputResource(pathOfJobOutput(output.getUuid()), output);
+                    if (!isTaskExecutableOutput(output.getUuid()))
+                        executableOutputDigestMap.put(output.getUuid(), output);
+                    return;
+                } catch (WriteConflictException e) {
+                    if (retry <= 0) {
+                        logger.error("Retry is out, till got error, abandoning...", e);
+                        throw e;
+                    }
+                    logger.warn("Write conflict to update  job output id:" +  output.getUuid() + " retry remaining " + retry
+                            + ", will retry...");
+                }
+            }
         } catch (IOException e) {
             logger.error("error update job output id:" + output.getUuid(), e);
             throw new PersistentException(e);
diff --git a/pom.xml b/pom.xml
index c7cc0ee..dd59b9a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1308,7 +1308,7 @@
         <groupId>net.alchim31.maven</groupId>
         <artifactId>scala-maven-plugin</artifactId>
         <!-- uncomment this on release -->
-        <!--<version>3.4.1</version>-->
+        <version>3.4.1</version>
       </plugin>
     </plugins>
   </build>