Cbrestore Failing with IndexError: list index out of range

Hi,

I’m trying to restore the bucket backup which taken in the CB version 4.5.0 to bucket present in CB version 4.6.0.

The restore is failing with below error,

Traceback (most recent call last):
File “/usr/lib64/python2.6/threading.py”, line 532, in __bootstrap_inner
self.run()
File “/usr/lib64/python2.6/threading.py”, line 484, in run
self.__target(*self.__args, **self.__kwargs)
File “/opt/grd/installers/opt/couchbase/lib/python/pump.py”, line 303, in run_worker
src_conf_res = source.get_conflict_resolution_type()
File “/opt/grd/installers/opt/couchbase/lib/python/pump_bfd.py”, line 430, in get_conflict_resolution_type
json_file = open(files[0], “r”)
IndexError: list index out of range

Exception in thread w1:
Traceback (most recent call last):
File “/usr/lib64/python2.6/threading.py”, line 532, in __bootstrap_inner
self.run()
File “/usr/lib64/python2.6/threading.py”, line 484, in run
self.__target(*self.__args, **self.__kwargs)
File “/opt/grd/installers/opt/couchbase/lib/python/pump.py”, line 303, in run_worker
src_conf_res = source.get_conflict_resolution_type()
File “/opt/grd/installers/opt/couchbase/lib/python/pump_bfd.py”, line 430, in get_conflict_resolution_type
json_file = open(files[0], “r”)
IndexError: list index out of range

Exception in thread w2:
Traceback (most recent call last):
File “/usr/lib64/python2.6/threading.py”, line 532, in __bootstrap_inner
self.run()
File “/usr/lib64/python2.6/threading.py”, line 484, in run
self.__target(*self.__args, **self.__kwargs)
File “/opt/grd/installers/opt/couchbase/lib/python/pump.py”, line 303, in run_worker
src_conf_res = source.get_conflict_resolution_type()
File “/opt/grd/installers/opt/couchbase/lib/python/pump_bfd.py”, line 430, in get_conflict_resolution_type
json_file = open(files[0], “r”)
IndexError: list index out of range

Can someone help on this.

Regards,
Selvi

There is (maybe) a bug in the get_conflict_resolution_type function in /opt/couchbase/lib/python/pump_bfd.py

You can manually modify function so it returns “seqno” if that list of files is empty. Or if you don’t intend to use the new conflict resolution feature you can make it unconditionally return “seqno”, though I am not too sure what that will do in the cases it was supposed to handle, probably something not good.

see https://github.com/couchbase/couchbase-cli/commit/38e3ecf9e5bf623c4216b643b0faadc4f79a2f9e#diff-8fa4dba26a01d131a6708d9fd437c858

Hey,

I am running into this problem with data from 4.6.0 and importing to 4.6.1

pump_bfd.py LINE 430 will fail because the files[0] call can result in a Nullpointer if it is empty.
( https://github.com/couchbase/couchbase-cli/blob/38e3ecf9e5bf623c4216b643b0faadc4f79a2f9e/pump_bfd.py )
This happens in my case by using something like:

/opt/couchbase/bin/cbrestore /home/cbbackup/2017-02-14T172947Z/2017-02-14T172947Z-full couchbase://Administrator:xxxxxxxxxxxxx@127.0.0.1:8091 --bucket-source=b1mojang

In my case this was fixable (not an actual fix. As far as i can tell the files-variable should never be empty?) by adding these Lines into the python file

/opt/couchbase/lib/python/pump_bfd.py LINE 428 before json_file = open(files[0], “r”)

    if not files: # kade edit
        return "seqno"

I have the same problem restoring a backup from CB 4.5.1 (community) into CB 4.6.2 (enterprise).

The fix proposed by Kademlia works for me but I doubt about how this will affect the data.

Has anyone tried the solution? Do you know if it affected the data?

I’m a little bit late to answer this question, but you have to add “-x rehash=1” to your command:

cbrestore ~/backups  http://127.0.0.1:8091  -u Administrator -p password -x rehash=1

There reason why is that Couchbase has 1024 vbuckets on most operational systems, but on Mac there are just 64 vBuckets (for optmization purposes ), so you need to rehash to redistribute the data between all vbuckets

1 Like