mdbx-check: add checking for complete duplicates.

Change-Id: I8308b725418ef69188eeadfc656dead4ce9cee27
This commit is contained in:
Leonid Yuriev 2019-02-03 19:05:51 +03:00
parent 460751bc01
commit 73bef80347

View File

@ -651,17 +651,25 @@ static int process_db(MDBX_dbi dbi_handle, char *dbi_name, visitor *handler,
}
int cmp = mdbx_cmp(txn, dbi_handle, &prev_key, &key);
if (cmp > 0) {
if (!ignore_wrong_order)
problem_add("entry", record_count, "wrong order of entries", NULL);
} else if (cmp == 0) {
if (cmp == 0) {
++dups;
if (!(flags & MDBX_DUPSORT))
if ((flags & MDBX_DUPSORT) == 0) {
problem_add("entry", record_count, "duplicated entries", NULL);
else if (!ignore_wrong_order &&
mdbx_dcmp(txn, dbi_handle, &prev_data, &data) > 0)
problem_add("entry", record_count, "wrong order of multi-values",
NULL);
if (data.iov_len == prev_data.iov_len &&
memcmp(data.iov_base, prev_data.iov_base, data.iov_len) == 0) {
problem_add("entry", record_count, "complete duplicate", NULL);
}
} else {
cmp = mdbx_dcmp(txn, dbi_handle, &prev_data, &data);
if (cmp == 0) {
problem_add("entry", record_count, "complete duplicate", NULL);
} else if (cmp > 0 && !ignore_wrong_order) {
problem_add("entry", record_count, "wrong order of multi-values",
NULL);
}
}
} else if (cmp > 0 && !ignore_wrong_order) {
problem_add("entry", record_count, "wrong order of entries", NULL);
}
} else if (verbose) {
if (flags & MDBX_INTEGERKEY)