The primary key using Bit Reversed ID generates a sequence that significantly deviates from the start_with_counter #302
Labels
api: spanner
Issues related to the googleapis/ruby-spanner-activerecord API.
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
When using Bit Reversed ID for the primary key in ruby-spanner-activerecord with Cloud Spanner, I encountered an issue where the generated values significantly deviate from the values specified with start_with_counter. It seems that using Bit Reversed ID for non-PK columns does not cause any issues.
Environment details
Steps to reproduce
ActiveRecord::Persistence::ClassMethods#create
BIT_REVERSE
functionsample code:
output:
When calculating the sequence generated by
singer_id_seq
, which is used for the primary keysinger_id
, with theBIT_REVERSE
function, I expect the value to be close to thestart_with_counter
specified as 101, but the result outputs values such as 7299157174066676616 and 3724318086016960488, which are significantly different from 101.The text was updated successfully, but these errors were encountered: