Not much of a post today—just an inconclusive observation about
something odd that happened the other day. Tonight at
midnight I'm scheduled to run the code that I've been
developing for this project: 16,000 lines of SQL and SQR code
to be executed once in production, and then thrown
away. It's a little sad, really!...
So we saw something strange happen in an unrelated component.
It functioned as expected online, except for
one slight problem—the results were not saved in the
database. There were no error messages, and the "Saved"
notification appeared on the page. But when we returned
to the same page, it contained old data.
This component includes both SavePreChange and SavePostChange
PeopleCode. SavePostChange contains some custom code,
including a component interface invocation. At the very
end of the SavePostChange code is a SQLExec() update.
That SQLExec did execute successfully, but the main
transaction itself was never committed to the database.
It turns out that the component interface failed because
a view it needed had not been built. This would generally result
in an error message, but nothing appeared in this case.
This may have been because a message box is a "user think-time"
function which suspends processing, and these should not be
triggered from SavePostChange (see "Think-Time Functions"
in the PeopleCode Developer's Guide). The error message
appeared only in a trace file.
So what happened? It appears that the transaction ended
on this error and was rolled back, but for some reason the SavePostChange
PeopleCode continued. I don't fully understand this but
in the future I won't assume that execution of SavePostChange
guarantees that the transaction completed successfully.