Comments (5)
I don't remember any related changes in the go-tarantool
(but of course we could have a regression) and Tarantool 3.
At first glance it looks like the int64 values ββwere passed successfully to Tarantool 3, but it decoded/applied them incorrectly (or not as we expect).
However, we may have problems with encoding/decoding on the connector side.
It works fine for me with go-tarantool
v2.1.0 and Tarantool 3.1, so we need a little more information about the issue:
func TestInsertInt64(t *testing.T) {
conn := test_helpers.ConnectWithValidation(t, dialer, opts)
defer conn.Close()
_, err := conn.Do(NewExecuteRequest("CREATE TABLE \"q\" (\"q\" INTEGER PRIMARY KEY);")).Get()
require.NoError(t, err)
row, err := conn.Do(NewInsertRequest("q").Tuple([]interface{}{int64(1717345988)})).Get()
require.NoError(t, err)
assert.Equal(t, []interface{}{[]interface{}{int64(1717345988)}}, row)
row, err = conn.Do(NewSelectRequest("q")).Get()
require.NoError(t, err)
assert.Equal(t, []interface{}{[]interface{}{int64(1717345988)}}, row)
}
The patch for the `tarantool_test.go`
diff --git a/tarantool_test.go b/tarantool_test.go
index 03b786f..466d3bf 100644
--- a/tarantool_test.go
+++ b/tarantool_test.go
@@ -848,6 +848,22 @@ func TestFutureMultipleGetGetTyped(t *testing.T) {
}
}
+func TestInsertInt64(t *testing.T) {
+ conn := test_helpers.ConnectWithValidation(t, dialer, opts)
+ defer conn.Close()
+
+ _, err := conn.Do(NewExecuteRequest("CREATE TABLE \"q\" (\"q\" INTEGER PRIMARY KEY);")).Get()
+ require.NoError(t, err)
+
+ row, err := conn.Do(NewInsertRequest("q").Tuple([]interface{}{int64(1717345988)})).Get()
+ require.NoError(t, err)
+ assert.Equal(t, []interface{}{[]interface{}{int64(1717345988)}}, row)
+
+ row, err = conn.Do(NewSelectRequest("q")).Get()
+ require.NoError(t, err)
+ assert.Equal(t, []interface{}{[]interface{}{int64(1717345988)}}, row)
+}
+
func TestFutureMultipleGetWithError(t *testing.T) {
conn := test_helpers.ConnectWithValidation(t, dialer, opts)
defer conn.Close()
The patch for the `tarantool_test.go` with another attempt
diff --git a/config.lua b/config.lua
index 2553b94..ba6e749 100644
--- a/config.lua
+++ b/config.lua
@@ -62,6 +62,16 @@ box.once("init", function()
if_not_exists = true
})
+ local s = box.schema.space.create('q', {
+ id = 1010,
+ if_not_exists = true,
+ })
+ s:create_index('primary', {
+ type = 'tree',
+ parts = {1, 'string'},
+ if_not_exists = true
+ })
+
local s = box.schema.space.create('testintint', {
id = 619,
if_not_exists = true,
diff --git a/tarantool_test.go b/tarantool_test.go
index 03b786f..a77f787 100644
--- a/tarantool_test.go
+++ b/tarantool_test.go
@@ -848,6 +848,19 @@ func TestFutureMultipleGetGetTyped(t *testing.T) {
}
}
+func TestInsertInt64(t *testing.T) {
+ conn := test_helpers.ConnectWithValidation(t, dialer, opts)
+ defer conn.Close()
+
+ row, err := conn.Do(NewInsertRequest("q").Tuple([]interface{}{"foo", int64(1717345988)})).Get()
+ require.NoError(t, err)
+ assert.Equal(t, []interface{}{[]interface{}{"foo", int64(1717345988)}}, row)
+
+ row, err = conn.Do(NewSelectRequest("q")).Get()
+ require.NoError(t, err)
+ assert.Equal(t, []interface{}{[]interface{}{"foo", int64(1717345988)}}, row)
+}
+
func TestFutureMultipleGetWithError(t *testing.T) {
conn := test_helpers.ConnectWithValidation(t, dialer, opts)
defer conn.Close()
What do you get in a response if you select
the tuple with the go-tarantool?
What version of the go-tarantool
do you use?
What version of the Tarantool 3?
It would be great if you could to analyze the network data between go-tarantool
-> Tarantool 3 and check the transferred value by IPROTO.
Please, provide the space format/the space creation code and the insert request code (or a reproducer) to make it easier for us to check the problem.
Please, try to use go-tarantool
v2.1.0 with Tarantool 2.x and post the result.
from go-tarantool.
Oh, I have the reproducer:
diff --git a/config.lua b/config.lua
index 2553b94..4039119 100644
--- a/config.lua
+++ b/config.lua
@@ -62,6 +62,20 @@ box.once("init", function()
if_not_exists = true
})
+ local s = box.schema.space.create('q', {
+ id = 1010,
+ if_not_exists = true,
+ format = {
+ {name = "id", type = "string"},
+ {name = "age", type = "integer"},
+ },
+ })
+ s:create_index('primary', {
+ type = 'tree',
+ parts = {1, 'string'},
+ if_not_exists = true
+ })
+
local s = box.schema.space.create('testintint', {
id = 619,
if_not_exists = true,
diff --git a/tarantool_test.go b/tarantool_test.go
index 03b786f..c1b46c5 100644
--- a/tarantool_test.go
+++ b/tarantool_test.go
@@ -848,6 +848,25 @@ func TestFutureMultipleGetGetTyped(t *testing.T) {
}
}
+func TestInsertInt64(t *testing.T) {
+ conn := test_helpers.ConnectWithValidation(t, dialer, opts)
+ defer conn.Close()
+
+ row, err := conn.Do(NewInsertRequest("q").Tuple([]interface{}{"foo", int64(1717345988)})).Get()
+ require.NoError(t, err)
+ assert.Equal(t, []interface{}{[]interface{}{"foo", int64(1717345988)}}, row)
+
+ row, err = conn.Do(NewSelectRequest("q")).Get()
+ require.NoError(t, err)
+ assert.Equal(t, []interface{}{[]interface{}{"foo", int64(1717345988)}}, row)
+
+ row, err = conn.Do(NewExecuteRequest("SELECT * FROM seqscan q;")).Get()
+ require.NoError(t, err)
+ assert.Equal(t, []interface{}{[]interface{}{"foo", int8(-28)}}, row)
+}
+
func TestFutureMultipleGetWithError(t *testing.T) {
conn := test_helpers.ConnectWithValidation(t, dialer, opts)
defer conn.Close()
It's funny.
With the net.box
connector:
tarantool> conn = require('net.box'):connect("test:test@localhost:3013")
---
...
tarantool> conn.space.q:select()
---
- - ['foo', 1717345988]
...
tarantool> conn:execute("SELECT * FROM seqscan q")
---
- metadata:
- name: id
type: string
- name: age
type: integer
rows:
- ['foo', -28]
...
With the tarantool console directly:
2024-06-02 23:27:22.077 [12900] main/104/config.lua/box.load_cfg I> set 'listen' configuration option to "3013"
tarantool> box.space.q:select()
2024-06-02 23:27:37.405 [12900] main/104/config.lua C> Potentially long select from space 'q' (1010)
stack traceback:
builtin/box/schema.lua:2505: in function 'log_long_select'
builtin/box/schema.lua:2522: in function <builtin/box/schema.lua:2508>
[C]: in function 'pcall'
builtin/box/console.lua:427: in function 'eval'
builtin/box/console.lua:819: in function 'repl'
builtin/box/console.lua:870: in function 'start'
config.lua:312: in main chunk
---
- - ['foo', 1717345988]
...
tarantool> box.execute("SELECT * FROM seqscan q;")
---
- metadata:
- name: id
type: string
- name: age
type: integer
rows:
- ['foo', -28]
...
from go-tarantool.
@kokizzu , could you confirm that values that you get with box.space.q.select()
or with NewSelectRequest
the ones you expect?
If so, the problem on the Tarantool 3 side somewhere in the SQL code or we pass an unexpected type (for the SQL code) by the connector.
from go-tarantool.
3.x
box.space.plans:select()
---
- [6, '', 'program', 0, 1717346220, 1, 1717346220, 1, 0, 0, 0, 'ayaya', '', 0, 0,
0, 0, 0, 'test']
works fine
from go-tarantool.
It seems like a Tarantool's issue:
tarantool/tarantool#10084
I see two ways to make a workaround:
- Use
uint64
/uint
instead ofint64
for values >= 0 with the InsertRequest. - Use
SelectRequest
to get valid values instead of theExecuteRequest
.
I'll re-open the issue again if we can get something done here.
from go-tarantool.
Related Issues (20)
- v2: improve pool.Connect interface
- v2: broken build with `-tags go_tarantool_ssl_disable`
- Suddenly go-openssl broken for go-tarantool HOT 1
- Support IPROTO_TUPLE_FORMATS
- ci: bad file descriptor for Tarantool
- crud: typed batches HOT 2
- Support IPROTO_IS_SYNC
- Cant GetTyped if one of tarantool response keys is non-string typed HOT 4
- pool: improve pool.Connect logic
- pool: add abiliry to make a request by an instance name
- gomod: bump go to 1.20
- pool: get status of an instance via WATCH_ONCE
- Update the code to go 1.20
- go-tarantool/v2/pool.Add: no logs on single connection failure HOT 2
- Can't get space length via tarantool.crud HOT 4
- Replace no longer works as expected on v2? HOT 1
- api: add support of a batch insert request
- Add balancing strategies interface
- ci: remove macos-11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-tarantool.