Interface TxnLog
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
FileTxnLog
Interface for reading transaction logs.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
an iterating interface for reading transaction logs. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Append a request to the transaction log with a digsetvoid
close()
close the transactions logsvoid
commit()
commit the transaction and make sure they are persistedlong
getDbId()
the dbid for this transaction log.long
the last zxid of the logged transactions.long
Gets the total size of all log fileslong
read
(long zxid) Start reading the transaction logs from a given zxidvoid
rollLog()
roll the current log being appended tovoid
setServerStats
(ServerStats serverStats) Setter for ServerStats to monitor fsync threshold exceedvoid
setTotalLogSize
(long size) Sets the total size of all log filesboolean
truncate
(long zxid) truncate the log to get in sync with the leader.
-
Method Details
-
setServerStats
Setter for ServerStats to monitor fsync threshold exceed- Parameters:
serverStats
- used to update fsyncThresholdExceedCount
-
rollLog
roll the current log being appended to- Throws:
IOException
-
append
Append a request to the transaction log with a digset- Parameters:
request
- the request to be appended returns true iff something appended, otw false- Throws:
IOException
-
read
Start reading the transaction logs from a given zxid- Parameters:
zxid
-- Returns:
- returns an iterator to read the next transaction in the logs.
- Throws:
IOException
-
getLastLoggedZxid
the last zxid of the logged transactions.- Returns:
- the last zxid of the logged transactions.
- Throws:
IOException
-
truncate
truncate the log to get in sync with the leader.- Parameters:
zxid
- the zxid to truncate at.- Throws:
IOException
-
getDbId
the dbid for this transaction log.- Returns:
- the dbid for this transaction log.
- Throws:
IOException
-
commit
commit the transaction and make sure they are persisted- Throws:
IOException
-
getTxnLogSyncElapsedTime
long getTxnLogSyncElapsedTime()- Returns:
- transaction log's elapsed sync time in milliseconds
-
close
close the transactions logs- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
setTotalLogSize
void setTotalLogSize(long size) Sets the total size of all log files -
getTotalLogSize
long getTotalLogSize()Gets the total size of all log files
-