Auto creation of a snapshot after every Deliver gives Error: Stale data
![]()
Raj Kumar (21●15)
| asked Jul 19 '18, 12:50 a.m.
edited Aug 16 '18, 1:53 p.m. by David Lafreniere (4.8k●7) Hello All,
my code:
Need some simple piece of code how to fix above problem. |
One answer
![]()
David Lafreniere (4.8k●7)
| answered Aug 16 '18, 1:52 p.m.
FORUM MODERATOR / JAZZ DEVELOPER edited Aug 20 '18, 2:45 p.m.
You will not be able to do this. You cannot perform 'write' operations like this during an advisor because the advisor itself will not complete it's 'write' operations until the end of it's transaction. For example, a delivery of open change sets may have occurred, at which point advisors are run to 'check' (read) various states to determine if everything is acceptable to continue. Once all the advisor checks 'pass', then the deliver operation/transaction completes, which would 'write' to the database the new states of the change sets (which were closed on delivery) and it would also record the actual delivery in the target stream. Given all this, it makes sense that a StaleDataException would be thrown somewhere...
Also as a side comment, I would consider Geoffrey's response as well. I.e. you may want to consider NOT creating a snapshot, and thus a baseline on every component, for every single deliver operation. Perhaps if the use case/ need to do this is flushed out, there might be more practical workarounds available.
|
Comments
Just as a reminder, I strongly recommend not implementing this kind of post-condition, because it will flood the system with baselines. Although baselines are relatively inexpensive, they are not free, and one can in current releases of RTC easily obtain any historical configuration of a workspace or stream, without requiring a baseline/snapshot having been created.