You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2022/01/05 19:57:47 UTC
[GitHub] [accumulo] ctubbsii commented on a change in pull request #2408: Attempt to verify that MAC processes are up and running in start
ctubbsii commented on a change in pull request #2408:
URL: https://github.com/apache/accumulo/pull/2408#discussion_r779097891
##########
File path: minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
##########
@@ -600,6 +601,101 @@ public synchronized void start() throws IOException, InterruptedException {
if (executor == null) {
executor = Executors.newSingleThreadExecutor();
}
+
+ verifyUp();
+
+ }
+
+ private void verifyUp() throws InterruptedException, IOException {
+
+ Objects.requireNonNull(getClusterControl().managerProcess,
Review comment:
`requireNonNull` could be a static import, so these lines are shorter and slightly easier to read everywhere.
##########
File path: minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterImpl.java
##########
@@ -600,6 +601,101 @@ public synchronized void start() throws IOException, InterruptedException {
if (executor == null) {
executor = Executors.newSingleThreadExecutor();
}
+
+ verifyUp();
+
+ }
+
+ private void verifyUp() throws InterruptedException, IOException {
+
+ Objects.requireNonNull(getClusterControl().managerProcess,
+ "Error starting Manager - no process");
+ Objects.requireNonNull(getClusterControl().managerProcess.info().startInstant().get(),
+ "Error starting Manager - instance not started");
+
+ Objects.requireNonNull(getClusterControl().gcProcess, "Error starting GC - no process");
+ Objects.requireNonNull(getClusterControl().gcProcess.info().startInstant().get(),
+ "Error starting GC - instance not started");
+
+ int tsExpectedCount = 0;
+ for (Process tsp : getClusterControl().tabletServerProcesses) {
+ tsExpectedCount++;
+ Objects.requireNonNull(tsp,
+ "Error starting TabletServer " + tsExpectedCount + " - no process");
+ Objects.requireNonNull(tsp.info().startInstant().get(),
+ "Error starting TabletServer " + tsExpectedCount + "- instance not started");
+ }
+
+ String zk = config.getExistingZooKeepers() != null ? config.getExistingZooKeepers()
+ : config.getZooKeepers();
+
+ ZooReaderWriter zrw =
+ new ZooReaderWriter(zk, 30000, Property.INSTANCE_SECRET.getDefaultValue());
+
+ String instanceId = null;
+ try {
+ for (String name : zrw.getChildren(Constants.ZROOT + Constants.ZINSTANCES)) {
+ if (name.equals(config.getInstanceName())) {
+ String instanceNamePath = Constants.ZROOT + Constants.ZINSTANCES + "/" + name;
+ byte[] bytes = zrw.getData(instanceNamePath);
+ instanceId = new String(bytes, UTF_8);
+ break;
+ }
+ }
+ } catch (KeeperException e) {
+ throw new RuntimeException("Unable to read instance name from zookeeper.", e);
Review comment:
all these occurrences of `throw new RuntimeException` could use a more specific RTE that is applicable, rather than the generic parent of all RTEs. `IllegalStateException` might be appropriate.
--
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: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org