Say for example:
begin
add some object Y
read Y
commit
Does read Y see the object within the transaction?
Yes.
Is there a way to make the
search happen so that it occurs outside the transaction, IE it doesn't see
Y?
Not a nested search operation. A nested search operation will always
use the parent/context transaction.
Makes sense. Just wanted to clarify so that I understood how different apis etc
will behave within a betxn context.
Is there a piece of documentation (perhaps the plugin guide) that lists the
order in which these operations are called?
Not sure, but in general it is:
incoming operation from client
front end processing
preoperation
call backend
bepreoperation
start transaction
betxnpreoperation
do operation in the database
betxnpostoperation
end transaction
bepostoperation
return from backend
send result to client
postoperation
I found this list in the Redhat Directory Services Plugin Development guide, but
thank you for it as well.
So with the transaction, there is only one transaction that covers all betxn
plugins?
That answers some of my question. I guess the larger part of the question is
how
the plugin subsystem treats each pluginType differently and the value of
having
a plugin register to more than one pluginType. Are there some documents you
can
point me to about this?
I'm not sure if there are docs which answer your specific question. But
a plugin may want to perform tasks at different points in the
operation. For example, DNA may want to generate a unique value in the
pretxn phase, then roll back that value in the posttxn phase if the
operation failed. Replication wants to many tasks at many different
points in the operation.
That makes sense.
Again, I found some documents about this in the plugin developers guide, and
I've re-read some other plugin code so I have a better grasp of this now.
Additionally, with betxn, this seems quite black-or-white. It's either on a
ds
instance that has betxn support, so every update will be betxn capable, or
it's
not on such a system so you fall back to other methods. Is this correct?
With
new plugins is it even worth writing them without betxn support?
Correct. It is not even worth writing a new plugin without betxn
support, if it does any update to the database that depends on other
updates to the database triggered by the incoming operation from the client.
Fantastic. Thanks for the clarification.
For reference here is the plugin that this message references. It was a simple
demo to just get my head into plugin writing from scratch. I'm happy to accept
comments about it. I know that as a feature it's useless because
nsDS5ReplicaType already covers the use case, but it's a nice simple exercise
none the less.