{
ReorderBufferChange *cur_change;
- if (txn->nentries != txn->nentries_mem)
+ if (txn->serialized)
{
/* serialize remaining changes */
ReorderBufferSerializeTXN(rb, txn);
{
ReorderBufferChange *cur_change;
- if (cur_txn->nentries != cur_txn->nentries_mem)
+ if (cur_txn->serialized)
{
/* serialize remaining changes */
ReorderBufferSerializeTXN(rb, cur_txn);
Assert(found);
/* remove entries spilled to disk */
- if (txn->nentries != txn->nentries_mem)
+ if (txn->serialized)
ReorderBufferRestoreCleanup(rb, txn);
/* deallocate */
Assert(spilled == txn->nentries_mem);
Assert(dlist_is_empty(&txn->changes));
txn->nentries_mem = 0;
+ txn->serialized = true;
if (fd != -1)
CloseTransientFile(fd);
*/
uint64 nentries_mem;
+ /*
+ * Has this transaction been spilled to disk? It's not always possible to
+ * deduce that fact by comparing nentries with nentries_mem, because
+ * e.g. subtransactions of a large transaction might get serialized
+ * together with the parent - if they're restored to memory they'd have
+ * nentries_mem == nentries.
+ */
+ bool serialized;
+
/*
* List of ReorderBufferChange structs, including new Snapshots and new
* CommandIds