Apache9 commented on a change in pull request #3531:
URL: https://github.com/apache/hbase/pull/3531#discussion_r679911755



##########
File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStoreChunkPool.java
##########
@@ -240,19 +243,24 @@ public void testPutbackChunksMultiThreaded() throws 
Exception {
     ChunkCreator.instance = newCreator;// Replace the global ref with the new 
one we created.
                                              // Used it for the testing. Later 
in finally we put
                                              // back the original
+    final Throwable[] exceptions = new Throwable[1];
     final KeyValue kv = new KeyValue(Bytes.toBytes("r"), Bytes.toBytes("f"), 
Bytes.toBytes("q"),
         new byte[valSize]);
     try {
       Runnable r = new Runnable() {
         @Override
         public void run() {
-          MemStoreLAB memStoreLAB = new MemStoreLABImpl(conf);
-          for (int i = 0; i < maxCount; i++) {
-            memStoreLAB.copyCellInto(kv);// Try allocate size = chunkSize. 
Means every
-                                         // allocate call will result in a new 
chunk
+          try {
+            MemStoreLAB memStoreLAB = new MemStoreLABImpl(conf);
+            for (int i = 0; i < maxCount; i++) {
+              memStoreLAB.copyCellInto(kv);// Try allocate size = chunkSize. 
Means every

Review comment:
       Just put the comment on top of this line?

##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ChunkCreator.java
##########
@@ -228,14 +236,15 @@ Chunk getChunk(CompactingMemStore.IndexType 
chunkIndexType, int size) {
    */
   Chunk getJumboChunk(int jumboSize) {
     int allocSize = jumboSize + SIZEOF_CHUNK_HEADER;
-    if (allocSize <= dataChunksPool.getChunkSize()) {
+
+    if (allocSize <= this.getChunkSize()) {

Review comment:
       Why change from dataChunksPool.getChunkSize to getChunkSize?

##########
File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStoreChunkPool.java
##########
@@ -240,19 +243,24 @@ public void testPutbackChunksMultiThreaded() throws 
Exception {
     ChunkCreator.instance = newCreator;// Replace the global ref with the new 
one we created.
                                              // Used it for the testing. Later 
in finally we put
                                              // back the original
+    final Throwable[] exceptions = new Throwable[1];

Review comment:
       Using an AtomicReference.

##########
File path: 
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMemStoreChunkPool.java
##########
@@ -264,9 +272,151 @@ public void run() {
       t1.join();
       t2.join();
       t3.join();
-      assertTrue(newCreator.getPoolSize() <= maxCount);
+      assertTrue(exceptions[0] == null);
+      assertTrue(newCreator.getPoolSize() <= maxCount && 
newCreator.getPoolSize() > 0);
     } finally {
       ChunkCreator.instance = oldCreator;
     }
   }
+
+  @Test
+  public void testNullPointerExceptionWhenIndexChunksPollIsNullBug26142() 
throws Exception {

Review comment:
       Better give this method another name, like testNoIndexsPool or others, 
and add comment to say this is the UT for HBASE-26142, about NPE.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to