Skip to content

Changes to Hrana protocol #800

@Horusiath

Description

@Horusiath

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions