tursodatabase / tursodatabase/libsql

Changes to Hrana protocol

Open
#800 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

This is a discussion thread for the proposals to change the Hrana protocol. Feel free to add anything you want to discuss.

To start with:

1. Add information about state of autocommit to every response

Currently (as of #759) we do it manually, by appending GetAutocommitReq to every batch, as it's required by libsql client in order to properly inform about the state of connection as perceived by the server. We could add it to ResponseOkMsg instead.

2. Use capabilities of StoreSql at Stmt level

Currently we use StoreSqlReq to cache SQL text under a specific (stream scoped) int identifier - later on we can reuse this id to avoid sending the same SQL text around. My guess is that it was supposed to work with prepared statements.

However current protocol has significant limitations:

  1. SequenceReq that is supposed to be used for stored sql ids doesn't allow to pass parameters.
  2. It also doesn't allow to return responses.
  3. It cannot be used in batches.

The idea was to expand Stmt struct definition to enable using optional sql_id, that would work just like StoreSql command, but since it's defined at Stmt level, it could be used in all contexts that SequenceReq couldn't (meaning also all of the points above). I'm not sure how doable it is on the server side. Any feedback @MarinPostma ?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docs/HRANA_3_SPEC.md and review the discussion of ResponseOkMsg, GetAutocommitReq, StoreSqlReq, SequenceReq, and Stmt. The issue contains multiple proposals rather than a decided change; done would require an agreed protocol design and corresponding specification or implementation scope.

Written by the indexing model from the issue text.

Assessment

Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.