Skip to content

Commit

Permalink
Change bucket_id function (#3)
Browse files Browse the repository at this point in the history
Change bucket_id_mpcrc32 -> bucket_id_strcrc32
  • Loading branch information
dokshina authored Sep 23, 2020
1 parent 1828432 commit 97835b9
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ across the cluster.
**Notes:**

* A space should have a format.
* `bucket_id` is computed as `vshard.router.bucket_id_mpcrc32(key)`,
* `bucket_id` is computed as `vshard.router.bucket_id_strcrc32(key)`,
where `key` is the primary key value.

### Insert
Expand Down
2 changes: 1 addition & 1 deletion crud/delete.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function delete.call(space_name, key, opts)
key = key:totable()
end

local bucket_id = vshard.router.bucket_id_mpcrc32(key)
local bucket_id = vshard.router.bucket_id_strcrc32(key)
local replicaset, err = vshard.router.route(bucket_id)
if replicaset == nil then
return nil, DeleteError:new("Failed to get replicaset for bucket_id %s: %s", bucket_id, err.err)
Expand Down
2 changes: 1 addition & 1 deletion crud/get.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function get.call(space_name, key, opts)
key = key:totable()
end

local bucket_id = vshard.router.bucket_id_mpcrc32(key)
local bucket_id = vshard.router.bucket_id_strcrc32(key)

local replicaset, err = vshard.router.route(bucket_id)
if replicaset == nil then
Expand Down
2 changes: 1 addition & 1 deletion crud/insert.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function insert.call(space_name, obj, opts)

local key = utils.extract_key(tuple, space.index[0].parts)

local bucket_id = vshard.router.bucket_id_mpcrc32(key)
local bucket_id = vshard.router.bucket_id_strcrc32(key)
local replicaset, err = vshard.router.route(bucket_id)
if replicaset == nil then
return nil, InsertError:new("Failed to get replicaset for bucket_id %s: %s", bucket_id, err.err)
Expand Down
2 changes: 1 addition & 1 deletion crud/select.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ local function get_replicasets_to_select_from(plan, all_replicasets)

plan.scanner.limit = 1

local bucket_id = vshard.router.bucket_id_mpcrc32(plan.scanner.value)
local bucket_id = vshard.router.bucket_id_strcrc32(plan.scanner.value)
local replicaset, err = vshard.router.route(bucket_id)
if replicaset == nil then
return nil, GetReplicasetsError:new("Failed to get replicaset for bucket_id %s: %s", bucket_id, err.err)
Expand Down
2 changes: 1 addition & 1 deletion crud/update.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function update.call(space_name, key, user_operations, opts)
return nil, UpdateError:new("Wrong operations are specified: %s", err)
end

local bucket_id = vshard.router.bucket_id_mpcrc32(key)
local bucket_id = vshard.router.bucket_id_strcrc32(key)
local replicaset, err = vshard.router.route(bucket_id)
if replicaset == nil then
return nil, UpdateError:new("Failed to get replicaset for bucket_id %s: %s", bucket_id, err.err)
Expand Down

0 comments on commit 97835b9

Please sign in to comment.