Interface WALObserver
WALEdit.isEmpty()
.
RegionObserver
provides hooks for adding logic for
WALEdits in the region context during reconstruction. Defines coprocessor hooks for interacting
with operations on the WAL
. Since most implementations will
be interested in only a subset of hooks, this class uses 'default' functions to avoid having to
add unnecessary overrides. When the functions are non-empty, it's simply to satisfy the compiler
by returning value of expected (non-void) type. It is done in a way that these default
definitions act as no-op. So our suggestion to implementation would be to not call these
'default' methods from overrides. Exception Handling
For all functions, exception handling is done as follows:- Exceptions of type
IOException
are reported back to client. - For any other kind of exception:
- If the configuration
CoprocessorHost.ABORT_ON_ERROR_KEY
is set to true, then the server aborts. - Otherwise, coprocessor is removed from the server and
DoNotRetryIOException
is returned to the client.
- If the configuration
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
postWALRoll
(ObserverContext<? extends WALCoprocessorEnvironment> ctx, org.apache.hadoop.fs.Path oldPath, org.apache.hadoop.fs.Path newPath) Called after rolling the current WALdefault void
postWALWrite
(ObserverContext<? extends WALCoprocessorEnvironment> ctx, RegionInfo info, WALKey logKey, WALEdit logEdit) Called after aWALEdit
is writen to WAL.default void
preWALRoll
(ObserverContext<? extends WALCoprocessorEnvironment> ctx, org.apache.hadoop.fs.Path oldPath, org.apache.hadoop.fs.Path newPath) Called before rolling the current WALdefault void
preWALWrite
(ObserverContext<? extends WALCoprocessorEnvironment> ctx, RegionInfo info, WALKey logKey, WALEdit logEdit) Called before aWALEdit
is writen to WAL.
-
Method Details
-
preWALWrite
default void preWALWrite(ObserverContext<? extends WALCoprocessorEnvironment> ctx, RegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException Called before aWALEdit
is writen to WAL.The method is marked as deprecated in 2.0.0, but later we abstracted the WALKey interface for coprocessors, now it is OK to expose this to coprocessor users, so we revert the deprecation. But you still need to be careful while changing
WALEdit
, as when reaching here, if you add some cells to WALEdit, it will only be written to WAL but no in memstore, but when replaying you will get these cells and there are CP hooks to intercept these cells.See HBASE-28580.
- Throws:
IOException
-
postWALWrite
default void postWALWrite(ObserverContext<? extends WALCoprocessorEnvironment> ctx, RegionInfo info, WALKey logKey, WALEdit logEdit) throws IOException Called after aWALEdit
is writen to WAL.The method is marked as deprecated in 2.0.0, but later we abstracted the WALKey interface for coprocessors, now it is OK to expose this to coprocessor users, so we revert the deprecation. But you still need to be careful while changing
WALEdit
, as when reaching here, if you add some cells to WALEdit, it will only be written to WAL but no in memstore, but when replaying you will get these cells and there are CP hooks to intercept these cells.See HBASE-28580.
- Throws:
IOException
-
preWALRoll
default void preWALRoll(ObserverContext<? extends WALCoprocessorEnvironment> ctx, org.apache.hadoop.fs.Path oldPath, org.apache.hadoop.fs.Path newPath) throws IOException Called before rolling the current WAL- Parameters:
oldPath
- the path of the current wal that we are replacingnewPath
- the path of the wal we are going to create- Throws:
IOException
-
postWALRoll
default void postWALRoll(ObserverContext<? extends WALCoprocessorEnvironment> ctx, org.apache.hadoop.fs.Path oldPath, org.apache.hadoop.fs.Path newPath) throws IOException Called after rolling the current WAL- Parameters:
oldPath
- the path of the wal that we replacednewPath
- the path of the wal we have created and now is the current- Throws:
IOException
-