@InterfaceAudience.Private @InterfaceStability.Evolving public class DefaultWALProvider extends Object implements WALProvider
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
DefaultWALProvider.Reader |
static interface |
DefaultWALProvider.Writer |
| 限定符和类型 | 字段和说明 |
|---|---|
protected FSHLog |
log |
static String |
META_WAL_PROVIDER_ID
The hbase:meta region's WAL filename extension
|
static String |
SPLITTING_EXT
File Extension used while splitting an WAL into regions (HBASE-2312)
|
static String |
WAL_FILE_NAME_DELIMITER |
| 构造器和说明 |
|---|
DefaultWALProvider() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
close()
shutdown utstanding WALs and clean up any persisted state.
|
static DefaultWALProvider.Writer |
createWriter(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
boolean overwritable)
public because of FSHLog.
|
static long |
extractFileNumFromWAL(WAL wal)
It returns the file create timestamp from the file name.
|
static org.apache.hadoop.fs.Path |
getCurrentFileName(WAL wal)
return the current filename from the current wal.
|
long |
getLogFileSize()
iff the given WALFactory is using the DefaultWALProvider for meta and/or non-meta,
count the size of files (rolled and active). if either of them aren't, count 0
for that provider.
|
long |
getNumLogFiles()
iff the given WALFactory is using the DefaultWALProvider for meta and/or non-meta,
count the number of files (rolled and active). if either of them aren't, count 0
for that provider.
|
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/...
|
WAL |
getWAL(byte[] identifier,
byte[] namespace) |
static org.apache.hadoop.fs.Path |
getWALArchivePath(org.apache.hadoop.fs.Path archiveDir,
org.apache.hadoop.fs.Path p) |
static String |
getWALDirectoryName(String serverName)
Construct the directory name for all WALs on a given server.
|
static String |
getWALPrefixFromWALName(String name)
Get prefix of the log from its name, assuming WAL name in format of
log_prefix.filenumber.log_suffix @see
FSHLog.getCurrentFileName() |
List<WAL> |
getWALs() |
void |
init(WALFactory factory,
org.apache.hadoop.conf.Configuration conf,
List<WALActionsListener> listeners,
String providerId)
Set up the provider to create wals.
|
static boolean |
isMetaFile(org.apache.hadoop.fs.Path p) |
static boolean |
isMetaFile(String p) |
void |
shutdown()
persist outstanding WALs to storage and stop accepting new appends.
|
static boolean |
validateWALFilename(String filename)
A WAL file name is of the format:
<wal-name>
WAL_FILE_NAME_DELIMITER<file-creation-timestamp>[.meta]. |
protected volatile FSHLog log
public static final String META_WAL_PROVIDER_ID
public void init(WALFactory factory, org.apache.hadoop.conf.Configuration conf, List<WALActionsListener> listeners, String providerId) throws IOException
WALProviderinit 在接口中 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
nullIOExceptionpublic List<WAL> getWALs() throws IOException
getWALs 在接口中 WALProviderIOExceptionpublic WAL getWAL(byte[] identifier, byte[] namespace) throws IOException
getWAL 在接口中 WALProvideridentifier - may not be null. contents will not be altered.namespace - could be null, and will use default namespace if nullIOExceptionpublic void close()
throws IOException
WALProviderclose 在接口中 WALProviderIOExceptionpublic void shutdown()
throws IOException
WALProvidershutdown 在接口中 WALProviderIOExceptionpublic long getNumLogFiles()
getNumLogFiles 在接口中 WALProviderpublic long getLogFileSize()
getLogFileSize 在接口中 WALProviderpublic static int getNumRolledLogFiles(WAL wal)
public static org.apache.hadoop.fs.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 boolean validateWALFilename(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 String getWALDirectoryName(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(org.apache.hadoop.conf.Configuration conf, String path) throws IOException
IOExceptionpublic static ServerName getServerNameFromWALDirectoryName(org.apache.hadoop.fs.Path logFile)
logFile - public static boolean isMetaFile(org.apache.hadoop.fs.Path p)
public static boolean isMetaFile(String p)
public static DefaultWALProvider.Writer createWriter(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, boolean overwritable) throws IOException
IOExceptionpublic static String getWALPrefixFromWALName(String name)
FSHLog.getCurrentFileName()name - Name of the WAL to parsepublic static org.apache.hadoop.fs.Path getWALArchivePath(org.apache.hadoop.fs.Path archiveDir,
org.apache.hadoop.fs.Path p)
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.