Closed
Description
Describe the bug
We upgraded RethinkDB from 2.3.6 to 2.4.0, and the driver accordingly, rebuilt indexes. Now, dumps generated by the most recent python driver (2.4.4.post1) fail when restoring, with every table with a primary_key
that isn't id
failing as follows:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/rethinkdb/_import.py", line 400, in read_to_queue
for batch in self.batches(warning_queue=warning_queue):
File "/usr/local/lib/python3.6/dist-packages/rethinkdb/_import.py", line 326, in batches
self.setup_table()
File "/usr/local/lib/python3.6/dist-packages/rethinkdb/_import.py", line 271, in setup_table
(self.db, self.table, primary_key, self.primary_key))
RuntimeError: Error: table mydb.settings primary key was `id` rather than the expected: name
Here is a simple info + table file from the dump:
$ cat settings.info
{"db": {"id": "adb308f5-6d96-4e56-8002-911fb0676582", "name": "mydb", "type": "DB"}, "doc_count_estimates": [2], "id": "ccaf09fa-fb79-4c95-9db1-2f1f591cd8d6", "indexes": [], "name": "settings", "primary_key": "name", "type": "TABLE", "write_hook": null}
$ cat settings.json
[
{"name": "counter", "value": 30750}
]
To Reproduce
Steps to reproduce the behavior:
- Upgrade a 2.3.6 DB to 2.4.0
- Spin up our DB:
docker run --rm -v /var/lib/rethinkdb:/data --name db -it rethinkdb
- Spin up a fresh DB:
docker run --rm --name newdb -it rethinkdb
- Get the latest rethinkdb python client:
docker run --rm --link db -v /var/lib/rethinkdb:/data -it rethinkdb bash apt update && apt install -y python3-pip && pip3 install # inside bash
- Dump the DB (inside bash):
# rethinkdb dump -c db
- Try to restore the DB:
# rethinkdb restore -c newdb $(ls rethinkdb_dump_*.tar.gz | tail -n1)
Expected behavior
The restore succeeds.
System info
- OS: Debian 9
- RethinkDB Version: 2.4.0 (as provided by docker)
- Python client version: 2.4.4.post1
Additional context
Using the 2.3.0.post6
client works fine, just like in #157