tpcc-runner icon indicating copy to clipboard operation
tpcc-runner copied to clipboard

[ALL] A better implementation of rolling back in precommit function

Open rotaki opened this issue 4 years ago • 0 comments

Implement rollback in the pre-commit phase using Resource Acquisition Is Initialization (RAII) might be better to avoid redundant code.

    struct Rollback {
        Rollback(MVTO<Index>* self) : self(self) {}

        ~Rollback() {
            if (succeeded) return;
            self->remove_already_inserted()
            self->unlock_write_set()
        }

        void set_unnecessary() {
            succeeded = true;
        }

        void set_position() {

        }

        MVTO<Index>* self;
        bool succeeded = false;
        
    };

Define this object in precommit to automatically roll back changes if necessary.

rotaki avatar Oct 15 '21 05:10 rotaki