@InterfaceAudience.Private @InterfaceStability.Evolving public class DefaultWALProvider extends java.lang.Object implements WALProvider
| Modifier and Type | Class and Description |
|---|---|
static interface |
DefaultWALProvider.Reader |
static interface |
DefaultWALProvider.Writer |
| Modifier and Type | Field and Description |
|---|---|
protected FSHLog |
log |
static java.lang.String |
META_WAL_PROVIDER_ID
The hbase:meta region's WAL filename extension
|
static java.lang.String |
SPLITTING_EXT
File Extension used while splitting an WAL into regions (HBASE-2312)
|
static java.lang.String |
WAL_FILE_NAME_DELIMITER |
| Constructor and Description |
|---|
DefaultWALProvider() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
shutdown utstanding WALs and clean up any persisted state.
|
static DefaultWALProvider.Writer |
createWriter(Configuration conf,
FileSystem fs,
Path path,
boolean overwritable)
public because of FSHLog.
|
static long |
extractFileNumFromWAL(Path walName) |
static long |
extractFileNumFromWAL(WAL wal)
It returns the file create timestamp from the file name.
|
static Path |
getCurrentFileName(WAL wal)
return the current filename from the current wal.
|
static long |
getLogFileSize(WALFactory walFactory)
iff the given WALFactory is using the DefaultWALProvider for meta and/or non-meta,
count the size of files (rolled and active).
|
static long |
getNumLogFiles(WALFactory walFactory)
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(Configuration conf,
java.lang.String path)
Pulls a ServerName out of a Path generated according to our layout rules.
|
static ServerName |
getServerNameFromWALDirectoryName(Path logFile)
This function returns region server name from a log file name which is in one of the following
formats:
hdfs://
|
WAL |
getWAL(byte[] identifier) |
static java.lang.String |
getWALDirectoryName(java.lang.String serverName)
Construct the directory name for all WALs on a given server.
|
void |
init(WALFactory factory,
Configuration conf,
java.util.List<WALActionsListener> listeners,
java.lang.String providerId)
Set up the provider to create wals.
|
static boolean |
isMetaFile(Path p) |
void |
shutdown()
persist outstanding WALs to storage and stop accepting new appends.
|
static boolean |
validateWALFilename(java.lang.String filename)
A WAL file name is of the format:
<wal-name>
WAL_FILE_NAME_DELIMITER<file-creation-timestamp>[.meta]. |
protected FSHLog log
public static final java.lang.String WAL_FILE_NAME_DELIMITER
public static final java.lang.String META_WAL_PROVIDER_ID
public static final java.lang.String SPLITTING_EXT
public void init(WALFactory factory, Configuration conf, java.util.List<WALActionsListener> listeners, java.lang.String providerId) throws java.io.IOException
WALProviderinit in interface WALProviderfactory - factory that made us, identity used for FS layout. may not be nullconf - may not be nulllisteners - may be nullproviderId - differentiate between providers from one facotry, used for FS layout. may be
nulljava.io.IOExceptionpublic WAL getWAL(byte[] identifier) throws java.io.IOException
getWAL in interface WALProvideridentifier - may not be null. contents will not be altered.java.io.IOExceptionpublic void close()
throws java.io.IOException
WALProviderclose in interface WALProviderjava.io.IOExceptionpublic void shutdown()
throws java.io.IOException
WALProvidershutdown in interface WALProviderjava.io.IOExceptionpublic static long getNumLogFiles(WALFactory walFactory)
walFactory - may not be null.public static long getLogFileSize(WALFactory walFactory)
walFactory - may not be null.public static int getNumRolledLogFiles(WAL wal)
public static Path getCurrentFileName(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 long extractFileNumFromWAL(Path walName)
public static boolean validateWALFilename(java.lang.String filename)
WAL_FILE_NAME_DELIMITER<file-creation-timestamp>[.meta].
provider-name is usually made up of a server-name and a provider-idfilename - name of the file to validatepublic static java.lang.String getWALDirectoryName(java.lang.String serverName)
serverName - Server name formatted as described in ServerName.logs/1.example.org,60030,12345 if
serverName passed is
1.example.org,60030,12345public static ServerName getServerNameFromWALDirectoryName(Configuration conf, java.lang.String path) throws java.io.IOException
java.io.IOExceptionpublic static ServerName getServerNameFromWALDirectoryName(Path logFile)
logFile - public static boolean isMetaFile(Path p)
public static DefaultWALProvider.Writer createWriter(Configuration conf, FileSystem fs, Path path, boolean overwritable) throws java.io.IOException
java.io.IOException