Skip to content

Commit

Permalink
ASBACKUP 3.11.3
Browse files Browse the repository at this point in the history
* TOOLS-2121 (ASBACKUP) warn and skip backing up secondary indexes with context (#27)
  • Loading branch information
atefehmohseni committed Aug 29, 2022
1 parent a91843d commit 38ea353
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 2 additions & 0 deletions include/encode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/*
Expand Down
11 changes: 8 additions & 3 deletions src/backup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 38ea353

Please sign in to comment.