Skip to content

Name the savepoint transitions in LibsqlConnection #210

Closed

Description

@magnusp

Goal

Name the savepoint state transitions in LibsqlConnection. Three fields encode one state machine, and the transaction-ownership rule is buried inside list manipulation.

Depends on

#195 for the duplicate-name and outermost-release pins.

Pin

LibsqlSavepointTest covers auto-commit savepoints, implicit transactions, release of the outermost savepoint, failures, and duplicates. LibsqlConnectionTest covers the transaction paths.

Scope

  • Add requireManualCommit(String action) so the rollback and release messages stay distinct.
  • Add beginSavepointTransaction, discardSavepointsAfter, and closeTransactionOwnedBySavepoint.
  • Delete executeTransactionStatement in favor of the shared send helper from the connection cleanup pass, or keep it if that pass has not landed.

Preserve

  • A savepoint in auto-commit starts a transaction without BEGIN, and releasing the outermost savepoint commits and closes the stream.
  • A failed implicit savepoint leaves auto-commit on and closes the fresh stream.
  • Rollback and release in auto-commit send nothing and name the mode in the message.
  • setSavepoint(null) throws, and setSavepoint() does not.
  • Duplicate names resolve by lastIndexOf. Keep the list.

Acceptance

  • The three state transitions are named methods, and each is called from one place.
  • LibsqlConnection.java is under 740 lines.
  • ./mvnw -pl libsql-jdbc -am test green with no assertion edited.
  • ./mvnw -pl libsql-itests -am verify green with DOCKER_CONFIG set per AGENTS.md section 4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Normal priority: edge case, feature gap, or test/process improvement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions