对于tarantool上的分片,我正在使用岩石https://github.com/tarantool/shard,它非常适合按primary
索引进行搜索。
我的空格events
带有primary
密钥和secondary
索引。
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
索引我必须使用什么或者我必须为查询分片做些什么?