Error while parsing secondary index info string

while restoring aerospike backup taken from AS 4.x to AS 6.x i am getting below error

2023-01-23 13:20:28 GMT [INF] [11083] Restoring 38 secondary index(es)
2023-01-23 13:20:28 GMT [ERR] [11083] Invalid path type string
2023-01-23 13:20:28 GMT [ERR] [11083] Error while parsing secondary index info string ns=test:indexname=Campaign_lineItemId_IDX:set=Campaign:bin=lineItemId:type=string:indextype=default:context=null:state=RW
2023-01-23 13:20:28 GMT [ERR] [11083] Error while checking index test:Campaign:Campaign_lineItemId_IDX (lineItemId)
2023-01-23 13:20:28 GMT [ERR] [11083] Error while restoring secondary indexes to cluster
2023-01-23 13:20:29 GMT [INF] [11101] 0 UDF file(s), 0 secondary index(es), 0 record(s) (0 KiB/s, 0 rec/s, 0 B/rec, backed off: 0)

When i skip restoring index, restoration is working fine. Is there a way to fix this?

Did you use the asbackup and asrestore from the same tools package? Which version of the tools / asbackup did you use? There were changes around sindex backup file format. I noticed this Jira:

  • [TOOLS-2263] - (ASBACKUP) Backup file format changed for sindexes starting in asbackup 3.12.0.

That is addressed in the 8.0.2 tools package. But from the error message described, I am not sure this is related to your issue… If urgent, you can always recreate the sindex manually but if you provide the version details for asbackup or the tools package used, we could check to see whether there are some known compatibility issues.

asbackup --version

Aerospike Backup Utility

Version 3.2.9

C Client Version 4.3.20

Copyright 2015-2017 Aerospike. All rights reserved.

taking dump from 4.5.0.3 and restoring to 6.2.0.2

dump and restore are being done on same machine hence same package.

Would you be able to try it with the latest asbackup version?

i did try, the latest version was not able to connect to AS 4.x. It was saying version incompatibility.

Ah… didn’t realize this. Not sure if backing up with the asbackup that shipped with 4.5 and restoring with the asrestore that shipped with 6.2. This may still not work, I am not sure, and may not be practical to try. Let me see if I figure something internally… (just for reference, I have opened an internal Jira: TOOLS-2338).

the data restore seems to be working fine. facing issues only with index restore. Please let me know if we need to be cautious around data restore as well.

I wouldn’t expect any issue with the data portion… I see a developer has started to look at this issue, will keep you posted.

Looks like the issue is a combination of a change in the info protocol between 3.x servers, 6.x, and the way old asrestore parses secondary index info responses. When asrestore restores secondary indexes it makes this info request to the target server sindex-list:ns=<namespace> it compares the results to the secondary indexes in the backup file to make sure it isn’t overwriting an identical version of the sindex. The code for parsing that info response in asbackup 3.2.9 is case sensitive. Newer tools including asbackup 3.14.0 (current newest) are case insensitive. Looking at the info response between server 4.8.0.13 and 6.2.0.2 we see…

4.8.0.13

ns=test:set=demo:indexname=idx_foo:bin=foo:type=STRING:indextype=NONE:path=foo:state=RW;ns=test:set=demo:indexname=idx_bar:bin=foo:type=NUMERIC:indextype=NONE:path=foo:state=RW;

6.2.0.2

ns=test:indexname=idx_foo:set=demo:bin=foo:type=string:indextype=default:context=null:state=RW;ns=test:indexname=idx_bar:set=demo:bin=foo:type=numeric:indextype=default:context=null:state=RW

The case difference at “type” means that when we run asrestore 3.2.9 against server 6.2.0.2 the sindex parsing code fails because of case sensitivity with [ERR] [ 11] Invalid path type string .

Using a recent asbackup (3.14.0) with the old backup files should work fine and works for me.

% asrestore -d TOOLS-2338 -n test -h 127.0.0.1:3003
2023-01-25 18:41:49 UTC [INF] [73702] [src/main/aerospike/as_cluster.c:202][as_cluster_add_nodes_copy] Add node BB9030011AC4202 127.0.0.1:3003
2023-01-25 18:41:49 UTC [INF] [73702] [src/main/aerospike/as_cluster.c:202][as_cluster_add_nodes_copy] Add node BB9030011AC4202 127.0.0.1:3003
2023-01-25 18:41:49 UTC [INF] [73702] Starting restore to 127.0.0.1:3003 (bins: [all], sets: [all]) from TOOLS-2338
2023-01-25 18:41:49 UTC [INF] [73702] Processing 1 node(s)
2023-01-25 18:41:49 UTC [INF] [73702] Found 1 backup file(s) in TOOLS-2338
2023-01-25 18:41:49 UTC [INF] [73702] Restoring records
2023-01-25 18:41:49 UTC [INF] [73739] Restoring TOOLS-2338/BB9020011AC4202_00000.asb
2023-01-25 18:41:49 UTC [INF] [73739] Opened backup file TOOLS-2338/BB9020011AC4202_00000.asb
2023-01-25 18:41:50 UTC [INF] [73702] Skipped 2 matched index(es)
2023-01-25 18:41:50 UTC [INF] [73738] 0 UDF file(s), 2 secondary index(es), 72087 record(s) (129188 rec/s, 12237 KiB/s, 97 B/rec, retries: 0)
2023-01-25 18:41:50 UTC [INF] [73738] Expired 0 : skipped 0 : err_ignored 0 : inserted 206: failed 71881 (existed 0 , fresher 71881)
2023-01-25 18:41:50 UTC [INF] [73738] 100% complete, ~0s remaining

For completeness here is the sindex portion of my backup file from the old server.

Version 3.1
# namespace test
# first-file
* i test demo idx_foo N 1 foo S
* i test demo idx_bar N 1 foo N
2 Likes

This topic was automatically closed 84 days after the last reply. New replies are no longer allowed.