2

对于 tarantool 上的分片,我使用的是 Rocks https://github.com/tarantool/shard,它非常适合按primary索引搜索。

我有eventsprimarysecondary索引的空间。

box.schema.create_space('events')
box.space.events:create_index(
    "id", {type = 'primary', parts = {1, 'unsigned'}}
)
box.space.events:create_index(
    "secondary", {type = "tree", unique=true, parts = {2, 'str'}}
)
shard.events:insert{1, "pv.1", 3, 12345671, "uuid1"}
shard.events:insert{2, "pv.2", 3, 12345672, "uuid2"}

-- query by primary index works! and return tuple
shard.events:select{2} 

-- query by secondary index NOT work!
shard.events.index.event_hash:select('pv.2', {iterator = box.index.EQ}) 

我的问题是:

secondary对于按索引的查询分片,我必须使用什么或必须做什么?

4

0 回答 0