vinyl: fix discrepancy between vy_log.tx_size and actual tx len
When a vylog transaction is rolled back, we always reset vy_log.tx_size. Generally speaking, this is incorrect as rollback doesn't necessarily remove all pending records from the tx buffer - there still may be records committed with vy_log_tx_try_commit() that were left in the buffer due to write errors. We don't rollback such records, but we still reset tx_size, which leads to a discrepancy between vy_log.tx_size and the actual length of vy_log.tx list, which further on results in an assertion failure: src/box/vy_log.c:698: vy_log_flush: Assertion `i < vy_log.tx_size' failed. We need vy_log.tx_size to allocate xrow_header array of a proper size so that we can flush pending vylog records to disk. This isn't a hot path there, because vylog operations are rare. Besides, we iterate over all records anyway to fill the xrow_header array. That said, let's remove vy_log.tx_size altogether and instead calculate the vy_log.tx list length right in place.
Loading
Please register or sign in to comment