[ovirt-devel] Transactions handling in commands
Yair Zaslavsky
yzaslavs at redhat.com
Fri Nov 21 00:07:54 UTC 2014
Hello all,
During some chasing after some locks issues, I have encountered some commands that are not using the transaction framework properly (IMHO).
For example,
ExportRepoImageCommand - has no annotation indicating it should not be run in transaction.
It contains IMHO a classic flow of -
a. get from db (and potential update)
b. send a call to VDSM -> this may be long !!!
c. update results in DB.
IMHO,
ExportRepoImageCommand should be annotated with @NonTransactive(forceCompensation=true) and should include compensation code.
If I am wrong with the specific command, please add a nice comment indicating why this was not done, so the next person who reads the code and deals with locks, transactions and all these
interesting issues should be aware.
Transactions should be kept as short as possible, as they are an expensive , limited resource.
This is not the first time I encountered this issue with developers in the last weeks, and maybe I sound angry or something - this is not the intention, I can't say I know all engine code myself (and even around the infra side), and I think that one of the good things in the way we work is we can learn from each other.
If any of of you feel like they need some "reminding" on our transactions framework (and yes, I believe there is room to improvement in it, I already spoke with Oved about at least one idea) - feel free to address me, with enough audience I might even run a session when I visit TLV (I would have done it form home, but my internet condition is pretty bad, I'm afraid).
Cheers,
Yair
More information about the Devel
mailing list