[accumulo] branch main updated: Create inner class in CompactionService (#2251)

2021-08-31 Thread mmiller
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 705dfe0  Create inner class in CompactionService (#2251)
705dfe0 is described below

commit 705dfe07f3af0bfd0dc6bb0f62a01fb9a0164f37
Author: Mike Miller 
AuthorDate: Tue Aug 31 14:35:30 2021 -0400

Create inner class in CompactionService (#2251)

* Improve readability of CompactionService by creating inner class
for the implementation of PlanningParameters
---
 .../tserver/compactions/CompactionService.java | 108 +++--
 1 file changed, 59 insertions(+), 49 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 ca30011..ef19cbf 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
@@ -243,68 +243,78 @@ public class CompactionService {
 }
   }
 
-  private void planCompaction(CompactionKind kind, Compactable compactable,
-  Consumer completionCallback) {
-var files = compactable.getFiles(myId, kind);
+  private class CpPlanParams implements PlanningParameters {
+private final CompactionKind kind;
+private final Compactable comp;
+private final Compactable.Files files;
+
+public CpPlanParams(CompactionKind kind, Compactable comp, 
Compactable.Files files) {
+  this.kind = kind;
+  this.comp = comp;
+  this.files = files;
+}
 
-if (files.isEmpty() || files.get().candidates.isEmpty()) {
-  log.trace("Compactable returned no files {} {} {}", 
compactable.getExtent(), kind, files);
-  return;
+private final ServiceEnvironment senv = new 
ServiceEnvironmentImpl(context);
+
+@Override
+public TableId getTableId() {
+  return comp.getTableId();
 }
 
-PlanningParameters params = new PlanningParameters() {
+@Override
+public ServiceEnvironment getServiceEnvironment() {
+  return senv;
+}
 
-  private final ServiceEnvironment senv = new 
ServiceEnvironmentImpl(context);
+@Override
+public double getRatio() {
+  return comp.getCompactionRatio();
+}
 
-  @Override
-  public TableId getTableId() {
-return compactable.getTableId();
-  }
+@Override
+public CompactionKind getKind() {
+  return kind;
+}
 
-  @Override
-  public ServiceEnvironment getServiceEnvironment() {
-return senv;
-  }
+@Override
+public Collection getRunningCompactions() {
+  return files.compacting;
+}
 
-  @Override
-  public double getRatio() {
-return compactable.getCompactionRatio();
-  }
+@Override
+public Collection getCandidates() {
+  return files.candidates;
+}
 
-  @Override
-  public CompactionKind getKind() {
-return kind;
-  }
+@Override
+public Collection getAll() {
+  return files.allFiles;
+}
 
-  @Override
-  public Collection getRunningCompactions() {
-return files.get().compacting;
-  }
+@Override
+public Map getExecutionHints() {
+  if (kind == CompactionKind.USER)
+return files.executionHints;
+  else
+return Map.of();
+}
 
-  @Override
-  public Collection getCandidates() {
-return files.get().candidates;
-  }
+@Override
+public CompactionPlan.Builder createPlanBuilder() {
+  return new CompactionPlanImpl.BuilderImpl(kind, files.allFiles, 
files.candidates);
+}
+  }
 
-  @Override
-  public Collection getAll() {
-return files.get().allFiles;
-  }
+  private void planCompaction(CompactionKind kind, Compactable compactable,
+  Consumer completionCallback) {
+var files = compactable.getFiles(myId, kind);
 
-  @Override
-  public Map getExecutionHints() {
-if (kind == CompactionKind.USER)
-  return files.get().executionHints;
-else
-  return Map.of();
-  }
+if (files.isEmpty() || files.get().candidates.isEmpty()) {
+  log.trace("Compactable returned no files {} {} {}", 
compactable.getExtent(), kind, files);
+  return;
+}
 
-  @Override
-  public CompactionPlan.Builder createPlanBuilder() {
-return new CompactionPlanImpl.BuilderImpl(kind, files.get().allFiles,
-files.get().candidates);
-  }
-};
+PlanningParameters params = new CpPlanParams(kind, compactable, 
files.get());
 
 log.trace("Planning compactions {} {} {} {}", planner.getClass().getName(),
 compactable.getExtent(), kind, files);


[accumulo] branch main updated: Fix javadoc comment

2021-08-31 Thread mmiller
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 4b21ebe  Fix javadoc comment
4b21ebe is described below

commit 4b21ebe3d1cfe02cb60161a96b2acf238487aace
Author: Mike Miller 
AuthorDate: Tue Aug 31 12:02:19 2021 -0400

Fix javadoc comment
---
 .../java/org/apache/accumulo/core/spi/compaction/CompactionPlanner.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/core/src/main/java/org/apache/accumulo/core/spi/compaction/CompactionPlanner.java
 
b/core/src/main/java/org/apache/accumulo/core/spi/compaction/CompactionPlanner.java
index 523c65a..64d300ed 100644
--- 
a/core/src/main/java/org/apache/accumulo/core/spi/compaction/CompactionPlanner.java
+++ 
b/core/src/main/java/org/apache/accumulo/core/spi/compaction/CompactionPlanner.java
@@ -34,7 +34,7 @@ import org.apache.accumulo.core.spi.common.ServiceEnvironment;
  */
 public interface CompactionPlanner {
 
-  /*
+  /**
* This interface exists so the API can evolve and additional parameters can 
be passed to the
* method in the future.
*


[accumulo-examples] branch main updated: Update docs/rgbalancer.md

2021-08-31 Thread mmiller
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-examples.git


The following commit(s) were added to refs/heads/main by this push:
 new d1cc653  Update docs/rgbalancer.md
d1cc653 is described below

commit d1cc653e97dc2186f261c6e27ff5c1c8af7fc9d5
Author: Mike Miller 
AuthorDate: Tue Aug 31 10:47:53 2021 -0400

Update docs/rgbalancer.md
---
 docs/rgbalancer.md | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/docs/rgbalancer.md b/docs/rgbalancer.md
index 57d87eb..19bb404 100644
--- a/docs/rgbalancer.md
+++ b/docs/rgbalancer.md
@@ -28,6 +28,9 @@ different tservers.  This gives us four groups of tablets: 
01, 02, 03, and 04.
 root@accumulo> createnamespace examples
 root@accumulo> createtable examples.testRGB
 root@accumulo examples.testRGB> addsplits -t examples.testRGB 01b 01m 01r 
01z 02b 02m 02r 02z 03b 03m 03r 03z 04a 04b 04c 04d 04e 04f 04g 04h 04i 04j 04k 
04l 04m 04n 04o 04p
+
+Run the tables command with the "-l" option to find the table ID.
+
 root@accumulo examples.testRGB> tables -l
 accumulo.metadata=>!0
 accumulo.replication =>  +rep
@@ -35,7 +38,7 @@ different tservers.  This gives us four groups of tablets: 
01, 02, 03, and 04.
 testRGB  => 2
 trace=> 1
 
-After adding the splits we look at the locations in the metadata table.
+Using the table ID for part of the begin and end row scan options, look at the 
locations in the metadata table.
 
 root@accumulo examples.testRGB> scan -t accumulo.metadata -b 2; -e 2< -c 
loc
 2;01b loc:34a5f6e086b000c []ip-10-1-2-25:9997
@@ -98,7 +101,7 @@ default tablet are configured to be in group 04.
 
 root@accumulo examples.testRGB> config -t examples.testRGB -s 
table.custom.balancer.group.regex.pattern=(\d\d).*
 root@accumulo examples.testRGB> config -t examples.testRGB -s 
table.custom.balancer.group.regex.default=04
-root@accumulo examples.testRGB> config -t examples.testRGB -s 
table.balancer=org.apache.accumulo.server.master.balancer.RegexGroupBalancer
+root@accumulo examples.testRGB> config -t examples.testRGB -s 
table.balancer=org.apache.accumulo.core.spi.balancer.RegexGroupBalancer
 
 After waiting a bit, look at the tablet locations again and all is good.
 


[accumulo-examples] branch main updated: Update wording in docs/helloworld.md

2021-08-31 Thread mmiller
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-examples.git


The following commit(s) were added to refs/heads/main by this push:
 new 14858bd  Update wording in docs/helloworld.md
14858bd is described below

commit 14858bd591b185bb68f64e387e1c761520cc04e9
Author: Mike Miller 
AuthorDate: Tue Aug 31 10:19:07 2021 -0400

Update wording in docs/helloworld.md
---
 docs/helloworld.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/helloworld.md b/docs/helloworld.md
index b0d4381..88e8679 100644
--- a/docs/helloworld.md
+++ b/docs/helloworld.md
@@ -25,9 +25,9 @@ Inserts data with a BatchWriter:
 
 $ ./bin/runex helloworld.Insert
 
-On the accumulo status page at the URL below (where 'master' is replaced with 
the name or IP of your accumulo master), you should see 50K entries
+On the accumulo status page at the URL below (you may need to replace 
'localhost' with the name or IP of your server), you should see 50K entries
 
-http://master:9995/
+http://localhost:9995/
 
 To view the entries, use the shell (run `accumulo shell -u username -p 
password` to access it) to scan the table:
 


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

2021-08-31 Thread mmiller
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 
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()) {