You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by mm...@apache.org on 2021/08/31 12:04:05 UTC

[accumulo] branch main updated: Clarify some code in CompactionService (#2250)

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

mmiller pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new ae7d18f  Clarify some code in CompactionService (#2250)
ae7d18f is described below

commit ae7d18f9779e346e010be7ce54b24ec16f429270
Author: Mike Miller <mm...@apache.org>
AuthorDate: Tue Aug 31 08:04:00 2021 -0400

    Clarify some code in CompactionService (#2250)
    
    * Split up some single lines of code to make it easier to read
    * Add a comment
---
 .../accumulo/tserver/compactions/CompactionService.java      | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/compactions/CompactionService.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/compactions/CompactionService.java
index 145c47d..ca30011 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/compactions/CompactionService.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/compactions/CompactionService.java
@@ -319,9 +319,9 @@ public class CompactionService {
     }
 
     plan = convertPlan(plan, kind, files.get().allFiles, files.get().candidates);
-
-    if (compactable.getExtent().isMeta() && plan.getJobs().stream().map(cj -> cj.getExecutor())
-        .anyMatch(ceid -> ((CompactionExecutorIdImpl) ceid).isExternalId())) {
+    // log error if tablet is metadata and compaction is external
+    var execIds = plan.getJobs().stream().map(cj -> (CompactionExecutorIdImpl) cj.getExecutor());
+    if (compactable.getExtent().isMeta() && execIds.anyMatch(ceid -> ceid.isExternalId())) {
       log.error(
           "Compacting metadata tablets on external compactors is not supported, please change "
               + "config for compaction service ({}) and/or table ASAP.  {} is not compacting, "
@@ -344,11 +344,11 @@ public class CompactionService {
 
     if (reconcile(jobs, submitted)) {
       for (CompactionJob job : jobs) {
-        var sjob =
-            executors.get(job.getExecutor()).submit(myId, job, compactable, completionCallback);
+        CompactionExecutor executor = executors.get(job.getExecutor());
+        var submittedJob = executor.submit(myId, job, compactable, completionCallback);
         // its important that the collection created in computeIfAbsent supports concurrency
         submittedJobs.computeIfAbsent(compactable.getExtent(), k -> new ConcurrentLinkedQueue<>())
-            .add(sjob);
+            .add(submittedJob);
       }
 
       if (!jobs.isEmpty()) {