You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/02/21 06:29:33 UTC

[GitHub] [hbase] mwkang opened a new pull request #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)

mwkang opened a new pull request #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)
URL: https://github.com/apache/hbase/pull/1193
 
 
   This is my first PR using github.
   If something is wrong. please let me know.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [hbase] mwkang edited a comment on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)

Posted by GitBox <gi...@apache.org>.
mwkang edited a comment on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)
URL: https://github.com/apache/hbase/pull/1193#issuecomment-590070993
 
 
   I think the current code may have different values for the two maps.
   What do you think about changing it like below?
   
   ```java
   RegionStateNode createRegionStateNode(RegionInfo regionInfo) {
     RegionStateNode node = regionsMap.computeIfAbsent(regionInfo.getRegionName(), key -> new RegionStateNod(regionInfo, regionInTransition));
     encodedRegionsMap.putIfAbsent(node.getRegionInfo().getEncodedName(), node);
     return node;
   }
   ```
   
   Also there is a remove logic, it seems safe to use a lock.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [hbase] mwkang commented on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)

Posted by GitBox <gi...@apache.org>.
mwkang commented on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)
URL: https://github.com/apache/hbase/pull/1193#issuecomment-590070993
 
 
   I think the current code may have different values for the two maps.
   What do you think about changing it like below?
   
   ```java
   RegionStateNode node = regionsMap.computeIfAbsent(regionInfo.getRegionName(),key -> new RegionStateNode(regionInfo, regionInTransition));
   encodedRegionsMap.putIfAbsent(node.getRegionInfo().getEncodedName(), node);
   return node;
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [hbase] wchevreuil merged pull request #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)

Posted by GitBox <gi...@apache.org>.
wchevreuil merged pull request #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)
URL: https://github.com/apache/hbase/pull/1193
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [hbase] Apache-HBase commented on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)

Posted by GitBox <gi...@apache.org>.
Apache-HBase commented on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)
URL: https://github.com/apache/hbase/pull/1193#issuecomment-589649121
 
 
   :confetti_ball: **+1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime | Comment |
   |:----:|----------:|--------:|:--------|
   | +0 :ok: |  reexec  |   0m 33s |  Docker mode activated.  |
   ||| _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  No case conflicting files found.  |
   | +1 :green_heart: |  hbaseanti  |   0m  0s |  Patch does not have any anti-patterns.  |
   | +1 :green_heart: |  @author  |   0m  0s |  The patch does not contain any @author tags.  |
   | -0 :warning: |  test4tests  |   0m  0s |  The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.  |
   ||| _ master Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   5m 35s |  master passed  |
   | +1 :green_heart: |  compile  |   0m 57s |  master passed  |
   | +1 :green_heart: |  checkstyle  |   1m  9s |  master passed  |
   | +1 :green_heart: |  shadedjars  |   4m 41s |  branch has no errors when building our shaded downstream artifacts.  |
   | +1 :green_heart: |  javadoc  |   0m 39s |  master passed  |
   | +0 :ok: |  spotbugs  |   4m 18s |  Used deprecated FindBugs config; considering switching to SpotBugs.  |
   | +1 :green_heart: |  findbugs  |   4m 15s |  master passed  |
   ||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   4m 58s |  the patch passed  |
   | +1 :green_heart: |  compile  |   0m 57s |  the patch passed  |
   | +1 :green_heart: |  javac  |   0m 57s |  the patch passed  |
   | +1 :green_heart: |  checkstyle  |   1m  4s |  the patch passed  |
   | +1 :green_heart: |  whitespace  |   0m  0s |  The patch has no whitespace issues.  |
   | +1 :green_heart: |  shadedjars  |   4m 43s |  patch has no errors when building our shaded downstream artifacts.  |
   | +1 :green_heart: |  hadoopcheck  |  16m  2s |  Patch does not cause any errors with Hadoop 2.8.5 2.9.2 or 3.1.2.  |
   | +1 :green_heart: |  javadoc  |   0m 37s |  the patch passed  |
   | +1 :green_heart: |  findbugs  |   4m 26s |  the patch passed  |
   ||| _ Other Tests _ |
   | +1 :green_heart: |  unit  |  64m 58s |  hbase-server in the patch passed.  |
   | +1 :green_heart: |  asflicense  |   0m 38s |  The patch does not generate ASF License warnings.  |
   |  |   | 122m 46s |   |
   
   
   | Subsystem | Report/Notes |
   |----------:|:-------------|
   | Docker | Client=19.03.6 Server=19.03.6 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1193/2/artifact/out/Dockerfile |
   | GITHUB PR | https://github.com/apache/hbase/pull/1193 |
   | Optional Tests | dupname asflicense javac javadoc unit spotbugs findbugs shadedjars hadoopcheck hbaseanti checkstyle compile |
   | uname | Linux 15416d7d2cb0 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | /home/jenkins/jenkins-slave/workspace/Base-PreCommit-GitHub-PR_PR-1193/out/precommit/personality/provided.sh |
   | git revision | master / fe0d49bc52 |
   | Default Java | 1.8.0_181 |
   |  Test Results | https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1193/2/testReport/ |
   | Max. process+thread count | 9839 (vs. ulimit of 10000) |
   | modules | C: hbase-server U: hbase-server |
   | Console output | https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1193/2/console |
   | versions | git=2.11.0 maven=2018-06-17T18:33:14Z) findbugs=3.1.11 |
   | Powered by | Apache Yetus 0.11.1 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [hbase] mwkang edited a comment on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)

Posted by GitBox <gi...@apache.org>.
mwkang edited a comment on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)
URL: https://github.com/apache/hbase/pull/1193#issuecomment-590070993
 
 
   I think the current code may have different values for the two maps.
   What do you think about changing it like below?
   
   ```java
   RegionStateNode createRegionStateNode(RegionInfo regionInfo) {
     synchronized (regionsMapLock) {
       RegionStateNode node = regionsMap.computeIfAbsent(regionInfo.getRegionName(), key -> new RegionStateNod(regionInfo, regionInTransition));
       encodedRegionsMap.putIfAbsent(node.getRegionInfo().getEncodedName(), node);
       return node;
     }
   }
   ```
   
   Also there is a remove logic, it seems safe to use a synchronized.
   ```java
   public void deleteRegion(final RegionInfo regionInfo) {
     synchronized (regionsMapLock) {
       RegionStateNode removeNode = regionsMap.remove(regionInfo.getRegionName());
       encodedRegionsMap.remove(regionInfo.getEncodedName(), removeNode);
     }
   
     // ...
   }
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [hbase] mwkang edited a comment on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)

Posted by GitBox <gi...@apache.org>.
mwkang edited a comment on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)
URL: https://github.com/apache/hbase/pull/1193#issuecomment-590070993
 
 
   I think the current code may have different values for the two maps.
   What do you think about changing it like below?
   
   ```java
   RegionStateNode createRegionStateNode(RegionInfo regionInfo) {
     synchronized (regionsMapLock) {
       RegionStateNode node = regionsMap.computeIfAbsent(regionInfo.getRegionName(), key -> new RegionStateNod(regionInfo, regionInTransition));
       encodedRegionsMap.putIfAbsent(node.getRegionInfo().getEncodedName(), node);
       return node;
     }
   }
   ```
   
   Also there is a remove logic, it seems safe to use a synchronized.
   ```java
   public void deleteRegion(final RegionInfo regionInfo) {
     synchronized (regionsMapLock) {
       regionsMap.remove(regionInfo.getRegionName());
       encodedRegionsMap.remove(regionInfo.getEncodedName());
     }
   
     // ...
   }
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [hbase] mwkang edited a comment on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)

Posted by GitBox <gi...@apache.org>.
mwkang edited a comment on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)
URL: https://github.com/apache/hbase/pull/1193#issuecomment-590069862
 
 
   @saintstack I think it looks okay. However, I am not sure only a single thread accessing them. And as you have already mentioned, If I want to synchronize two maps, I should use synchronize or locks. It was my mistake. I didn't think about it then. Should do I use synchronized or locks?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [hbase] Apache-HBase commented on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)

Posted by GitBox <gi...@apache.org>.
Apache-HBase commented on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)
URL: https://github.com/apache/hbase/pull/1193#issuecomment-589556561
 
 
   :broken_heart: **-1 overall**
   
   
   
   
   
   
   | Vote | Subsystem | Runtime | Comment |
   |:----:|----------:|--------:|:--------|
   | +0 :ok: |  reexec  |   2m  4s |  Docker mode activated.  |
   ||| _ Prechecks _ |
   | +1 :green_heart: |  dupname  |   0m  0s |  No case conflicting files found.  |
   | +1 :green_heart: |  hbaseanti  |   0m  0s |  Patch does not have any anti-patterns.  |
   | +1 :green_heart: |  @author  |   0m  0s |  The patch does not contain any @author tags.  |
   | -0 :warning: |  test4tests  |   0m  0s |  The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.  |
   ||| _ master Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   5m 37s |  master passed  |
   | +1 :green_heart: |  compile  |   0m 57s |  master passed  |
   | +1 :green_heart: |  checkstyle  |   1m  7s |  master passed  |
   | +1 :green_heart: |  shadedjars  |   4m 40s |  branch has no errors when building our shaded downstream artifacts.  |
   | +1 :green_heart: |  javadoc  |   0m 37s |  master passed  |
   | +0 :ok: |  spotbugs  |   4m 15s |  Used deprecated FindBugs config; considering switching to SpotBugs.  |
   | +1 :green_heart: |  findbugs  |   4m 14s |  master passed  |
   ||| _ Patch Compile Tests _ |
   | +1 :green_heart: |  mvninstall  |   4m 59s |  the patch passed  |
   | +1 :green_heart: |  compile  |   0m 59s |  the patch passed  |
   | +1 :green_heart: |  javac  |   0m 59s |  the patch passed  |
   | +1 :green_heart: |  checkstyle  |   1m  8s |  the patch passed  |
   | +1 :green_heart: |  whitespace  |   0m  0s |  The patch has no whitespace issues.  |
   | +1 :green_heart: |  shadedjars  |   4m 42s |  patch has no errors when building our shaded downstream artifacts.  |
   | +1 :green_heart: |  hadoopcheck  |  16m 10s |  Patch does not cause any errors with Hadoop 2.8.5 2.9.2 or 3.1.2.  |
   | +1 :green_heart: |  javadoc  |   0m 38s |  the patch passed  |
   | +1 :green_heart: |  findbugs  |   4m 14s |  the patch passed  |
   ||| _ Other Tests _ |
   | -1 :x: |  unit  |  65m  8s |  hbase-server in the patch failed.  |
   | +1 :green_heart: |  asflicense  |   0m 35s |  The patch does not generate ASF License warnings.  |
   |  |   | 124m 29s |   |
   
   
   | Subsystem | Report/Notes |
   |----------:|:-------------|
   | Docker | Client=19.03.6 Server=19.03.6 base: https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1193/1/artifact/out/Dockerfile |
   | GITHUB PR | https://github.com/apache/hbase/pull/1193 |
   | Optional Tests | dupname asflicense javac javadoc unit spotbugs findbugs shadedjars hadoopcheck hbaseanti checkstyle compile |
   | uname | Linux 4718f2be10ea 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 GNU/Linux |
   | Build tool | maven |
   | Personality | /home/jenkins/jenkins-slave/workspace/Base-PreCommit-GitHub-PR_PR-1193/out/precommit/personality/provided.sh |
   | git revision | master / fe0d49bc52 |
   | Default Java | 1.8.0_181 |
   | unit | https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1193/1/artifact/out/patch-unit-hbase-server.txt |
   |  Test Results | https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1193/1/testReport/ |
   | Max. process+thread count | 9750 (vs. ulimit of 10000) |
   | modules | C: hbase-server U: hbase-server |
   | Console output | https://builds.apache.org/job/HBase-PreCommit-GitHub-PR/job/PR-1193/1/console |
   | versions | git=2.11.0 maven=2018-06-17T18:33:14Z) findbugs=3.1.11 |
   | Powered by | Apache Yetus 0.11.1 https://yetus.apache.org |
   
   
   This message was automatically generated.
   
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [hbase] wchevreuil commented on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)

Posted by GitBox <gi...@apache.org>.
wchevreuil commented on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)
URL: https://github.com/apache/hbase/pull/1193#issuecomment-589727097
 
 
   Got a green, let me merge this PR. Thanks for the contribution, @mwkang !

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [hbase] mwkang edited a comment on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)

Posted by GitBox <gi...@apache.org>.
mwkang edited a comment on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)
URL: https://github.com/apache/hbase/pull/1193#issuecomment-590070993
 
 
   I think the current code may have different values for the two maps.
   What do you think about changing it like below?
   
   ```java
   // ...
   
   private final Object regionsMapLock = new Object();
   
   // ...
   
   RegionStateNode createRegionStateNode(RegionInfo regionInfo) {
     synchronized (regionsMapLock) {
       RegionStateNode node = regionsMap.computeIfAbsent(regionInfo.getRegionName(), key -> new RegionStateNod(regionInfo, regionInTransition));
       encodedRegionsMap.putIfAbsent(node.getRegionInfo().getEncodedName(), node);
       return node;
     }
   }
   ```
   
   Also there is a remove logic, it seems safe to use a synchronized.
   ```java
   public void deleteRegion(final RegionInfo regionInfo) {
     synchronized (regionsMapLock) {
       RegionStateNode removeNode = regionsMap.remove(regionInfo.getRegionName());
       encodedRegionsMap.remove(regionInfo.getEncodedName(), removeNode);
     }
   
     // ...
   }
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [hbase] mwkang edited a comment on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)

Posted by GitBox <gi...@apache.org>.
mwkang edited a comment on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)
URL: https://github.com/apache/hbase/pull/1193#issuecomment-590070993
 
 
   I think the current code may have different values for the two maps.
   What do you think about changing it like below?
   
   ```java
   RegionStateNode createRegionStateNode(RegionInfo regionInfo) {
     RegionStateNode node = regionsMap.computeIfAbsent(regionInfo.getRegionName(), key -> new RegionStateNod(regionInfo, regionInTransition));
     encodedRegionsMap.putIfAbsent(node.getRegionInfo().getEncodedName(), node);
     return node;
   }
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [hbase] mwkang commented on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)

Posted by GitBox <gi...@apache.org>.
mwkang commented on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)
URL: https://github.com/apache/hbase/pull/1193#issuecomment-590069862
 
 
   @saintstack I think it looks okay. However, I am not sure only a single thread accessing them. And as you have already mentioned, If I want to synchronize two maps, I should use synchronize or locks. It was my mistake. I didn't think about it then. Should do I use synchronization or locks?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [hbase] mwkang edited a comment on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)

Posted by GitBox <gi...@apache.org>.
mwkang edited a comment on issue #1193: HBASE-23561 Look up of Region in Master by encoded region name is O(n)
URL: https://github.com/apache/hbase/pull/1193#issuecomment-590070993
 
 
   I think the current code may have different values for the two maps.
   What do you think about changing it like below?
   
   ```java
   RegionStateNode createRegionStateNode(RegionInfo regionInfo) {
     RegionStateNode node = regionsMap.computeIfAbsent(regionInfo.getRegionName(), key -> new RegionStateNod(regionInfo, regionInTransition));
     encodedRegionsMap.putIfAbsent(node.getRegionInfo().getEncodedName(), node);
     return node;
   }
   ```
   
   Also there is a remove logic, it seems safe to use a synchronized.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services