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

rethinkdb dump failing #104

Closed
shuat opened this issue Mar 19, 2019 · 26 comments
Closed

rethinkdb dump failing #104

shuat opened this issue Mar 19, 2019 · 26 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@shuat
Copy link

shuat commented Mar 19, 2019

Ran the following

apt-get -y  update && apt-get install -y  python python-pip && pip install rethinkdb
I am getting the following error
root@bd07b97dd7c9:/data# rethinkdb dump -c 127.0.0.1:28015  --password-file /data/pw
Traceback (most recent call last):
  File "/usr/local/bin/rethinkdb-dump", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.4/dist-packages/rethinkdb/_dump.py", line 143, in main
    options = parse_options(argv or sys.argv[2:], prog=prog)
  File "/usr/local/lib/python3.4/dist-packages/rethinkdb/_dump.py", line 94, in parse_options
    options, args = parser.parse_args(argv)
  File "/usr/local/lib/python3.4/dist-packages/rethinkdb/utils_common.py", line 359, in parse_args
    options, args = super(CommonOptionsParser, self).parse_args(*args, **kwargs)
  File "/usr/lib/python3.4/optparse.py", line 1386, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib/python3.4/optparse.py", line 1426, in _process_args
    self._process_long_opt(rargs, values)
  File "/usr/lib/python3.4/optparse.py", line 1500, in _process_long_opt
    option.process(opt, value, values, self)
  File "/usr/lib/python3.4/optparse.py", line 778, in process
    value = self.convert_value(opt, value)
  File "/usr/lib/python3.4/optparse.py", line 770, in convert_value
    return self.check_value(opt, value)
  File "/usr/lib/python3.4/optparse.py", line 765, in check_value
    return checker(self, opt, value)
TypeError: file_contents() takes 2 positional arguments but 3 were given
@gabor-boros gabor-boros added the bug Something isn't working label Mar 19, 2019
@gabor-boros gabor-boros added this to the Release 2.4.2 milestone Mar 19, 2019
@gabor-boros
Copy link
Member

@shuat Hello, it seems that the import/dump/... commands are broken. As I have time I’ll look into this.

@shuat
Copy link
Author

shuat commented Mar 20, 2019

@gabor-boros Thanks for the quick answer. Is there any workaround for backing up my DB?

@gabor-boros
Copy link
Member

@shuat Can you confirm that you installed 2.4.1?

As I guess there is no workaround yet, except downgrading to version 2.3.x temporary.

I’ll look into the issue today or tomorrow.

@psschroeter
Copy link

Also having this issue with a slightly different option (TypeError: check_tls_option() takes exactly 2 arguments (3 given)). 2.4.0 and 2.4.1 both error out. 2.3.0 seems to work.

@gabor-boros
Copy link
Member

@psschroeter thanks for reporting, we definitely need to look into this issue as soon as we can

@gabor-boros
Copy link
Member

@psschroeter @shuat There are several issues. The first issue is that the -c flag is not working. I do not know yet why, but it is not. The second issue is that multiprocessing has no get_context in python 2.7.x.

If it is not enough, then there are other broken things as well. We have two options:

  1. Diff the changes between master and e801bb5 (this commit contains a working dump functionality but the -c flag issue is there as well).
  2. Due to the dump/import/etc.. functionalities are not tested, and not well-organized we could refactor/rewrite it from zero and write a ton of unit/integration tests around it. Although I'm not a big fan of rewrite things like this I would vote for this.

What do you think @grandquista ?

@sawdog
Copy link
Member

sawdog commented Mar 22, 2019

I'm confused again. I told you I fixed this

@gabor-boros
Copy link
Member

@sawdog here is the change what you provided: 086a768 but it does not fixed the issue

@Stilldabomb
Copy link

-p also throws an error, and for some reason it's not accepting the first argument passed to it, figured this applied to this issue.

backend git:(master) ✗ rethinkdb dump - -p
Password for `admin`:
Traceback (most recent call last):
  File "/usr/local/bin/rethinkdb-dump", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/rethinkdb/_dump.py", line 143, in main
    options = parse_options(argv or sys.argv[2:], prog=prog)
  File "/usr/local/lib/python3.7/site-packages/rethinkdb/_dump.py", line 94, in parse_options
    options, args = parser.parse_args(argv)
  File "/usr/local/lib/python3.7/site-packages/rethinkdb/utils_common.py", line 359, in parse_args
    options, args = super(CommonOptionsParser, self).parse_args(*args, **kwargs)
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/optparse.py", line 1387, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/optparse.py", line 1431, in _process_args
    self._process_short_opts(rargs, values)
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/optparse.py", line 1536, in _process_short_opts
    option.process(opt, value, values, self)
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/optparse.py", line 785, in process
    self.action, self.dest, opt, value, values, parser)
  File "/usr/local/lib/python3.7/site-packages/rethinkdb/utils_common.py", line 249, in take_action
    values[dest] = getpass.getpass('Password for `admin`: ')
TypeError: 'Values' object does not support item assignment

@sawdog
Copy link
Member

sawdog commented Mar 24, 2019

I wasn't aware we were trying for backwards compatibility with 2.7; for some reason - I dunno why.
The issue with -p is not the port; it's looking to set a password. That should be easy enough
to fix and can also account for the other args that were broken/breaking. I did not look at them all at the time. I'll try and get a look at that tomorrow. The lack of tests is really a sub optimal scenario.

@shuat
Copy link
Author

shuat commented Mar 26, 2019

@shuat Can you confirm that you installed 2.4.1?

As I guess there is no workaround yet, except downgrading to version 2.3.x temporary.

I’ll look into the issue today or tomorrow.

@gabor-boros Sorry for the slow reply
This is what I have /usr/local/lib/python3.4/dist-packages (2.4.1) So yes I have 2.4.1

@shuat
Copy link
Author

shuat commented Mar 26, 2019

@gabor-boros Where can I get an old version? Seems pip only has one version

root@bd07b97dd7c9:/data# yolk -V rethinkdb
rethinkdb 2.4.1

@gabor-boros
Copy link
Member

@shuat just pip install rethinkdb==2.3.0.post6. All the previous versions are available on PyPi (https://pypi.org/project/rethinkdb/#history)

@gabor-boros
Copy link
Member

gabor-boros commented Apr 20, 2019

@shuat @Stilldabomb @grandquista it seems that I was able to fix the issue (will be merged soon) but the first argument is not picked up. I can not locate the issue, but the workaround until we figure it out will be: rethinkdb dump - -c host:port. (please note the - after the dump/import)

@gabor-boros
Copy link
Member

The issue will be fixed by #106

@Upd4ting
Copy link

Could wee know once the update has been pushed?

@gabor-boros
Copy link
Member

I’m waiting for the review of @grandquista

@gabor-boros
Copy link
Member

So it is merged. There are 2 other issues what we should resolve before the release, but I'll keep this issue updated

@gabor-boros
Copy link
Member

All the other issues are resolved. I’ll do the release during the weekend or Monday

@gabor-boros
Copy link
Member

V2.4.2 is out containing for for this issue

@Upd4ting
Copy link

Good job!

@frafra
Copy link

frafra commented May 20, 2019

Mmm... rethinkdb-dump now requires dump as first argument, while in 2.3.0* it wasn't needed.

@andreaspeters
Copy link

andreaspeters commented Jun 25, 2019

Well, I have the same error message like @shuat.

$ rethinkdb-dump dump -c 172.23.0.2:28015  --password-file pw.txt
Traceback (most recent call last):
  File "/usr/bin/rethinkdb-dump", line 10, in <module>
    sys.exit(main())
  File "/usr/lib/python3.7/site-packages/rethinkdb/_dump.py", line 143, in main
    options = parse_options(argv or sys.argv[2:], prog=prog)
  File "/usr/lib/python3.7/site-packages/rethinkdb/_dump.py", line 94, in parse_options
    options, args = parser.parse_args(argv)
  File "/usr/lib/python3.7/site-packages/rethinkdb/utils_common.py", line 359, in parse_args
    options, args = super(CommonOptionsParser, self).parse_args(*args, **kwargs)
  File "/usr/lib/python3.7/optparse.py", line 1387, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib/python3.7/optparse.py", line 1427, in _process_args
    self._process_long_opt(rargs, values)
  File "/usr/lib/python3.7/optparse.py", line 1501, in _process_long_opt
    option.process(opt, value, values, self)
  File "/usr/lib/python3.7/optparse.py", line 779, in process
    value = self.convert_value(opt, value)
  File "/usr/lib/python3.7/optparse.py", line 771, in convert_value
    return self.check_value(opt, value)
  File "/usr/lib/python3.7/optparse.py", line 766, in check_value
    return checker(self, opt, value)
TypeError: file_contents() takes 2 positional arguments but 3 were given

And thats with the current python-rethinkdb version:

$ pip list | grep rethink
rethinkdb                                       2.4.2.post1

With the version 2.3.6 is it working quite well:

$ rethinkdb-dump -c 172.23.0.2:28015  --password-file pw.txt
NOTE: 'rethinkdb-dump' saves data and secondary indexes, but does *not* save
 cluster metadata.  You will need to recreate your cluster setup yourself after
 you run 'rethinkdb-restore'.
Exporting to directory...
[========================================] 100%
68 rows exported from 4 tables, with 0 secondary indexes
  Done (0 seconds)
Zipping export directory...
  Done (0 seconds)

@Markus00000
Copy link

Version 2.4.2.post1 does not work for me while 2.3.0.post6 does.

$ pip install rethinkdb==2.3.0.post6
[...]
$ rethinkdb dump --connect localhost:28015 --password --export test.users
NOTE: 'rethinkdb-dump' saves data and secondary indexes, but does *not* save
 cluster metadata.  You will need to recreate your cluster setup yourself after 
 you run 'rethinkdb-restore'.
Exporting to directory...
Password for `admin`: 
[========================================] 100% 
38 rows exported from 1 table, with 2 secondary indexes
  Done (0 seconds)
Zipping export directory...
  Done (0 seconds)

$ pip install rethinkdb==2.4.2.post1
[...]
$ rethinkdb dump --connect localhost:28015 --password --export test.users
Password for `admin`: 
Traceback (most recent call last):
  File "/srv/http/test/venv/bin/rethinkdb-dump", line 10, in <module>
    sys.exit(main())
  File "/srv/http/test/venv/lib/python3.5/site-packages/rethinkdb/_dump.py", line 143, in main
    options = parse_options(argv or sys.argv[2:], prog=prog)
  File "/srv/http/test/venv/lib/python3.5/site-packages/rethinkdb/_dump.py", line 94, in parse_options
    options, args = parser.parse_args(argv)
  File "/srv/http/test/venv/lib/python3.5/site-packages/rethinkdb/utils_common.py", line 359, in parse_args
    options, args = super(CommonOptionsParser, self).parse_args(*args, **kwargs)
  File "/usr/lib/python3.5/optparse.py", line 1386, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib/python3.5/optparse.py", line 1426, in _process_args
    self._process_long_opt(rargs, values)
  File "/usr/lib/python3.5/optparse.py", line 1500, in _process_long_opt
    option.process(opt, value, values, self)
  File "/usr/lib/python3.5/optparse.py", line 784, in process
    self.action, self.dest, opt, value, values, parser)
  File "/srv/http/test/venv/lib/python3.5/site-packages/rethinkdb/utils_common.py", line 249, in take_action
    values[dest] = getpass.getpass('Password for `admin`: ')
TypeError: 'Values' object does not support item assignment
$ rethinkdb dump - --connect localhost:28015 --password --export test.users
Password for `admin`: 
Traceback (most recent call last):
  File "/srv/http/test/venv/bin/rethinkdb-dump", line 10, in <module>
    sys.exit(main())
  File "/srv/http/test/venv/lib/python3.5/site-packages/rethinkdb/_dump.py", line 143, in main
    options = parse_options(argv or sys.argv[2:], prog=prog)
  File "/srv/http/test/venv/lib/python3.5/site-packages/rethinkdb/_dump.py", line 94, in parse_options
    options, args = parser.parse_args(argv)
  File "/srv/http/test/venv/lib/python3.5/site-packages/rethinkdb/utils_common.py", line 359, in parse_args
    options, args = super(CommonOptionsParser, self).parse_args(*args, **kwargs)
  File "/usr/lib/python3.5/optparse.py", line 1386, in parse_args
    stop = self._process_args(largs, rargs, values)
  File "/usr/lib/python3.5/optparse.py", line 1426, in _process_args
    self._process_long_opt(rargs, values)
  File "/usr/lib/python3.5/optparse.py", line 1500, in _process_long_opt
    option.process(opt, value, values, self)
  File "/usr/lib/python3.5/optparse.py", line 784, in process
    self.action, self.dest, opt, value, values, parser)
  File "/srv/http/test/venv/lib/python3.5/site-packages/rethinkdb/utils_common.py", line 249, in take_action
    values[dest] = getpass.getpass('Password for `admin`: ')
TypeError: 'Values' object does not support item assignment

@atomicules
Copy link

Per this comment and:

TypeError: file_contents() takes 2 positional arguments but 3 were given

It seems that what happens is --password-file gets sent twice. So from utils_common.py:

def file_contents(opt_str, value):
  • opt_str is --password-file
  • value is --password-file
  • and the third argument is the actual file location.

Don't know why that is though. Changes in optparse? Incompatibilities in python2?

For the record this is on an older version of python (2.7.6) using 2.4.2 of this driver.

@sawdog
Copy link
Member

sawdog commented Aug 8, 2019

Is this being worked on? Otherwise I can resolve it - just assigned to me.

This was referenced Sep 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests