go-tarantool icon indicating copy to clipboard operation
go-tarantool copied to clipboard

Error on calling box.info function

Open pparshin opened this issue 5 years ago • 1 comments

Hi,

I'm trying to get the information about an instance calling a function box.info or returning 'box.info.replication'. As a result I got the error like that: "Error decoding packet type 0: msgp: attempted to decode type "int" with method for "str""

I suppose that library unable to parse output like vclock: {1: 1203983550}, e.g.:

  replication:
    1:
      id: 1
      uuid: 294e7310-13f0-4690-b136-169599e87ba0
      lsn: 1203755966
    2:
      id: 2
      uuid: 62f23532-0291-42bf-b133-2c9db163aef6
      lsn: 0
      upstream:
        peer: user@replication:14301
        lag: 0.00088262557983398
        status: follow
        idle: 0.3704827
    downstream:
       status: follow
       idle: 0.077566780149937
       vclock: {1: 1203983550}

For anyone who are looking for a workaround to fetch the box info use eval:

local repl = {}
for i, r in pairs(box.info.replication) do
  if r.downstream ~= nil then
    r.downstream.vclock = string.format("%s", r.downstream.vclock)
  end
  repl[r.id] = r
end
return repl

pparshin avatar Mar 30 '20 12:03 pparshin

I suppose that library unable to parse output like vclock: {1: 1203983550}

This is a known limitation of tinylib/msgp: https://github.com/tinylib/msgp/issues/257

viciious avatar Mar 31 '20 15:03 viciious