From 38ea35342e6e2ef4daa1e1e2df4ae623c55dcc8d Mon Sep 17 00:00:00 2001 From: atefehmohseni <57154674+atefehmohseni@users.noreply.github.com> Date: Mon, 29 Aug 2022 16:45:16 -0700 Subject: [PATCH] ASBACKUP 3.11.3 * TOOLS-2121 (ASBACKUP) warn and skip backing up secondary indexes with context (#27) --- include/encode.h | 2 ++ src/backup.c | 11 ++++++++--- src/utils.c | 5 ++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/include/encode.h b/include/encode.h index 9dc1024..9f5c067 100644 --- a/include/encode.h +++ b/include/encode.h @@ -135,6 +135,8 @@ typedef struct { // The as_index_task struct populated by the aerospike_index_create_complex // command which is used by aerospike_index_create_wait as_index_task task; + // boolean ctx true if the sindex has a (not null) context + bool ctx; } index_param; /* diff --git a/src/backup.c b/src/backup.c index 125eabe..e168574 100644 --- a/src/backup.c +++ b/src/backup.c @@ -1552,6 +1552,7 @@ process_secondary_indexes(backup_job_context_t *bjc) inf("Backing up %u secondary index(es)", info_vec.size); int32_t skipped = 0; + int32_t skipped_sids_with_ctx = 0; char *clone = safe_strdup(info_str); index_param index; @@ -1562,13 +1563,15 @@ process_secondary_indexes(backup_job_context_t *bjc) err("Error while parsing secondary index info string %s", clone); goto cleanup2; } - + if (index.ctx) { + skipped_sids_with_ctx++; + continue; + } ver("Storing index %s", index.name); uint32_t n_sets = bjc->conf->set_list.size; if (n_sets == 0 || (index.set != NULL && str_vector_contains(&bjc->conf->set_list, index.set))) { - // backing up to a single backup file: allow one thread at a time to write if (bjc->conf->output_file != NULL || bjc->conf->estimate) { safe_lock(&bjc->status->file_write_mutex); @@ -1612,7 +1615,9 @@ process_secondary_indexes(backup_job_context_t *bjc) if (skipped > 0) { inf("Skipped %d index(es) with unwanted set(s)", skipped); } - + if (skipped_sids_with_ctx > 0) { + inf("WARNING: Skipped %d index(es) with context. Current version doesn't backup secondary indexes with context.", skipped_sids_with_ctx); + } goto cleanup2; cleanup3: diff --git a/src/utils.c b/src/utils.c index 9ae4669..83df15f 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1509,6 +1509,7 @@ parse_index_info(char *ns, char *index_str, index_param *index) index->set = NULL; index->name = NULL; index->type = INDEX_TYPE_INVALID; + index->ctx = false; as_vector_init(&index->path_vec, sizeof (path_param), 25); char *path = NULL; @@ -1564,8 +1565,10 @@ parse_index_info(char *ns, char *index_str, index_param *index) err("Invalid index type %s", arg); goto cleanup2; } - } else if (strcmp(para, "path") == 0 || strcmp(para, "context") == 0) { + } else if (strcmp(para, "bin") == 0) { path = arg; + } else if (strcmp(para, "context") == 0 && strcasecmp(arg, "NULL") != 0) { + index->ctx = true; } if (path != NULL && type != PATH_TYPE_INVALID) {