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

MySQL tinyint type not handled my migrate tool #4674

Closed
andres-lowrie opened this issue Jan 25, 2020 · 2 comments · Fixed by #4842
Closed

MySQL tinyint type not handled my migrate tool #4674

andres-lowrie opened this issue Jan 25, 2020 · 2 comments · Fixed by #4842
Labels
area/tools Issues related to maintenance tools and CLI. investigate Requires further investigation kind/bug Something is broken.

Comments

@andres-lowrie
Copy link
Contributor

andres-lowrie commented Jan 25, 2020

What version of Dgraph are you using?

1.1.1

Have you tried reproducing the issue with the latest release?

I believe this is the latest release

What is the hardware spec (RAM, OS)?

Hardware Overview:

  Model Name:	MacBook Pro
  Model Identifier:	MacBookPro15,1
  Processor Name:	Intel Core i7
  Processor Speed:	2.2 GHz
  Number of Processors:	1
  Total Number of Cores:	6
  L2 Cache (per Core):	256 KB
  L3 Cache:	9 MB
  Hyper-Threading Technology:	Enabled
  Memory:	16 GB
  Boot ROM Version:	220.270.99.0.0 (iBridge: 16.16.6571.0.0,0)

Steps to reproduce the issue (command/config used to run Dgraph).

  1. Create a table in MySQL >= 8 that declares a column to be of type tinyint(1) and insert some values into it
create table foobar (
  acol tinyint(1)
);

insert into foobar (acol) values (0),(1);
  1. Setup config.properties file to connect to said instance
user = user
password = *****
db = dbname
  1. Run the migrate command
dgraph migrate --config config.properties --output_schema schema.txt --output_data sql.rdf

Expected behaviour and actual result.

Expected the the schema.txt file to include the table and column:

foobar.acol int .

The tool panics

[Decoder]: Using assembly version of decoder
Dumping table foobar
panic: detected unsupported type unknown on column acol

goroutine 1 [running]:

dgraph/cmd/migrate.getColumnValues(0xc0000ba9c0, 0x1, 0x1, 0xc0000d80b8, 0x1, 0x1, 0xc000032680, 0x1, 0xc000032680, 0x0, ...) dgraph@v1.1.1/dgraph/cmd/migrate/utils.go:122 +0x60b
dgraph/cmd/migrate.(*dumpMeta).dumpTable(0xc000443130, 0xc0000380d0, 0x6, 0x0, 0x0) dgraph@v1.1.1/dgraph/cmd/migrate/dump.go:113 +0x5fc
dgraph/cmd/migrate.(*dumpMeta).dumpTables(0xc000443130, 0x0, 0x0) dgraph@v1.1.1/dgraph/cmd/migrate/dump.go:73 +0x160
dgraph/cmd/migrate.generateSchemaAndData(0xc000443130, 0x7ffeefbff362, 0xa, 0x7ffeefbff37b, 0x7, 0x0, 0x0) dgraph@v1.1.1/dgraph/cmd/migrate/run.go:175 +0x16b
dgraph/cmd/migrate.run(0xc00044fc00, 0x0, 0x0) dgraph@v1.1.1/dgraph/cmd/migrate/run.go:119 +0x573
dgraph/cmd/migrate.init.0.func1(0xc00034a000, 0xc000044780, 0x0, 0x6) dgraph@v1.1.1/dgraph/cmd/migrate/run.go:44 +0x31
github.com/spf13/cobra.(*Command).execute(0xc00034a000, 0xc0000446c0, 0x6, 0x6, 0xc00034a000, 0xc0000446c0) github.com/spf13/cobra@v0.0.5/command.go:830 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0x5b01320, 0x0, 0x0, 0x0) github.com/spf13/cobra@v0.0.5/command.go:914 +0x2fb
github.com/spf13/cobra.(*Command).Execute(...) github.com/spf13/cobra@v0.0.5/command.go:864
github.com/dgraph-io/dgraph/dgraph/cmd.Execute() github.com/dgraph-io/dgraph@v1.1.1/dgraph/cmd/root.go:68 +0x80
main.main() github.com/dgraph-io/dgraph@v1.1.1/dgraph/main.go:73 +0xb0
@andres-lowrie
Copy link
Contributor Author

andres-lowrie commented Jan 25, 2020

Note that if the table has no data then there is no panic, the tool exits cleanly showing the following in standard output

[Decoder]: Using assembly version of decoder
Dumping table foobar
Dumping table constraints foobar

The files it produces look like this:

23 Jan 25 12:55 schema.txt
0 Jan 25 12:55 sql.rdf

and schema.txt shows the following:

foobar.acol: unknown .

@andres-lowrie
Copy link
Contributor Author

andres-lowrie commented Jan 25, 2020

I cleaned up the stack trace to make it easier to read.

Also note that my intent for this column was to use a bool however MySQL doesn't have a boolean type so it uses a tinyint instead.

Could be helpful to have the tool know as well

@MichelDiz MichelDiz added area/tools Issues related to maintenance tools and CLI. investigate Requires further investigation kind/bug Something is broken. labels Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tools Issues related to maintenance tools and CLI. investigate Requires further investigation kind/bug Something is broken.
Development

Successfully merging a pull request may close this issue.

2 participants