You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Rushabh Shah (Jira)" <ji...@apache.org> on 2021/07/21 14:49:00 UTC

[jira] [Created] (HBASE-26106) AbstractFSWALProvider#getArchivedLogPath doesn't look for wal file in all oldWALs directory.

Rushabh Shah created HBASE-26106:
------------------------------------

             Summary: AbstractFSWALProvider#getArchivedLogPath doesn't look for wal file in all oldWALs directory.
                 Key: HBASE-26106
                 URL: https://issues.apache.org/jira/browse/HBASE-26106
             Project: HBase
          Issue Type: Bug
          Components: wal
    Affects Versions: 2.4.4, 3.0.0-alpha-1, 2.5.0
            Reporter: Rushabh Shah
            Assignee: Rushabh Shah


Below is the code for AbstractFSWALProvider#getArchivedLogPath

{code:java}
 public static Path getArchivedLogPath(Path path, Configuration conf) throws IOException {
    Path rootDir = CommonFSUtils.getWALRootDir(conf);
    Path oldLogDir = new Path(rootDir, HConstants.HREGION_OLDLOGDIR_NAME);
    if (conf.getBoolean(SEPARATE_OLDLOGDIR, DEFAULT_SEPARATE_OLDLOGDIR)) {
      ServerName serverName = getServerNameFromWALDirectoryName(path);
      if (serverName == null) {
        LOG.error("Couldn't locate log: " + path);
        return path;
      }
      oldLogDir = new Path(oldLogDir, serverName.getServerName());
    }
    Path archivedLogLocation = new Path(oldLogDir, path.getName());
    final FileSystem fs = CommonFSUtils.getWALFileSystem(conf);

    if (fs.exists(archivedLogLocation)) {
      LOG.info("Log " + path + " was moved to " + archivedLogLocation);
      return archivedLogLocation;
    } else {
      LOG.error("Couldn't locate log: " + path);
      return path;
    }
  }
{code}

This method is called from the following places.
[AbstractFSWALProvider#openReader|https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractFSWALProvider.java#L524]

[ReplicationSource#getFileSize|https://github.com/apache/hbase/blob/master/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java#L399]

[WALInputFormat.WALRecordReader#nextKeyValue|https://github.com/apache/hbase/blob/master/hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/WALInputFormat.java#L220]

All of the above calls are trying to find the log in archive path after they couldn't locate the wal in walsDir and they are not used for moving a log file to archive directory.
But we will look for archive path within serverName directory only if conf key is true.
Cc [~zhangduo] 





--
This message was sent by Atlassian Jira
(v8.3.4#803005)