basis-company / tarantool-admin

MIT License
110 stars 28 forks source link

Long unsigned numbers are rounded. #34

Closed Terminator637 closed 5 years ago

Terminator637 commented 5 years ago

I got the next(correct) output in the tarantool console:

localhost:3301> box.space.main:select()
---
- - [2298275697516843974, 5, 1553784592]
  - [8951693230595564833, 3, 1553784532]
  - [8951693230595564833, 4, 1553784538]
  - [5287512909238780989, 22, 1553784521]
  - [4559792925553792320, 22, 1553783592]
  - [8951693230595564833, 5, 1553784576]
  - [2298275697516843974, 4, 1553784599]
  - [8951693230595564833, 22, 1553784531]

But in the admin i got wrong output in the first column: xxE0wJ0

All values are unsigned.

I think this is a bug.

Tremorus commented 5 years ago

You can try to paste that numbers, or bigger, to Chrome or FireFox console and see the result ;)

nekufa commented 5 years ago

@Terminator637 Looks like, javascript or php or msgpack extension can't use unsigned 64 bit numbers. In addition, I can't persist this values in tarantool via tarantoolctl.

How did you add 2298275697516843974 to the database? I need this to reproduce and determine what can be fixed :)

localhost:3301> box.info.version
---
- 1.10.2-203-g0b7078a

localhost:3301> box.schema.create_space('tester', { format = {{'id', 'unsigned'}}})
---
- engine: memtx
  before_replace: 'function: 0x4086d8b8'
  on_replace: 'function: 0x4086d890'
  field_count: 0
  temporary: false
  index: []
  is_local: false
  enabled: false
  name: tester
  id: 65046
- created
...

localhost:3301> box.space.tester:create_index('pk', {parts = {1, 'unsigned'}})
---
- unique: true
  parts:
  - type: unsigned
    is_nullable: false
    fieldno: 1
  id: 0
  space_id: 65046
  name: pk
  type: TREE

localhost:3301> box.space.tester:insert({2298275697516843974})
---
- [2298275697516844032]
...

localhost:3301> box.space.tester:select()
---
- - [2298275697516844032]
...
nekufa commented 5 years ago

I reproduce the issue and discover, that this is browser-based issue, need to investigate how we can deal with it.

Google chrome console: JSON.parse('2298275697516843974') == 2298275697516844000; // true

nekufa commented 5 years ago

fixed in 0.3.14, use latest docker build.

Terminator637 commented 5 years ago

How did you add 2298275697516843974 to the database?

localhost:3301> box.space.main:insert{2298275697516843974ULL,5,1553784592}
---
- [2298275697516843974, 5, 1553784592]
...

localhost:3301> box.space.main:select()
---
- - [2298275697516843974, 5, 1553784592]
...