virajjasani commented on a change in pull request #673: HBASE-23093 : Avoid 
Optional Anti-Pattern where possible
URL: https://github.com/apache/hbase/pull/673#discussion_r333506364
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
 ##########
 @@ -351,11 +350,11 @@ public StoreScanner(ScanInfo scanInfo, ScanType scanType,
 
   // Used to instantiate a scanner for compaction in test
   @VisibleForTesting
-  StoreScanner(ScanInfo scanInfo, OptionalInt maxVersions, ScanType scanType,
+  StoreScanner(ScanInfo scanInfo, int maxVersions, ScanType scanType,
       List<? extends KeyValueScanner> scanners) throws IOException {
     // 0 is passed as readpoint because the test bypasses Store
-    this(null, maxVersions.isPresent() ? new 
Scan().readVersions(maxVersions.getAsInt())
-        : SCAN_FOR_COMPACTION, scanInfo, 0, 0L, false, scanType);
+    this(null, maxVersions > 0 ? new Scan().readVersions(maxVersions)
 
 Review comment:
   From the code, I felt > 0 could be safe bet(this is maxVersion of Scan, 
default value is 1), btw this constructor is not being used anywhere else other 
than unit tests: TestStoreScanner.java
   Hence, is it fine to have this check?

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