wt-3.3.3 Transaction::~Transaction() throws
wt-3.3.3 Transaction::~Transaction() throws exctiption.
1, never throw an exception from a destructor (Meyers96: 58-61), see http://www.gotw.ca/gotw/047.htm
2, when std::uncaught_exception() is true, it maybe throw a NEW exception:
if(impl*->needsRollback* || std::uncaught_exception())
throw;//std::uncaught_exception() == true, goto here.
3, follow The Right Solution of GotW #47, Transaction::~Transaction() should call rollback() only if need it.
Let the user call commit(), so it can throw a exception to report error.
Updated by Koen Deforche almost 8 years ago
- Status changed from New to Resolved
- Assignee set to Koen Deforche
- Target version set to 3.3.4
For convenience we will auto-commit transactions. I agree there was a problem in the "no-throw" path, and I've fixed this.
However, the 'gotw #47' is general advise that is well know to us, but does not consider the specific design goal. The mentioned reasons that what we are doing is "The Wrong Solution" simply do not apply (because of the semantics of the transaction object).