Repository navigation
Conversation
PR 4b2 of phase 4 (the plan of phase 4, section 4.3; E6 and E7). In a Tx, an atomic statement runs through the savepoint code of Tx.savepoint, with one counter and the same rules. - Tx.exec of an atomic statement: SAVEPOINT cistern_sp_<n>, the commands, then RELEASE SAVEPOINT (in_savepoint, the body of Tx.savepoint). Each command checks the margin of the statement deadline, has the statement deadline as its flow deadline, and emits its own event. - The error of a command goes through the rules of Tx.exec (command_error): an error after which the server keeps the transaction (1062, 1406) gives ROLLBACK TO SAVEPOINT, and the Tx continues. An error of the class Fails (1213, 1020 of MariaDB, a broken connection), an implicit commit and the margin of the Tx deadline fail the Tx, with no ROLLBACK TO SAVEPOINT. The margin of an earlier statement deadline fails only the statement. - A cancel between SAVEPOINT and RELEASE fails the Tx. A cancel in a command breaks the connection, and the end aborts it. A cancel between two commands that the callback catches gives the first error Connection_lost on a healthy connection: it tells "not committed". - Exec.scope gets error: the rules of the caller emit the event of a command and give its error. - Sim rows (test_tx.ml, "atomic statements in a Tx"): the commands and their events; a 1406 and a 1062 of a child (ROLLBACK TO, the Tx continues); a 1213, a 1020 on MariaDB 11.8 and an implicit commit of a child (the Tx fails, no ROLLBACK TO); a lost reply of a child; two atomic statements and a Tx.savepoint (one counter); a failed RELEASE SAVEPOINT; the margin of a statement deadline and of the Tx deadline; the flow deadline of a command; the Tx deadline in a command (Timeout); a cancel in a command and between two commands; a value with no literal (no savepoint); no reset after a Tx with an atomic statement. - The Tx storm runs an atomic statement in 1 of 10 steps, whose second command can be a deadlock. Each command of an atomic statement that the fake server got has one event, and each seed runs atomic statements (with KILL, the sum over the seeds). - An integration row on the three servers: an atomic statement in a Tx, ROLLBACK TO SAVEPOINT after a duplicate key of a child, and the Tx commits its other rows. - DESIGN.md: "Execution of one statement" (atomic statements), "Transactions" (the savepoints), "Tests" (the Tx storm) and "Status".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
PR 4b2 of phase 4 (the plan of phase 4, section 4.3; E6 and E7). In a
Tx, an atomic statement runs through the savepoint code ofTx.savepoint, with one counter and the same rules.Tx.execof an atomic statement:SAVEPOINT cistern_sp_<n>, the commands, thenRELEASE SAVEPOINT.in_savepointis the body ofTx.savepoint. Each command checks the margin of the statement deadline, has the statement deadline as its flow deadline, and emits its own event.Tx.exec(command_error):ROLLBACK TO SAVEPOINT, and theTxcontinues.Txdeadline fail theTx, with noROLLBACK TO SAVEPOINT.SAVEPOINTandRELEASEfails theTx. A cancel in a command breaks the connection, and the end aborts it. Between two commands the connection stays usable: the cancel goes up, and the end ofDb.transactionaborts the connection. If the callback catches the cancel, the end sendsROLLBACKon the usable connection. The first error is thenConnection_loston a healthy connection: it tells only "not committed".Exec.scopegetserror: the rules of the caller emit the event of a command and give its error.DESIGN.md: "Execution of one statement", "Transactions", "Tests" and "Status".Tests
test_tx.ml, "atomic statements in a Tx"):ROLLBACK TO, and theTxcontinues.Txfails, with noROLLBACK TO.Tx.savepointuse one counter.RELEASE SAVEPOINT.Txdeadline.Txin a command:Timeout, with noROLLBACK,ROLLBACK TOorRELEASE.Invalid_value, noSAVEPOINT, and theTxcontinues.KILL, the sum over the seeds).make mutateagainstorigin/main: 34 mutants, 34 killed.nix flake check,dune buildanddune build @fmtwith no output, the opam diff,dune runtest --force,nix fmt -- --check,check-scopeandcheck-ocaml55.make sim-slowpasses.Tx:ROLLBACK TO SAVEPOINTafter a duplicate key of a child, and theTxcommits its other rows.START TRANSACTIONin aTx, a counter of its own, noROLLBACK TOafter a 1406,ROLLBACK TOafter a 1213, and aTxthat continues after a cancel.Reviews
A correctness review at a high effort, which judged the code correct and safe, also the choice not to abort the connection after a caught cancel between two commands: the
Txfails, no command is in flight, and the end sendsROLLBACKor discards the connection. Its fixes are test rows and documentation: the deadline of theTxin a command, a value with no literal, a clean connection after an atomic statement, and the meaning of the caught cancel.