Closed jtaylor-sfdc closed 10 years ago
This is somewhat tricky, as it doesn't seem right to use the same timestamp as the connection. Probably better would be to have a fixed timestamp stored on the sequence itself. This is the timestamp that will always be used. If the sequence is deleted, a global counter is incremented and the next sequence created will use that timestamp. This prevents the deletion of a sequence from hiding the recreation of it.
A better alternative is to mark a sequence as deleted through the Put of PDataType.FALSE_BYTES in our QueryConstants.EMPTY_COLUMN_BYTES column. Creation would flip this back to PDataType.TRUE_BYTES and reset the CURRENT_VALUE to the starting value. In this way, we never issue a Delete and avoid the "hiding" issue and can always use the same timestamp (MetaDataProtocol.MIN_TABLE_TIMESTAMP).
Argh. The Increment APIs in HBase don't allow a timestamp to be passed through. To implement this properly, we'll need to add our own coprocessor. We can solve the lack of notification if the row being incremented doesn't exist bug as well.
Here's my take on how sequences should work:
Fixed in master
Currently SEQUENCES won't work if a connection has an SCN