busbey commented on a change in pull request #1446: HBASE-23723 Ensure MOB 
compaction works in optimized mode after snapshot clone
URL: https://github.com/apache/hbase/pull/1446#discussion_r405721446
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/mob/DefaultMobStoreCompactor.java
 ##########
 @@ -190,34 +192,71 @@ public DefaultMobStoreCompactor(Configuration conf, 
HStore store) {
     // Check if I/O optimized MOB compaction
     if (ioOptimizedMode) {
       if (request.isMajor() && request.getPriority() == HStore.PRIORITY_USER) {
-        Path mobDir =
-            MobUtils.getMobFamilyPath(conf, store.getTableName(), 
store.getColumnFamilyName());
-        List<Path> mobFiles = 
MobUtils.getReferencedMobFiles(request.getFiles(), mobDir);
-        //reset disableIO
-        disableIO.set(Boolean.FALSE);
-        if (mobFiles.size() > 0) {
-          calculateMobLengthMap(mobFiles);
+        try {
+          final SetMultimap<TableName, String> mobRefs = 
request.getFiles().stream()
+              .map(file -> {
+                byte[] value = file.getMetadataValue(HStoreFile.MOB_FILE_REFS);
+                ImmutableSetMultimap.Builder<TableName, String> builder;
+                if (value == null) {
+                  builder = ImmutableSetMultimap.builder();
+                } else {
+                  try {
+                    builder = MobUtils.deserializeMobFileRefs(value);
+                  } catch (RuntimeException exception) {
+                     throw new RuntimeException("failure getting mob 
references for hfile " + file,
+                         exception);
+                  }
+                }
+                return builder;
+              }).reduce((a, b) -> 
a.putAll(b.build())).orElseGet(ImmutableSetMultimap::builder)
+              .build();
+          //reset disableIO
+          disableIO.set(Boolean.FALSE);
 
 Review comment:
   as far as I can tell, yes this is fine. we're setting it to `false` in prep 
for the call right after to `calculateMobLengthMap` where we check each of the 
file names to see if we need to switch the flag.
   
   If instead we hit the RuntimeException from deserializing then we shouldn't 
make that call to `calculateMobLengthMap` and so we don't need to mess with the 
`disableIO` flag at all.

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