Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Transaction support #269

Open
jtaylor-sfdc opened this issue Jun 16, 2013 · 1 comment
Open

Transaction support #269

jtaylor-sfdc opened this issue Jun 16, 2013 · 1 comment

Comments

@jtaylor-sfdc
Copy link
Contributor

Investigate supporting transactions via Omid or perhaps a mechanism that allows for better scaling on writes, such as Snowflake.

@jtaylor-sfdc
Copy link
Contributor Author

Here are the touch points in Phoenix that would need to be tweaked in order to support a snapshot isolation approach through OMID or something similiar:

  1. Phoenix supports a way at connection time of setting the time stamp via it's CurrentSCN connection property. For an example of setting this connection property, take a look at QueryExecTest#testScan. If this property is set, then this is the time stamp that will be used for Put/Deletes as well as the being the upper bound for the time range of a scan. Since the Phoenix JDBC driver is embedded, creating a new connection is not an expensive operation.
  2. Otherwise, if this property is not set, we bind the max time range on a scan when we resolve a table reference in the FROM clause. See FromCompiler.SelectClauseVisitor#createTableRef, around line 121. The return value of the MetaDataClient#updateCache call gives us back the server-side time. This is returned from the MetaDataProtocol#getTable EndPoint coprocessor invocation which is implemented by MetaDataEndpointImpl. On the write/update side of things we make the same MetaDataClient#updateCache call to get back a time stamp from the server to use for our Puts/Deletes in MutationState#validate. So in this case, if Omid could be hooked into MetaDataEndpointImpl to get the current timestamp, that might work.
  3. For the case of UPSERT SELECT (our version of an INSERT SELECT) where you're reading and writing, we handle that in UpsertCompiler. The behavior is different, depending on whether you have auto commit on or not. This is kind of a corner case that we can talk about more about down the road, but it's kind of a hybrid on the above (1) and (2).
  4. You'd likely need to add a new EndPoint coprocessor to send row updates for a commit so that you could correctly order the transactions (does Omid do something along these lines?). These come through the MutationState#commit call now, except for the auto commit case I mentioned in (3).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant