Function check_statement_logging

Source
async fn check_statement_logging(orig_state: &State) -> Result<(), Error>
Expand description

This currently checks only whether the statement log reports all statements to be in a finished state. (We used to have an assertion for roughly this in ExecuteContextExtra’s Drop, but that had to be removed due to https://github.com/MaterializeInc/database-issues/issues/7304)

Note that this check should succeed regardless of the statement logging sampling rate.

Ideally, we could run this at any moment successfully, but currently system restarts can mess this up: there is a buffering of statement log writes, with the buffers flushed every 5 seconds. So, if a system kill/restart comes at a bad moment, then some statements might get permanently stuck in an unfinished state in the statement log. Therefore, we currently run this only after normal .tds, but not after cluster tests and whatnot that kill/restart the system. (Also, this can take several seconds due to the 5 sec buffering, so we run this only in Nightly by default.)