0

I have Tarantool with shard module and space configuration like this:

local h_box = box.schema.create_space('hotbox')
h_box:create_index('one', {type = 'hash', parts = {1, 'string'}})
h_box:create_index('two', {type = 'tree', parts = {2, 'string'}})
h_box:create_index('three', {type = 'tree', parts = {3, 'unsigned'}})
h_box:create_index('four', {type = 'tree', parts = {4, 'boolean'}})
h_box:create_index('five', {type = 'tree', parts = {5, 'unsigned'}})
h_box:create_index('six', {type = 'tree', parts = {6, 'boolean'}})

Tarantool shard module documentation says:

A shard.T:select{} request without a primary key will search all shards.

But I see error when I try calling this.

shard.h_box:select{}
---
- error: 'builtin/digest.lua:138: Usage digest.crc32(string)'
...

Also when I call shard.h_box:secondary_select{2, {limit = 10}, 'foo'} Tarantool thrown an error:

---
- error: '/usr/share/tarantool/shard/init.lua:1015: attempt to index field ''conn''
    (a nil value)'
...

How can I take all data from all shards and call selects to secondary indices?

iPhosgen
  • 53
  • 1
  • 10

1 Answers1

1

shard.T:select() cannot be performed w/o a primary key. I filed #574 against the documentation team.

Regarding secondary_select:

  1. It seems that the connection to at least one storage was broken. It worth to look at the log file of front tarantool (where shard module is used).

  2. Just in case, it worth to check that you can connect to storages and make select from spaces with the specified user using net.box.

  3. Use parenthesis instead of braces (the function accepts several arguments, not a single table).

  4. You are using e75d2c7a version of shard module, but trying to use API of more recent version. The correct request for e75d2c7a would be, say, shard.space_name:secondary_select(index_no_or_name, index_key, opts). Alternativelly try to update to the recent shard version.

  5. Indexes are counted from zero, so you tried to use 'unsigned' index 'three' with 'string' key (by the way, secondary_select allows to use index names).

  6. redundacy is set to 2, but storages count is odd. The last one will not be used.

Hope it helps.