You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "zddr (via GitHub)" <gi...@apache.org> on 2023/06/21 02:00:49 UTC

[GitHub] [doris] zddr opened a new pull request, #21054: [feature-wip](MTMV)optimize lock

zddr opened a new pull request, #21054:
URL: https://github.com/apache/doris/pull/21054

   ## Proposed changes
   
   Issue Number: close #xxx
   
   optimize lock
   
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zddr commented on pull request #21054: [feature-wip](MTMV)optimize lock

Posted by "zddr (via GitHub)" <gi...@apache.org>.
zddr commented on PR #21054:
URL: https://github.com/apache/doris/pull/21054#issuecomment-1605860342

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #21054: [feature-wip](MTMV)optimize lock

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #21054:
URL: https://github.com/apache/doris/pull/21054#issuecomment-1608704357

   PR approved by at least one committer and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zddr commented on pull request #21054: [feature-wip](MTMV)optimize lock

Posted by "zddr (via GitHub)" <gi...@apache.org>.
zddr commented on PR #21054:
URL: https://github.com/apache/doris/pull/21054#issuecomment-1605820508

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zddr commented on pull request #21054: [feature-wip](MTMV)optimize lock

Posted by "zddr (via GitHub)" <gi...@apache.org>.
zddr commented on PR #21054:
URL: https://github.com/apache/doris/pull/21054#issuecomment-1606702463

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zddr commented on pull request #21054: [feature-wip](MTMV)optimize lock

Posted by "zddr (via GitHub)" <gi...@apache.org>.
zddr commented on PR #21054:
URL: https://github.com/apache/doris/pull/21054#issuecomment-1599985502

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morningman commented on a diff in pull request #21054: [feature-wip](MTMV)optimize lock

Posted by "morningman (via GitHub)" <gi...@apache.org>.
morningman commented on code in PR #21054:
URL: https://github.com/apache/doris/pull/21054#discussion_r1237179417


##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVJobManager.java:
##########
@@ -470,56 +317,75 @@ public void replayDropJobs(List<Long> jobIds) {
     }
 
     public void replayUpdateJob(ChangeMTMVJob changeJob) {
-        updateJob(changeJob, true);
+        MTMVJob mtmvJob = idToJobMap.get(changeJob.getJobId());
+        if (mtmvJob != null) {
+            mtmvJob.updateJob(changeJob, true);
+        }
     }
 
     public void replayCreateJobTask(MTMVTask task) {
         taskManager.replayCreateJobTask(task);
     }
 
     public void replayDropJobTasks(List<String> taskIds) {
-        taskManager.dropTasks(taskIds, true);
+        taskManager.dropHistoryTasks(taskIds, true);
     }
 
     public void removeExpiredJobs() {
         long currentTimeSeconds = MTMVUtils.getNowTimeStamp();
-
         List<Long> jobIdsToDelete = Lists.newArrayList();
-        if (!tryLock()) {
-            return;
-        }
-        try {
-            List<MTMVJob> jobs = showJobs(null);
-            for (MTMVJob job : jobs) {
-                // active job should not clean
-                if (job.getState() == MTMVUtils.JobState.ACTIVE) {
-                    continue;
-                }
-                if (job.getTriggerMode() == MTMVUtils.TriggerMode.PERIODICAL) {
-                    JobSchedule jobSchedule = job.getSchedule();
-                    if (jobSchedule == null) {
-                        jobIdsToDelete.add(job.getId());
-                        LOG.warn("clean up a null schedule periodical Task [{}]", job.getName());
-                        continue;
-                    }
-
-                }
-                long expireTime = job.getExpireTime();
-                if (expireTime > 0 && currentTimeSeconds > expireTime) {
-                    jobIdsToDelete.add(job.getId());
-                }
+        List<MTMVJob> jobs = getAllJobsWithLock();
+        for (MTMVJob job : jobs) {
+            // active job should not clean
+            if (job.getState() == MTMVUtils.JobState.ACTIVE) {

Review Comment:
   I think only `COMPLETE` job can be removed.



##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVJobManager.java:
##########
@@ -470,56 +317,75 @@ public void replayDropJobs(List<Long> jobIds) {
     }
 
     public void replayUpdateJob(ChangeMTMVJob changeJob) {
-        updateJob(changeJob, true);
+        MTMVJob mtmvJob = idToJobMap.get(changeJob.getJobId());
+        if (mtmvJob != null) {
+            mtmvJob.updateJob(changeJob, true);
+        }
     }
 
     public void replayCreateJobTask(MTMVTask task) {
         taskManager.replayCreateJobTask(task);
     }
 
     public void replayDropJobTasks(List<String> taskIds) {
-        taskManager.dropTasks(taskIds, true);
+        taskManager.dropHistoryTasks(taskIds, true);
     }
 
     public void removeExpiredJobs() {

Review Comment:
   change to private.
   And check other method, if it only be used inside this class, change to private



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morningman merged pull request #21054: [feature-wip](MTMV)optimize lock

Posted by "morningman (via GitHub)" <gi...@apache.org>.
morningman merged PR #21054:
URL: https://github.com/apache/doris/pull/21054


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zddr commented on pull request #21054: [feature-wip](MTMV)optimize lock

Posted by "zddr (via GitHub)" <gi...@apache.org>.
zddr commented on PR #21054:
URL: https://github.com/apache/doris/pull/21054#issuecomment-1600083725

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zddr commented on pull request #21054: [feature-wip](MTMV)optimize lock

Posted by "zddr (via GitHub)" <gi...@apache.org>.
zddr commented on PR #21054:
URL: https://github.com/apache/doris/pull/21054#issuecomment-1600058421

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zddr commented on pull request #21054: [feature-wip](MTMV)optimize lock

Posted by "zddr (via GitHub)" <gi...@apache.org>.
zddr commented on PR #21054:
URL: https://github.com/apache/doris/pull/21054#issuecomment-1605291206

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zddr commented on pull request #21054: [feature-wip](MTMV)optimize lock

Posted by "zddr (via GitHub)" <gi...@apache.org>.
zddr commented on PR #21054:
URL: https://github.com/apache/doris/pull/21054#issuecomment-1606461145

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] zddr commented on pull request #21054: [feature-wip](MTMV)optimize lock

Posted by "zddr (via GitHub)" <gi...@apache.org>.
zddr commented on PR #21054:
URL: https://github.com/apache/doris/pull/21054#issuecomment-1605915186

   run buildall


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #21054: [feature-wip](MTMV)optimize lock

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #21054:
URL: https://github.com/apache/doris/pull/21054#issuecomment-1608704451

   PR approved by anyone and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org