[session] don't silently ignore commits
commits while in the precommit or postcommit phase are silently ignored.
This is OK in precommit since there'll be a commit afterwards anyway;
OTOH in postcommit it may surprise the developer who didn't read the
documentation for postcommit operations carefully enough. Related to
#4383922.
--- a/server/session.py Mon Nov 24 11:49:28 2014 +0100
+++ b/server/session.py Tue Sep 23 13:51:12 2014 +0200
@@ -1077,8 +1077,13 @@
cstate = self.commit_state
if cstate == 'uncommitable':
raise QueryError('transaction must be rolled back')
- if cstate is not None:
+ if cstate == 'precommit':
+ self.warn('calling commit in precommit makes no sense; ignoring commit')
return
+ if cstate == 'postcommit':
+ self.critical('postcommit phase is not allowed to write to the db; ignoring commit')
+ return
+ assert cstate is None
# on rollback, an operation should have the following state
# information:
# - processed by the precommit/commit event or not