mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-01-05 08:11:41 +01:00
database: Make find_unique_doc_id enforce uniqueness (for a debug build)
Catching any violation of this unique-ness constraint is very much in line with similar, existing INTERNAL_ERROR cases.
This commit is contained in:
parent
498edff503
commit
d7e5f5827e
1 changed files with 12 additions and 3 deletions
|
@ -246,10 +246,19 @@ find_unique_doc_id (notmuch_database_t *notmuch,
|
||||||
if (i == end) {
|
if (i == end) {
|
||||||
*doc_id = 0;
|
*doc_id = 0;
|
||||||
return NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND;
|
return NOTMUCH_PRIVATE_STATUS_NO_DOCUMENT_FOUND;
|
||||||
} else {
|
|
||||||
*doc_id = *i;
|
|
||||||
return NOTMUCH_PRIVATE_STATUS_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*doc_id = *i;
|
||||||
|
|
||||||
|
#if DEBUG_DATABASE_SANITY
|
||||||
|
i++;
|
||||||
|
|
||||||
|
if (i != end)
|
||||||
|
INTERNAL_ERROR ("Term %s:%s is not unique as expected.\n",
|
||||||
|
prefix_name, value);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return NOTMUCH_PRIVATE_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Xapian::Document
|
static Xapian::Document
|
||||||
|
|
Loading…
Reference in a new issue