majin1102 commented on code in PR #2720:
URL: https://github.com/apache/amoro/pull/2720#discussion_r1558019300
##########
ams/server/src/main/java/com/netease/arctic/server/optimizing/OptimizingQueue.java:
##########
@@ -544,27 +544,32 @@ public void commit() {
taskMap.size(),
taskMap.values());
+ boolean needCleanupTasks = false;
lock.lock();
try {
if (hasCommitted) {
LOG.warn("{} has already committed, give up",
tableRuntime.getTableIdentifier());
throw new IllegalStateException("repeat commit, and last error " +
failedReason);
}
- hasCommitted = true;
- buildCommit().commit();
- status = Status.SUCCESS;
- endTime = System.currentTimeMillis();
- persistProcessCompleted(true);
- } catch (Exception e) {
- LOG.error("{} Commit optimizing failed ",
tableRuntime.getTableIdentifier(), e);
- status = Status.FAILED;
- failedReason = ExceptionUtil.getErrorMessage(e, 4000);
- endTime = System.currentTimeMillis();
- persistProcessCompleted(false);
+ try {
+ hasCommitted = true;
+ buildCommit().commit();
+ status = Status.SUCCESS;
+ endTime = System.currentTimeMillis();
+ persistProcessCompleted(true);
+ } catch (Exception e) {
+ LOG.error("{} Commit optimizing failed ",
tableRuntime.getTableIdentifier(), e);
+ status = Status.FAILED;
+ needCleanupTasks = true;
+ failedReason = ExceptionUtil.getErrorMessage(e, 4000);
+ endTime = System.currentTimeMillis();
+ persistProcessCompleted(false);
+ } finally {
+ clearProcess(this);
Review Comment:
Does clearProcess() here mean no chance to retry?
I don't think it is a good idea that clear process after failing only once,
since we have 6 times to retry a single task
##########
ams/server/src/main/java/com/netease/arctic/server/optimizing/OptimizingQueue.java:
##########
@@ -544,27 +544,32 @@ public void commit() {
taskMap.size(),
taskMap.values());
+ boolean needCleanupTasks = false;
lock.lock();
try {
if (hasCommitted) {
LOG.warn("{} has already committed, give up",
tableRuntime.getTableIdentifier());
throw new IllegalStateException("repeat commit, and last error " +
failedReason);
}
- hasCommitted = true;
- buildCommit().commit();
- status = Status.SUCCESS;
- endTime = System.currentTimeMillis();
- persistProcessCompleted(true);
- } catch (Exception e) {
- LOG.error("{} Commit optimizing failed ",
tableRuntime.getTableIdentifier(), e);
- status = Status.FAILED;
- failedReason = ExceptionUtil.getErrorMessage(e, 4000);
- endTime = System.currentTimeMillis();
- persistProcessCompleted(false);
+ try {
+ hasCommitted = true;
Review Comment:
This variable is not very clear.
It's more like isCommitting and turn it to false in finally.
##########
ams/server/src/main/java/com/netease/arctic/server/optimizing/OptimizingQueue.java:
##########
@@ -544,27 +544,32 @@ public void commit() {
taskMap.size(),
taskMap.values());
+ boolean needCleanupTasks = false;
lock.lock();
try {
if (hasCommitted) {
LOG.warn("{} has already committed, give up",
tableRuntime.getTableIdentifier());
throw new IllegalStateException("repeat commit, and last error " +
failedReason);
}
- hasCommitted = true;
- buildCommit().commit();
- status = Status.SUCCESS;
- endTime = System.currentTimeMillis();
- persistProcessCompleted(true);
- } catch (Exception e) {
- LOG.error("{} Commit optimizing failed ",
tableRuntime.getTableIdentifier(), e);
- status = Status.FAILED;
- failedReason = ExceptionUtil.getErrorMessage(e, 4000);
- endTime = System.currentTimeMillis();
- persistProcessCompleted(false);
+ try {
+ hasCommitted = true;
+ buildCommit().commit();
+ status = Status.SUCCESS;
+ endTime = System.currentTimeMillis();
+ persistProcessCompleted(true);
+ } catch (Exception e) {
+ LOG.error("{} Commit optimizing failed ",
tableRuntime.getTableIdentifier(), e);
+ status = Status.FAILED;
+ needCleanupTasks = true;
Review Comment:
Cancel is to close running tasks and this is truely unnecessary.
--
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]