@Override
  public final WAL getWAL(RegionInfo region) throws IOException {
    if (region == null) {
      return getWAL0(null);
    }
    // deal with sync replication
    Optional<Pair<String, String>> peerIdAndRemoteWALDir =
      peerInfoProvider.getPeerIdAndRemoteWALDir(region.getTable());
    if (peerIdAndRemoteWALDir.isPresent()) {
      Pair<String, String> pair = peerIdAndRemoteWALDir.get();
      WAL wal = getRemoteWAL(region, pair.getFirst(), pair.getSecond());
      if (wal != null) {
        return wal;
      }
    }
    // fallback to normal WALProvider logic
    return getWAL0(region);
  }
Base class for a WAL Provider.
<p>
We will put some common logic here, especially for sync replication implementation, as it must do
some hacks before the normal wal creation operation.
<p>
All {@link WALProvider} implementations should extends this class instead of implement
{@link WALProvider} directly, except {@link DisabledWALProvider}.
hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractWALProvider.java