net.box: fix schema fetching from 1.10/2.1 servers
After 2.2.0-390-ga7c855e5b ("net.box: fetch '_vcollation' sysview into the module") net.box fetches _vcollation view unconditionally, while the view was added in 2.2.0-389-g3e3ef182f and, say, tarantool-1.10 and tarantool-2.1 do not have it. This leads to a runtime error "Space '277' does not exist" on a newer client that connects to an older server. Now the view is fetched conditionally depending of a version of a server: if it is above 2.2.1, then net.box will fetch it. Note: at the time there are no release with a number above 2.2.1. When _vcollation view is available, a collation in an index part will be shown by its name (with 'collation' field), otherwise it will be shown by its ID (in 'collation_id' field). For example: Connect to tarantool 1.10: | tarantool> connection = require('net.box').connect('localhost:3301') | --- | ... | | tarantool> connection.space.s.index.sk.parts | --- | - - type: string | is_nullable: false | collation_id: 2 | fieldno: 2 | ... Connect to tarantool 2.2.1 (when it will be released): | tarantool> connection = require('net.box').connect('localhost:3301') | --- | ... | | tarantool> connection.space.s.index.sk.parts | --- | - - type: string | is_nullable: false | collation: unicode_ci | fieldno: 2 | ... Fixes #4307.
Showing
- src/box/lua/net_box.lua 30 additions, 7 deletionssrc/box/lua/net_box.lua
- test/box/net.box.result 28 additions, 5 deletionstest/box/net.box.result
- test/box/net.box.test.lua 11 additions, 1 deletiontest/box/net.box.test.lua
- test/box/stat_net.result 7 additions, 4 deletionstest/box/stat_net.result
- test/box/stat_net.test.lua 3 additions, 2 deletionstest/box/stat_net.test.lua
Loading
Please register or sign in to comment