Package org.apache.accumulo.tserver.log
Class DfsLogger
- java.lang.Object
-
- org.apache.accumulo.tserver.log.DfsLogger
-
- All Implemented Interfaces:
Comparable<DfsLogger>
public class DfsLogger extends Object implements Comparable<DfsLogger>
Wrap a connection to a logger.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DfsLogger.LogClosedException
static class
DfsLogger.LogHeaderIncompleteException
A well-timed tabletserver failure could result in an incomplete header written to a write-ahead log.static interface
DfsLogger.ServerResources
-
Field Summary
Fields Modifier and Type Field Description static String
LOG_FILE_HEADER_V3
static String
LOG_FILE_HEADER_V4
Simplified encryption technique supported in V4.
-
Constructor Summary
Constructors Constructor Description DfsLogger(ServerContext context, DfsLogger.ServerResources conf, String filename, String meta)
Reference a pre-existing log file.DfsLogger(ServerContext context, DfsLogger.ServerResources conf, AtomicLong syncCounter, AtomicLong flushCounter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
int
compareTo(DfsLogger o)
org.apache.accumulo.tserver.log.DfsLogger.LoggerOperation
defineTablet(CommitSession cs)
boolean
equals(Object obj)
static DataInputStream
getDecryptingStream(org.apache.hadoop.fs.FSDataInputStream input, CryptoService cryptoService)
Reads the WAL file header, and returns a decrypting stream which wraps the original stream.String
getFileName()
String
getMeta()
get the cq needed to reference this logger's entry in +r/!0org.apache.hadoop.fs.Path
getPath()
long
getWrites()
int
hashCode()
org.apache.accumulo.tserver.log.DfsLogger.LoggerOperation
log(CommitSession cs, Mutation m, Durability d)
org.apache.accumulo.tserver.log.DfsLogger.LoggerOperation
logManyTablets(Collection<TabletMutations> mutations)
org.apache.accumulo.tserver.log.DfsLogger.LoggerOperation
minorCompactionFinished(long seq, int tid, Durability durability)
org.apache.accumulo.tserver.log.DfsLogger.LoggerOperation
minorCompactionStarted(long seq, int tid, String fqfn, Durability durability)
void
open(String address)
Opens a Write-Ahead Log file and writes the necessary header information and OPEN entry to the file.String
toString()
-
-
-
Field Detail
-
LOG_FILE_HEADER_V3
public static final String LOG_FILE_HEADER_V3
- See Also:
- Constant Field Values
-
LOG_FILE_HEADER_V4
public static final String LOG_FILE_HEADER_V4
Simplified encryption technique supported in V4.- Since:
- 2.0
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DfsLogger
public DfsLogger(ServerContext context, DfsLogger.ServerResources conf, AtomicLong syncCounter, AtomicLong flushCounter)
-
DfsLogger
public DfsLogger(ServerContext context, DfsLogger.ServerResources conf, String filename, String meta)
Reference a pre-existing log file.- Parameters:
meta
- the cq for the "log" entry in +r/!0
-
-
Method Detail
-
getDecryptingStream
public static DataInputStream getDecryptingStream(org.apache.hadoop.fs.FSDataInputStream input, CryptoService cryptoService) throws DfsLogger.LogHeaderIncompleteException, IOException
Reads the WAL file header, and returns a decrypting stream which wraps the original stream. If the file is not encrypted, the original stream is returned.- Throws:
DfsLogger.LogHeaderIncompleteException
- if the header cannot be fully read (can happen if the tserver died before finishing)IOException
-
open
public void open(String address) throws IOException
Opens a Write-Ahead Log file and writes the necessary header information and OPEN entry to the file. The file is ready to be used for ingest if this method returns successfully. If an exception is thrown from this method, it is the callers responsibility to ensure thatclose()
is called to prevent leaking the file handle and/or syncing thread.- Parameters:
address
- The address of the host using this WAL- Throws:
IOException
-
getMeta
public String getMeta()
get the cq needed to reference this logger's entry in +r/!0
-
getFileName
public String getFileName()
-
getPath
public org.apache.hadoop.fs.Path getPath()
-
close
public void close() throws IOException
- Throws:
IOException
-
getWrites
public long getWrites()
-
defineTablet
public org.apache.accumulo.tserver.log.DfsLogger.LoggerOperation defineTablet(CommitSession cs) throws IOException
- Throws:
IOException
-
logManyTablets
public org.apache.accumulo.tserver.log.DfsLogger.LoggerOperation logManyTablets(Collection<TabletMutations> mutations) throws IOException
- Throws:
IOException
-
log
public org.apache.accumulo.tserver.log.DfsLogger.LoggerOperation log(CommitSession cs, Mutation m, Durability d) throws IOException
- Throws:
IOException
-
minorCompactionFinished
public org.apache.accumulo.tserver.log.DfsLogger.LoggerOperation minorCompactionFinished(long seq, int tid, Durability durability) throws IOException
- Throws:
IOException
-
minorCompactionStarted
public org.apache.accumulo.tserver.log.DfsLogger.LoggerOperation minorCompactionStarted(long seq, int tid, String fqfn, Durability durability) throws IOException
- Throws:
IOException
-
compareTo
public int compareTo(DfsLogger o)
- Specified by:
compareTo
in interfaceComparable<DfsLogger>
-
-