Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with truncate and tnt 1.7 #32

Closed
lenkis opened this issue Feb 6, 2017 · 2 comments
Closed

Bug with truncate and tnt 1.7 #32

lenkis opened this issue Feb 6, 2017 · 2 comments
Assignees

Comments

@lenkis
Copy link

lenkis commented Feb 6, 2017

Here is a bug with Ubuntu 14.04, Tarantool version 1.7.3 (not Tarantool 1.6), Go version go1.7.5 linux/amd64

  1. Begin with a clean empty database. Start the server and execute this script, which is the same as what's in the Connectors chapter:
box.cfg{listen=3301}
box.schema.space.create('examples',{id=999})
box.space.examples:create_index('primary', {type = 'hash', parts = {1, 
'unsigned'}})
box.schema.user.grant('guest','read,write','space','examples')
box.schema.user.grant('guest','read','space','_space')
  1. Create this go program, named example.go:
package main

import (
     "fmt"
     "github.com/tarantool/go-tarantool"
)

func main() {
   opts := tarantool.Opts{User: "guest"}
   conn, err :=
   tarantool.Connect("127.0.0.1:3301", opts)
   if err != nil {
       fmt.Println("Connection refused: %s", err.Error())
   }
   resp, err := conn.Insert(999, []interface{}{99999, "BB"})
   if err != nil {
     fmt.Println("Error", err)
     fmt.Println("Code", resp.Code)
   }
}
  1. Build and run the program:
go build example.go
./example

... Notice that nothing goes wrong, there is no error.

  1. Run the program again:
./example

... Notice that there is an error, "Error Duplicate key exists in unique index", which is correct. So far everything is normal and works as expected.

  1. Back on the server, say this:
box.space.examples:truncate()
  1. Run the program again:
./example

... Notice the message. On my machine it looks like this:

pgulutzan@pgulutzan-TECRA-M10:~/tarantool-go$ ./example
panic: interface conversion: interface is nil, not bool

goroutine 1 [running]:

panic(0x520480, 0xc420066340)
  /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/tarantool/go-tarantool.(*Connection).loadSchema(0xc42006f380, 
0x556040, 0xc42006f380)
  /usr/local/go/go-tarantool/src/github.com/tarantool/go-tarantool/schema.go:136 +0xd19
github.com/tarantool/go-tarantool.Connect(0x546ce3, 0xe, 0x0, 0x0, 0x0, 
0x5456d0, 0x5, 0x0, 0x0, 0x0, ...)
  /usr/local/go/go-tarantool/src/github.com/tarantool/go-tarantool/connection.go:207 +0x65a
main.main()
  /home/pgulutzan/tarantool-go/example.go:11 +0xbb

This does not happen if I say "delete" instead of "truncate".

The only way to fix the mess is to destroy the database and start over.

I tried to produce the same problem with Tarantool 1.6 thus:

  • Change the user and password to: 'peter', password 'peter'
  • Change the data type to: 'num'

Result: no error.

@funny-falcon
Copy link

rereported to tarantool as tarantool/tarantool#2060

@funny-falcon
Copy link

BTW: github uses triple apostrophe "```" for syntax highlighting, not tuple "``"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants