Import dumped data is incomplete

I’ve encountered strange error: database created by import has incomplete number of rows compared to original database.
For instance only 58 rows of 64.
Dump command:
cockroach dump --insecure users > users.sql
Import command:
cockroach sql --insecure --database users < ~/users.sql

Hello Alexander,

  1. have you been able to identify the missing rows?

  2. can you check that the .sql file contains all the 64 rows? (We want to determine whether the problem occurred during dump or the import

  3. which version of CockroachDB are you using?

Thank you in advance

  1. Yes, it’s last 6 rows
  2. Yes it contains 64 rows
  3. v 2.0.4

Thank you, this helps.

I have two more questions, I want to be sure that all the data is sent to the server:

  • could you run again the import command but add --echo-sql

  • in the output, can you check that all the SQL commands are sent successfully to the server?

  • after the command completes, enter echo $? in your shell to get the exit code. Is it zero? (to mean, did the last SQL statement get executed)?

Thank you again

For reference this seems suspicious so I filed bug on your behalf.

However to further investigate this it would really help if you could share the generated users.sql file with us. If there is any sensitive data in there, perhaps you can reproduce the problem by replacing the sensitive data. If not we can arrange for you to communicate the file to us in a confidential manner.

Thank you

A simple and naive question:

  • I see your dump command redirects with > users.sql
  • but the import is done with <~/users.sql

Are you using the same users.sql file in both cases? Is the first command equivalent to > ~/users.sql?

OMG, it’s really the problem of loading wrong file ))
Thank you very much for pointing it out. And sorry for disturbing.

No problem, happy to help!