Search code examples
tarantool

Why sophia doesn't start?


When i use tarantool (memtx) all work, but when i try run same on sophia - it doesn't work ;(

memtx:

logs_space_id           = 'logs'
logs  = box.schema.create_space(logs_space_id)
logs:create_index('primary', {type = 'tree', parts = {1, 'STR', 3, 'STR'}})

Why sophia does't work ?

logs_space_id           = 'logs'
log_space = box.schema.space.create(logs_space_id,
    {
        engine = 'sophia',
        if_not_exists = true
    }
)

log_space:create_index('primary', {
        parts = {1, 'STR', 3, 'STR'}
    }
)

Solution

  • Composite index key parts with Tarantool Sophia engine must start from first and cannot be sparse.

    Eg.

    logs:create_index('primary', {type = 'tree', parts = {1, 'STR', 3, 'STR'}})
    

    Should be used as

    logs:create_index('primary', {type = 'tree', parts = {1, 'STR', 2, 'STR'}})
    

    This is implemented for performance reasons and will be fixed in future.