@InterfaceAudience.Private @InterfaceStability.Evolving public abstract class AbstractFSWALProvider<T extends AbstractFSWAL<?>> extends AbstractWALProvider
Modifier and Type | Class and Description |
---|---|
static interface |
AbstractFSWALProvider.Initializer |
static class |
AbstractFSWALProvider.WALStartTimeComparator
Comparator used to compare WAL files together based on their start time.
|
WALProvider.AsyncWriter, WALProvider.Writer, WALProvider.WriterBase
Modifier and Type | Field and Description |
---|---|
(package private) static String |
DEFAULT_PROVIDER_ID |
static boolean |
DEFAULT_SEPARATE_OLDLOGDIR |
private static org.slf4j.Logger |
LOG |
static String |
META_WAL_PROVIDER_ID
The hbase:meta region's WAL filename extension
|
private static long |
NO_TIMESTAMP
Define for when no timestamp found.
|
static String |
SEPARATE_OLDLOGDIR
Separate old log into different dir by regionserver name
|
private static Pattern |
SERVER_NAME_PATTERN |
static String |
SPLITTING_EXT
File Extension used while splitting an WAL into regions (HBASE-2312)
|
static Comparator<org.apache.hadoop.fs.Path> |
TIMESTAMP_COMPARATOR |
protected T |
wal |
static String |
WAL_FILE_NAME_DELIMITER |
private static Pattern |
WAL_FILE_NAME_PATTERN
Pattern used to validate a WAL file name see
validateWALFilename(String) for
description. |
private ReadWriteLock |
walCreateLock
We use walCreateLock to prevent wal recreation in different threads, and also prevent getWALs
missing the newly created WAL, see HBASE-21503 for more details.
|
abortable, conf, factory, initialized, listeners, logPrefix, providerId
DUMMY
Constructor and Description |
---|
AbstractFSWALProvider() |
Modifier and Type | Method and Description |
---|---|
void |
addWALActionsListener(WALActionsListener listener)
Add a
WALActionsListener . |
protected void |
close0() |
protected WAL |
createRemoteWAL(RegionInfo region,
org.apache.hadoop.fs.FileSystem remoteFs,
org.apache.hadoop.fs.Path remoteWALDir,
String prefix,
String suffix) |
protected abstract T |
createWAL() |
protected abstract void |
doInit(org.apache.hadoop.conf.Configuration conf) |
protected void |
doInit(WALFactory factory,
org.apache.hadoop.conf.Configuration conf,
String providerId) |
static long |
extractFileNumFromWAL(WAL wal)
It returns the file create timestamp (the 'FileNum') from the file name.
|
static org.apache.hadoop.fs.Path |
findArchivedLog(org.apache.hadoop.fs.Path path,
org.apache.hadoop.conf.Configuration conf)
Find the archived WAL file path if it is not able to locate in WALs dir.
|
static List<org.apache.hadoop.fs.Path> |
getArchivedWALFiles(org.apache.hadoop.conf.Configuration conf,
ServerName serverName,
String logPrefix)
List all the old wal files for a dead region server.
|
static org.apache.hadoop.fs.Path |
getCurrentFileName(WAL wal)
return the current filename from the current wal.
|
static long |
getLogFileSize(WAL wal)
returns the size of rolled WAL files.
|
protected long |
getLogFileSize0()
iff the given WALFactory is using the DefaultWALProvider for meta and/or non-meta, count the
size of files (only rolled).
|
protected long |
getNumLogFiles0()
iff the given WALFactory is using the DefaultWALProvider for meta and/or non-meta, count the
number of files (rolled and active).
|
static int |
getNumRolledLogFiles(WAL wal)
returns the number of rolled WAL files.
|
static ServerName |
getServerNameFromWALDirectoryName(org.apache.hadoop.conf.Configuration conf,
String path)
Pulls a ServerName out of a Path generated according to our layout rules.
|
static ServerName |
getServerNameFromWALDirectoryName(org.apache.hadoop.fs.Path logFile)
This function returns region server name from a log file name which is in one of the following
formats:
hdfs://<name node>/hbase/.logs/<server name>-splitting/...
hdfs://<name node>/hbase/.logs/<server name>/...
|
static long |
getTimestamp(String name)
Split a WAL filename to get a start time.
|
protected T |
getWAL0(RegionInfo region) |
static String |
getWALArchiveDirectoryName(org.apache.hadoop.conf.Configuration conf,
String serverName)
Construct the directory name for all old WALs on a given server.
|
static String |
getWALDirectoryName(String serverName)
Construct the directory name for all WALs on a given server.
|
static List<org.apache.hadoop.fs.Path> |
getWALFiles(org.apache.hadoop.conf.Configuration c,
ServerName serverName)
List all the wal files for a logPrefix.
|
private static String |
getWALNameGroupFromWALName(String name,
int group) |
static String |
getWALPrefixFromWALName(String name)
Get prefix of the log from its name, assuming WAL name in format of
log_prefix.filenumber.log_suffix
|
protected List<WAL> |
getWALs0() |
static boolean |
isArchivedLogFile(org.apache.hadoop.fs.Path p) |
static boolean |
isMetaFile(org.apache.hadoop.fs.Path p) |
static boolean |
isMetaFile(String p)
Returns True if String ends in
META_WAL_PROVIDER_ID |
static ServerName |
parseServerNameFromWALName(String name)
Parse the server name from wal prefix.
|
static void |
recoverLease(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.Path path) |
(package private) static void |
requestLogRoll(WAL wal)
request a log roll, but don't actually do it.
|
protected void |
shutdown0() |
static boolean |
validateWALFilename(String filename)
A WAL file name is of the format: <wal-name>
WAL_FILE_NAME_DELIMITER
<file-creation-timestamp>[.<suffix>]. |
close, getLogFileSize, getNumLogFiles, getPeerActionListener, getSyncReplicationPeerIdFromWALName, getWAL, getWALs, init, initWAL, peerSyncReplicationStateChange, setSyncReplicationPeerInfoProvider, shutdown
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getWALFileLengthProvider
private static final org.slf4j.Logger LOG
public static final String SEPARATE_OLDLOGDIR
public static final boolean DEFAULT_SEPARATE_OLDLOGDIR
protected volatile T extends AbstractFSWAL<?> wal
private final ReadWriteLock walCreateLock
public static final String WAL_FILE_NAME_DELIMITER
public static final String META_WAL_PROVIDER_ID
static final String DEFAULT_PROVIDER_ID
public static final String SPLITTING_EXT
private static final Pattern WAL_FILE_NAME_PATTERN
validateWALFilename(String)
for
description.private static final long NO_TIMESTAMP
public static final Comparator<org.apache.hadoop.fs.Path> TIMESTAMP_COMPARATOR
private static final Pattern SERVER_NAME_PATTERN
public AbstractFSWALProvider()
protected void doInit(WALFactory factory, org.apache.hadoop.conf.Configuration conf, String providerId) throws IOException
doInit
in class AbstractWALProvider
factory
- factory that made us, identity used for FS layout. may not be nullconf
- may not be nullproviderId
- differentiate between providers from one factory, used for FS layout. may be
nullIOException
protected List<WAL> getWALs0()
getWALs0
in class AbstractWALProvider
protected T getWAL0(RegionInfo region) throws IOException
getWAL0
in class AbstractWALProvider
IOException
protected abstract T createWAL() throws IOException
IOException
protected abstract void doInit(org.apache.hadoop.conf.Configuration conf) throws IOException
IOException
protected void shutdown0() throws IOException
shutdown0
in class AbstractWALProvider
IOException
protected void close0() throws IOException
close0
in class AbstractWALProvider
IOException
protected long getNumLogFiles0()
getNumLogFiles0
in class AbstractWALProvider
protected long getLogFileSize0()
getLogFileSize0
in class AbstractWALProvider
protected WAL createRemoteWAL(RegionInfo region, org.apache.hadoop.fs.FileSystem remoteFs, org.apache.hadoop.fs.Path remoteWALDir, String prefix, String suffix) throws IOException
createRemoteWAL
in class AbstractWALProvider
IOException
public static int getNumRolledLogFiles(WAL wal)
public static long getLogFileSize(WAL wal)
public static org.apache.hadoop.fs.Path getCurrentFileName(WAL wal)
static void requestLogRoll(WAL wal)
public static long extractFileNumFromWAL(WAL wal)
validateWALFilename(String)
public until remaining tests move to o.a.h.h.walwal
- must not be nullpublic static boolean validateWALFilename(String filename)
WAL_FILE_NAME_DELIMITER
<file-creation-timestamp>[.<suffix>]. provider-name is usually made up of a
server-name and a provider-idfilename
- name of the file to validatepublic static long getTimestamp(String name)
10.20.20.171%3A60020.1277499063250
where 1277499063250
is the
timestamp. Could also be a meta WAL which adds a '.meta' suffix or a synchronous replication
WAL which adds a '.syncrep' suffix. Check for these. File also may have no timestamp on it. For
example the recovered.edits files are WALs but are named in ascending order. Here is an
example: 0000000000000016310. Allow for this.name
- Name of the WAL file.NO_TIMESTAMP
.public static String getWALDirectoryName(String serverName)
hbase//WALs/kalashnikov.att.net,61634,1486865297088
.serverName
- Server name formatted as described in ServerName
.logs/1.example.org,60030,12345
if
serverName
passed is 1.example.org,60030,12345
public static String getWALArchiveDirectoryName(org.apache.hadoop.conf.Configuration conf, String serverName)
hbase/oldWALs
. If you config hbase.separate.oldlogdir.by.regionserver to
true, it looks like hbase//oldWALs/kalashnikov.att.net,61634,1486865297088
.serverName
- Server name formatted as described in ServerName
public static List<org.apache.hadoop.fs.Path> getArchivedWALFiles(org.apache.hadoop.conf.Configuration conf, ServerName serverName, String logPrefix) throws IOException
IOException
public static List<org.apache.hadoop.fs.Path> getWALFiles(org.apache.hadoop.conf.Configuration c, ServerName serverName) throws IOException
IOException
public static ServerName getServerNameFromWALDirectoryName(org.apache.hadoop.conf.Configuration conf, String path) throws IOException
IOException
public static ServerName getServerNameFromWALDirectoryName(org.apache.hadoop.fs.Path logFile)
public static boolean isMetaFile(org.apache.hadoop.fs.Path p)
public static boolean isMetaFile(String p)
META_WAL_PROVIDER_ID
public static boolean isArchivedLogFile(org.apache.hadoop.fs.Path p)
public static org.apache.hadoop.fs.Path findArchivedLog(org.apache.hadoop.fs.Path path, org.apache.hadoop.conf.Configuration conf) throws IOException
path
- - active WAL file pathconf
- - configurationIOException
- exceptionpublic static void recoverLease(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path path)
public void addWALActionsListener(WALActionsListener listener)
WALProvider
WALActionsListener
.
Notice that you must call this method before calling WALProvider.getWAL(RegionInfo)
as this method
will not effect the WAL
which has already been created. And as long as we can only it
when initialization, it is not thread safe.
addWALActionsListener
in interface WALProvider
addWALActionsListener
in class AbstractWALProvider
private static String getWALNameGroupFromWALName(String name, int group)
public static String getWALPrefixFromWALName(String name)
name
- Name of the WAL to parseIllegalArgumentException
- if the name passed in is not a valid wal file nameAbstractFSWAL.getCurrentFileName()
public static ServerName parseServerNameFromWALName(String name)
IllegalArgumentException
- if the name passed in is not started with a server nameCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.