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/12 19:57:46 UTC

[GitHub] [hbase] markrmiller commented on a change in pull request #1120: HBASE-23787: TestSyncTimeRangeTracker fails quite easily and allocate…

markrmiller commented on a change in pull request #1120: HBASE-23787: TestSyncTimeRangeTracker fails quite easily and allocate…
URL: https://github.com/apache/hbase/pull/1120#discussion_r378480422
 
 

 ##########
 File path: hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSyncTimeRangeTracker.java
 ##########
 @@ -84,23 +86,23 @@ public void run() {
     assertTrue(trr.getMin() == 0);
   }
 
-  static class RandomTestData {
-    private long[] keys = new long[NUM_KEYS];
-    private long min = Long.MAX_VALUE;
-    private long max = 0;
+ static class RandomTestData {
+    private final AtomicLongArray keys = new AtomicLongArray(NUM_KEYS);
 
 Review comment:
   Basically I ran this test a lot before and after these changes to try and confirm a fix and this is what seemed to work.
   
   Technically, even if a single thread accesses a data structure, if it is a different thread than the one that created it, you still need to publish objects correctly for multiple threads - concurrency is not required. So they need a mem barrier or to be final or to be effectively final or a 32-bit primitive(I think?).

----------------------------------------------------------------
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