ndimiduk commented on a change in pull request #775: HBASE-23230 Enforce member 
visibility in HRegionServer
URL: https://github.com/apache/hbase/pull/775#discussion_r341292482
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java
 ##########
 @@ -2285,42 +2245,49 @@ public void postOpenDeployTasks(final 
PostOpenDeployContext context) throws IOEx
     LOG.debug("Finished post open deploy task for " + 
r.getRegionInfo().getRegionNameAsString());
   }
 
-  @Override
-  public boolean reportRegionStateTransition(final 
RegionStateTransitionContext context) {
-    TransitionCode code = context.getCode();
-    long openSeqNum = context.getOpenSeqNum();
+  /**
+   * Helper method for use in tests. Skip the region transition report when 
there's no master
+   * around to receive it.
+   */
+  private boolean skipReportingTransition(final RegionStateTransitionContext 
context) {
+    final TransitionCode code = context.getCode();
+    final long openSeqNum = context.getOpenSeqNum();
     long masterSystemTime = context.getMasterSystemTime();
-    RegionInfo[] hris = context.getHris();
-    long[] procIds = context.getProcIds();
-
-    if (TEST_SKIP_REPORTING_TRANSITION) {
-      // This is for testing only in case there is no master
-      // to handle the region transition report at all.
-      if (code == TransitionCode.OPENED) {
-        Preconditions.checkArgument(hris != null && hris.length == 1);
-        if (hris[0].isMetaRegion()) {
-          try {
-            MetaTableLocator.setMetaLocation(getZooKeeper(), serverName,
-                hris[0].getReplicaId(),State.OPEN);
-          } catch (KeeperException e) {
-            LOG.info("Failed to update meta location", e);
-            return false;
-          }
-        } else {
-          try {
-            
MetaTableAccessor.updateRegionLocation(asyncClusterConnection.toConnection(), 
hris[0],
+    final RegionInfo[] hris = context.getHris();
+
+    if (code == TransitionCode.OPENED) {
+      Preconditions.checkArgument(hris != null && hris.length == 1);
+      if (hris[0].isMetaRegion()) {
+        try {
+          MetaTableLocator.setMetaLocation(getZooKeeper(), serverName,
+              hris[0].getReplicaId(),State.OPEN);
+        } catch (KeeperException e) {
+          LOG.info("Failed to update meta location", e);
+          return false;
+        }
+      } else {
+        try {
+          
MetaTableAccessor.updateRegionLocation(asyncClusterConnection.toConnection(), 
hris[0],
               serverName, openSeqNum, masterSystemTime);
-          } catch (IOException e) {
-            LOG.info("Failed to update meta", e);
-            return false;
-          }
+        } catch (IOException e) {
+          LOG.info("Failed to update meta", e);
+          return false;
         }
       }
-      return true;
     }
+    return true;
+  }
+
+  private ReportRegionStateTransitionRequest 
createReportRegionStateTransitionRequest(
+      final RegionStateTransitionContext context
+  ) {
 
 Review comment:
   @binlijin mentioned the same about my newline habits. You don't like the `) 
{` on their own line? I like this style because (1) it unclutters the argument 
list, when they would need to line wrap, to have each on their own line; (2) 
moving down the `) {` makes room for a `throws` clause with its list of 
exceptions; and (3) keeps indentation levels clear re: what is argument list 
and what is method body.
   
   Example with throws arguments:
   ```java
     private ReportRegionStateTransitionRequest 
createReportRegionStateTransitionRequest(
         final RegionStateTransitionContext context
     ) throws ThisException, ThatException {
       // method body
     }
   ```
   
   I don't want to rock the boat too badly for you lads, let me undo these 
radical, divergent styles ;)

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to