-
Notifications
You must be signed in to change notification settings - Fork 38
Conversation
251075c
to
d3a3ed5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, few minor nits
let state = self.state.lock().await; | ||
Ok(match *state { | ||
State::Txn => false, | ||
State::Init | State::Invalid => true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't assume that auto-commit is true
from an invalid state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hoping that the invalid state would not occur in practice :) Assuming autocommit is safer, because it is more dangerous to execute a statement that is intended to be in transaction outside of a transaction. (I.e., it is better if the client aborts a transaction if the server reaches the invalid state.)
This PR introduces and implements version 3 of the Hrana protocol. The changes relative to Hrana 2 are as follows:
OR ROLLBACK
conflict resolution strategy), we won't execute follow up statements in autocommit mode.These additions stretch the Hrana protocol near its breaking point. At the beginning, Hrana was small and simple protocol, but it has gotten quite bloated: there are two protocols (WebSocket and HTTP), two encodings (JSON and Protobuf) and multiple ways to execute statements (
execute
request,batch
request and cursors). Future versions of Hrana should simplify the protocol.Fortunately, clients can be simpler, because they need to implement just a single combination of protocol and encoding (typically WebSocket and Protobuf).
I also rewrote the Hrana spec, so Hrana 3 is described in a single document (and not as a set of changes to the previous versions, like Hrana 2).