Details
-
Brainstorming
-
Status: Closed
-
Critical
-
Resolution: Incomplete
-
0.92.2, 0.94.2, 0.95.2
-
None
-
None
Description
Discussion ticket around coprocessor pre/post semantic.
For each rpc in HMaster we have a pre/post operation that allows a coprocessor
to execute some code before and after the operation
- preOperation()
- my operation
- postOperation()
This is used for example by the AccessController to verify if the user can execute or not the operation.
Everything is fine, unless the master operation is asynchronous (like create/delete table)
- preOperation()
- executor.submit(new OperationHandler())
- postOperation()
The pre operation is still fine, since is executed before the operation and need to throw exceptions to the client in case of failures...
The post operation, instead, is no longer post... is just post submit. And if someone subscribe to postCreateTable() the notification can arrive before the table creation.
To "solve" this problem, HBASE-5584 added pre/post handlers and now the situation looks like this:
client request client response | | +------+-- submit op --+----+--- (HMaster) pre op post op (executor) +---- handler ----+ pre handler post handler
Now, we've two types of pre/post operation and the semantical correct are preOperation() and postOperationHandler()
since the preOperation() needs to reply to the client (e.g AccessController NotAllowException) and the postOperatioHandler() is really post operation.
postOperation() is not post... and preOperationHandler() can't communicate with the client.
The AccessController coprocessor uses the postOperation() that is fine for the sync operation like addColumn(), deleteColumn()... but in case of failure of async operations like deleteTable() we've removed rights that we still need.
I think that we should get back just to the single pre/post operation but with the right semantic...
Other then the "when is executed" problem, we've also functions that can be described with other simpler functions
for example: modifyTable() is just a helper to avoid multiple addColumn()/deleteColumn() calls
but the problem here is that modifyTable() has its own pre/post operation() and if I've implemented the pre/post addColumn I don't get notified when I call modifyTable(). This is another problem in the access controller coprocessor
In this case I'm not sure what the best solution can be... but in this way, adding new helper methods means breaking the coprocessors, because they don't get notified even if something is changed...
Any idea, thoughts, ...?