infraio commented on a change in pull request #330: HBASE-22617 Recovered WAL 
directories not getting cleaned up
URL: https://github.com/apache/hbase/pull/330#discussion_r296582355
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
 ##########
 @@ -1015,16 +1014,24 @@ private long initializeRegionInternals(final 
CancelableProgressable reporter,
     // (particularly if no recovered edits, seqid will be -1).
     long nextSeqId = maxSeqId + 1;
     if (!isRestoredRegion) {
-      long maxSeqIdFromFile = 
WALSplitUtil.getMaxRegionSequenceId(getWalFileSystem(),
-        getWALRegionDirOfDefaultReplica());
+      // always get openSeqNum from the default replica, even if we are 
secondary replicas
+      long maxSeqIdFromFile = WALSplitUtil.getMaxRegionSequenceId(conf,
+        RegionReplicaUtil.getRegionInfoForDefaultReplica(getRegionInfo()), 
this::getFilesystem,
+        this::getWalFileSystem);
       nextSeqId = Math.max(maxSeqId, maxSeqIdFromFile) + 1;
       // The openSeqNum will always be increase even for read only region, as 
we rely on it to
-      // determine whether a region has been successfully reopend, so here we 
always need to update
+      // determine whether a region has been successfully reopendd, so here we 
always need to update
 
 Review comment:
   typo. reopened.

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