Skip to content

G3: writes and transactions #118

Description

@tamnd

Milestone G3 of the GQL program (Spec/2064g/gql/plan/00-overview.md). Specs: plan/03 §7, plan/06 §4.

Blocked by P5 (#78). Blocked by G2 (#117), because writes need labels and edge properties to write.

The parser rejects CREATE, SET, DELETE, DETACH and MERGE by name, so zu is read only as far as GQL is concerned, and three whole graph-bench families produce no zu numbers at all: snb-update, linkbench and fb-write. The machinery underneath is not the problem, M3 delivered WAL, single writer commit, overlays, checkpoint, recovery and a crash injection harness, and the recovery matrix is checked in. This milestone is the statement surface over machinery that is already crash tested, plus the one genuinely new thing, which is a transaction local catalog overlay.

writes (plan/03 §7):

  • INSERT in both subquery and simple expression forms
    • standalone node patterns, with property values run through the same evaluator every other expression goes through
    • edges between the elements one INSERT creates, with the endpoint check against the tables the edge type declares
    • edges carrying properties, through the log record and the fold that hold them
    • MATCH followed by INSERT, so the write runs once for every row the clauses before it answered
    • a label that names no node table, which today is a reference error and wants catalog work to become a table
  • SET and REMOVE for properties and for labels
    • SET of a property of a node, run once per row, with the clauses after it reading what it wrote
    • SET of a property of an edge, which is addressed by the order its table holds its edges
    • SET of a whole record, which empties every property the record does not name
    • REMOVE of a property, which the binder turns into a null and the fold records in a validity mask
    • SET and REMOVE of a label the row's table already declares, which puts the bit on and takes it off the row's label word so a pattern naming it finds the row afterwards
    • SET of a label the table has not declared, which the statement declares itself, publishing the widened catalog before it stages the bit and taking the declaration back with the rows when it raises
  • DELETE and DETACH DELETE
    • DELETE of a node with no edges on it, which stages a tombstone the fold merges into the table's chain and every read filters by
    • DELETE of a node that still has edges raises G1001 rather than leaving an edge pointing at nothing
    • DETACH DELETE, which takes the edges on an element with it through a log record that names a removed edge by the rows it runs between and a fold that drops that pair out of the CSR it rebuilds
    • DELETE of an edge the statement named itself, which is the one delete that never has to refuse, and NODETACH DELETE, which is the default said out loud
  • key label set changes, which move an element between element types
  • graph type violations raise the right code and name the offending element

transactions (plan/06 §4):

  • START TRANSACTION, COMMIT, ROLLBACK as explicit statements
  • transaction characteristics, READ ONLY and READ WRITE
  • implicit transactions, committed on success and rolled back on any raising condition
  • READ ONLY enforced before any work happens, so the planner can skip write path setup
  • multiple graphs in one transaction within a catalog, cross catalog raises 40000 class rather than half committing
  • transaction local catalog overlay, merged at commit and discarded at rollback

status codes:

  • the eleven write time limit and dependent object codes of plan/07

done when:

  • GD 4 of 4 and GT 3 of 3 supported in the gql-compat report
  • the seven transactions capability skips are gone
  • crash harness green including the catalog overlay
  • snb-update, linkbench and fb-write produce zu numbers for the first time, recorded in graph-bench results/
  • bench/budgets.toml green, no regression anywhere in the comparative matrix

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    gqlISO/IEC 39075 GQL conformancemilestoneMilestone tracking issueperfPerformance and resource budgetsqueryParser, planner, executorstorageStorage engines and file formats

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions