|
@@ -10,7 +10,7 @@
|
|
|
/**
|
|
|
* Memory map size.
|
|
|
*/
|
|
|
-#if (defined DEBUG)
|
|
|
+#if (defined DEBUG || defined TESTING)
|
|
|
#define DEFAULT_MAPSIZE 1<<24 // 16Mb (limit for Valgrind)
|
|
|
#elif !(defined __LP64__ || defined __LLP64__) || \
|
|
|
defined _WIN32 && !defined _WIN64
|
|
@@ -200,7 +200,7 @@ inline static LSUP_rc lookup_3bound(MDBIterator *it, size_t *ct);
|
|
|
*/
|
|
|
|
|
|
LSUP_rc
|
|
|
-LSUP_mdbstore_setup (char *path, bool clear)
|
|
|
+LSUP_mdbstore_setup (const char *path, bool clear)
|
|
|
{
|
|
|
int rc;
|
|
|
|
|
@@ -218,12 +218,13 @@ LSUP_mdbstore_setup (char *path, bool clear)
|
|
|
mdb_env_create (&env);
|
|
|
|
|
|
mdb_env_set_maxdbs (env, N_DB);
|
|
|
- mdb_env_open (env, path, 0, ENV_FILE_MODE);
|
|
|
+ RCCK (mdb_env_open (env, path, 0, ENV_FILE_MODE));
|
|
|
+ log_debug ("Environment opened.");
|
|
|
|
|
|
MDB_txn *txn;
|
|
|
mdb_txn_begin (env, NULL, 0, &txn);
|
|
|
for (int i = 0; i < N_DB; i++) {
|
|
|
- TRACE ("Creating DB %s", db_labels[i]);
|
|
|
+ log_trace ("Creating DB %s", db_labels[i]);
|
|
|
MDB_dbi dbi;
|
|
|
rc = mdb_dbi_open (txn, db_labels[i], db_flags[i] | MDB_CREATE, &dbi);
|
|
|
if (rc != MDB_SUCCESS) return rc;
|
|
@@ -244,7 +245,7 @@ LSUP_mdbstore_new (const char *path, const LSUP_Buffer *default_ctx)
|
|
|
MALLOC_GUARD (store, NULL);
|
|
|
|
|
|
db_rc = mdb_env_create (&store->env);
|
|
|
- TRACE ("create rc: %d", db_rc);
|
|
|
+ log_trace ("create rc: %d", db_rc);
|
|
|
|
|
|
store->default_ctx = (
|
|
|
default_ctx ?
|
|
@@ -255,8 +256,8 @@ LSUP_mdbstore_new (const char *path, const LSUP_Buffer *default_ctx)
|
|
|
char *env_mapsize = getenv ("LSUP_MDB_MAPSIZE");
|
|
|
if (env_mapsize == NULL) mapsize = DEFAULT_MAPSIZE;
|
|
|
else sscanf (env_mapsize, "%lu", &mapsize);
|
|
|
- TRACE(
|
|
|
- "Setting environment map size at %s to %lu bytes.\n",
|
|
|
+ log_info (
|
|
|
+ "Setting environment map size at %s to %lu bytes.",
|
|
|
path, mapsize);
|
|
|
db_rc = mdb_env_set_mapsize (store->env, mapsize);
|
|
|
|
|
@@ -292,7 +293,7 @@ LSUP_mdbstore_free (LSUP_MDBStore *store)
|
|
|
if (store->state & LSSTORE_OPEN) {
|
|
|
const char *path;
|
|
|
mdb_env_get_path (store->env, &path);
|
|
|
- TRACE ("Closing MDB env at %s.\n", path);
|
|
|
+ log_info ("Closing MDB env at %s.", path);
|
|
|
mdb_env_close (store->env);
|
|
|
}
|
|
|
|
|
@@ -358,7 +359,7 @@ LSUP_mdbstore_add_init (LSUP_MDBStore *store, const LSUP_Buffer *sc)
|
|
|
it->ck = LSUP_buffer_hash (sc);
|
|
|
|
|
|
// Insert t:st for context.
|
|
|
- //TRACE ("Adding context: %s", sc);
|
|
|
+ //log_debug ("Adding context: %s", sc);
|
|
|
it->key.mv_data = &it->ck;
|
|
|
it->key.mv_size = KLEN;
|
|
|
it->data.mv_data = sc->addr;
|
|
@@ -401,14 +402,14 @@ LSUP_mdbstore_add_iter (MDBIterator *it, const LSUP_SerTriple *sspo)
|
|
|
it->store->txn, it->store->dbi[IDX_T_ST],
|
|
|
&it->key, &it->data, MDB_NOOVERWRITE);
|
|
|
if (db_rc != MDB_SUCCESS && db_rc != MDB_KEYEXIST) {
|
|
|
- fprintf (
|
|
|
- stderr, "MDB error while inserting term: %s\n",
|
|
|
- mdb_strerror(db_rc));
|
|
|
+ log_error (
|
|
|
+ "MDB error while inserting term: %s", LSUP_strerror(db_rc));
|
|
|
return LSUP_DB_ERR;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- TRACE ("Inserting spok: {%lx, %lx, %lx}", spok[0], spok[1], spok[2]);
|
|
|
+ log_debug ("Inserting spok: {%lx, %lx, %lx}", spok[0], spok[1], spok[2]);
|
|
|
+ log_debug ("Into context: %lx", it->ck);
|
|
|
|
|
|
// Insert spo:c.
|
|
|
it->key.mv_data = spok;
|
|
@@ -424,9 +425,8 @@ LSUP_mdbstore_add_iter (MDBIterator *it, const LSUP_SerTriple *sspo)
|
|
|
|
|
|
if (db_rc == MDB_KEYEXIST) return LSUP_NOACTION;
|
|
|
if (db_rc != MDB_SUCCESS) {
|
|
|
- fprintf (
|
|
|
- stderr, "MDB error while inserting triple: %s\n",
|
|
|
- mdb_strerror(db_rc));
|
|
|
+ log_error (
|
|
|
+ "MDB error while inserting triple: %s", LSUP_strerror(db_rc));
|
|
|
return LSUP_DB_ERR;
|
|
|
}
|
|
|
|
|
@@ -550,6 +550,7 @@ LSUP_mdbstore_lookup(
|
|
|
|
|
|
it->store = store;
|
|
|
it->ck = store->default_ctx ? LSUP_buffer_hash (sc) : NULL_KEY;
|
|
|
+ log_debug ("Lookup context: %lx", it->ck);
|
|
|
|
|
|
if (ct) *ct = 0;
|
|
|
|
|
@@ -616,9 +617,7 @@ mdbiter_next_key (LSUP_MDBIterator *it)
|
|
|
if (it->rc == MDB_NOTFOUND) return LSUP_END;
|
|
|
|
|
|
if (UNLIKELY (it->rc != MDB_SUCCESS)) {
|
|
|
- fprintf (
|
|
|
- stderr, "%s:%d [%s]: Database error: %s\n",
|
|
|
- __FILE__, __LINE__, __func__, mdb_strerror (it->rc));
|
|
|
+ log_error ("Database error: %s", LSUP_strerror (it->rc));
|
|
|
return LSUP_DB_ERR;
|
|
|
}
|
|
|
|
|
@@ -628,7 +627,7 @@ mdbiter_next_key (LSUP_MDBIterator *it)
|
|
|
* it->rc is set to the result of the next iteration.
|
|
|
*/
|
|
|
it->iter_op_fn (it);
|
|
|
- TRACE (
|
|
|
+ log_debug (
|
|
|
"Found spok: {%lx, %lx, %lx}",
|
|
|
it->spok[0], it->spok[1], it->spok[2]);
|
|
|
|
|
@@ -641,9 +640,7 @@ mdbiter_next_key (LSUP_MDBIterator *it)
|
|
|
int db_rc;
|
|
|
db_rc = mdb_cursor_open (it->txn, it->store->dbi[IDX_SPO_C], &cur);
|
|
|
if (UNLIKELY (db_rc != MDB_SUCCESS)) {
|
|
|
- fprintf (
|
|
|
- stderr, "%s:%d [%s]: Database error: %s\n",
|
|
|
- __FILE__, __LINE__, __func__, mdb_strerror (db_rc));
|
|
|
+ log_error ("Database error: %s", LSUP_strerror (db_rc));
|
|
|
return LSUP_DB_ERR;
|
|
|
}
|
|
|
|
|
@@ -652,7 +649,7 @@ mdbiter_next_key (LSUP_MDBIterator *it)
|
|
|
data.mv_size = KLEN;
|
|
|
|
|
|
while (rc == LSUP_NORESULT) {
|
|
|
- //TRACE (STR, "begin ctx loop.");
|
|
|
+ //log_debug ("begin ctx loop.");
|
|
|
// If ctx is specified, look if the matching triple is associated
|
|
|
// with it. If not, move on to the next triple.
|
|
|
// The loop normally exits when a triple with matching ctx is found
|
|
@@ -664,16 +661,16 @@ mdbiter_next_key (LSUP_MDBIterator *it)
|
|
|
|
|
|
if (db_rc == MDB_SUCCESS) {
|
|
|
rc = LSUP_OK;
|
|
|
- //TRACE (STR, "Triple found for context.");
|
|
|
+ //log_debug ("Triple found for context.");
|
|
|
}
|
|
|
|
|
|
else if (db_rc == MDB_NOTFOUND) {
|
|
|
- //TRACE (STR, "No triples found for context.");
|
|
|
+ //log_debug ("No triples found for context.");
|
|
|
if (it->rc == MDB_NOTFOUND) rc = LSUP_END;
|
|
|
else it->iter_op_fn (it);
|
|
|
|
|
|
} else {
|
|
|
- fprintf (stderr, mdb_strerror (it->rc));
|
|
|
+ log_error ("Database error: %s", LSUP_strerror (db_rc));
|
|
|
rc = LSUP_DB_ERR;
|
|
|
}
|
|
|
|
|
@@ -751,7 +748,7 @@ LSUP_mdbstore_remove(
|
|
|
|
|
|
LSUP_MDBIterator *it = LSUP_mdbstore_lookup (store, ss, sp, so, sc, ct);
|
|
|
if (UNLIKELY (!it)) return LSUP_DB_ERR;
|
|
|
- if (ct) TRACE ("Found %lu triples to remove.", *ct);
|
|
|
+ if (ct) log_debug ("Found %lu triples to remove.", *ct);
|
|
|
|
|
|
while (mdbiter_next_key (it) == LSUP_OK) {
|
|
|
spok_v.mv_data = it->spok;
|
|
@@ -760,7 +757,7 @@ LSUP_mdbstore_remove(
|
|
|
if (rc == MDB_NOTFOUND) continue;
|
|
|
if (UNLIKELY (rc != MDB_SUCCESS)) goto _remove_abort;
|
|
|
|
|
|
- TRACE (
|
|
|
+ log_trace (
|
|
|
"Removing {%lx, %lx, %lx}",
|
|
|
it->spok[0], it->spok[1], it->spok[2]);
|
|
|
|
|
@@ -803,9 +800,7 @@ LSUP_mdbstore_remove(
|
|
|
|
|
|
_remove_abort:
|
|
|
mdb_txn_abort (txn);
|
|
|
- fprintf (
|
|
|
- stderr, "%s:%d [%s]: Database error: %s\n",
|
|
|
- __FILE__, __LINE__, __func__, mdb_strerror (rc));
|
|
|
+ log_error ("Database error: %s", LSUP_strerror (rc));
|
|
|
|
|
|
return rc;
|
|
|
}
|
|
@@ -829,11 +824,11 @@ index_triple(
|
|
|
LSUP_rc rc = LSUP_NOACTION;
|
|
|
MDB_val v1, v2;
|
|
|
|
|
|
- TRACE ("Indexing triple: %lx %lx %lx\n", spok[0], spok[1], spok[2]);
|
|
|
+ log_trace ("Indexing triple: %lx %lx %lx", spok[0], spok[1], spok[2]);
|
|
|
|
|
|
// Index c:spo.
|
|
|
if (op == OP_REMOVE) {
|
|
|
- TRACE (STR, "Indexing op: REMOVE");
|
|
|
+ log_trace ("Indexing op: REMOVE");
|
|
|
if (ck != NULL_KEY) {
|
|
|
MDB_cursor *cur;
|
|
|
|
|
@@ -854,7 +849,7 @@ index_triple(
|
|
|
}
|
|
|
|
|
|
} else if (op == OP_ADD) {
|
|
|
- TRACE (STR, "Indexing op: ADD");
|
|
|
+ log_trace ("Indexing op: ADD");
|
|
|
if (ck != NULL_KEY) {
|
|
|
v1.mv_data = &ck;
|
|
|
v1.mv_size = KLEN;
|
|
@@ -913,12 +908,10 @@ index_triple(
|
|
|
|
|
|
} else { // OP_ADD is guaranteed.
|
|
|
// 1-bound index.
|
|
|
- /*
|
|
|
- TRACE ("Indexing in %s: ", db_labels[lookup_indices[i]]);
|
|
|
- TRACE(
|
|
|
- "%lx: %lx %lx\n", *(size_t*)(v1.mv_data),
|
|
|
+ log_trace ("Indexing in %s: ", db_labels[lookup_indices[i]]);
|
|
|
+ log_trace (
|
|
|
+ "%lx: %lx %lx", *(size_t*)(v1.mv_data),
|
|
|
*(size_t*)(v2.mv_data), *(size_t*)(v2.mv_data) + 1);
|
|
|
- */
|
|
|
|
|
|
db_rc = mdb_put (store->txn, db1, &v1, &v2, MDB_NODUPDATA);
|
|
|
|
|
@@ -926,12 +919,10 @@ index_triple(
|
|
|
else if (db_rc != MDB_KEYEXIST) return LSUP_DB_ERR;
|
|
|
|
|
|
// 2-bound index.
|
|
|
- /*
|
|
|
- TRACE ("Indexing in %s: ", db_labels[lookup_indices[i + 3]]);
|
|
|
- TRACE(
|
|
|
- "%lx %lx: %lx\n", *(size_t*)(v2.mv_data),
|
|
|
+ log_trace ("Indexing in %s: ", db_labels[lookup_indices[i + 3]]);
|
|
|
+ log_trace (
|
|
|
+ "%lx %lx: %lx", *(size_t*)(v2.mv_data),
|
|
|
*(size_t*)(v2.mv_data) + 1, *(size_t*)(v1.mv_data));
|
|
|
- */
|
|
|
|
|
|
db_rc = mdb_put (store->txn, db2, &v2, &v1, MDB_NODUPDATA);
|
|
|
|
|
@@ -974,21 +965,21 @@ it_next_1bound (MDBIterator *it)
|
|
|
it->spok[it->term_order[1]] = lu_dset[it->i][0];
|
|
|
it->spok[it->term_order[2]] = lu_dset[it->i][1];
|
|
|
|
|
|
- TRACE(
|
|
|
+ log_trace (
|
|
|
"Composed triple: {%lx %lx %lx}",
|
|
|
it->spok[0], it->spok[1], it->spok[2]);
|
|
|
|
|
|
// Ensure next block within the same page is not beyond the last.
|
|
|
if (it->i < it->data.mv_size / DBL_KLEN - 1) {
|
|
|
it->i ++;
|
|
|
- //TRACE ("Increasing page cursor to %lu.", it->i);
|
|
|
- //TRACE ("it->rc: %d", it->rc);
|
|
|
+ //log_debug ("Increasing page cursor to %lu.", it->i);
|
|
|
+ //log_debug ("it->rc: %d", it->rc);
|
|
|
|
|
|
} else {
|
|
|
// If the last block in the page is being yielded,
|
|
|
// move cursor to beginning of next page.
|
|
|
it->i = 0;
|
|
|
- //TRACE ("Reset page cursor to %lu.", it->i);
|
|
|
+ //log_debug ("Reset page cursor to %lu.", it->i);
|
|
|
it->rc = mdb_cursor_get (
|
|
|
it->cur, &it->key, &it->data, MDB_NEXT_MULTIPLE);
|
|
|
}
|
|
@@ -1040,13 +1031,14 @@ it_next_3bound (MDBIterator *it)
|
|
|
inline static LSUP_rc
|
|
|
lookup_0bound (MDBIterator *it, size_t *ct)
|
|
|
{
|
|
|
+ log_debug ("Looking up 0 bound terms.");
|
|
|
+ log_debug ("Lookup context: %lx", it->ck);
|
|
|
+
|
|
|
if (it->store->txn) it->txn = it->store->txn;
|
|
|
else {
|
|
|
it->rc = mdb_txn_begin (it->store->env, NULL, MDB_RDONLY, &it->txn);
|
|
|
if (it->rc != MDB_SUCCESS) {
|
|
|
- fprintf (
|
|
|
- stderr, "%s:%d [%s]: Database error: %s\n",
|
|
|
- __FILE__, __LINE__, __func__, mdb_strerror (it->rc));
|
|
|
+ log_error ("Database error: %s", LSUP_strerror (it->rc));
|
|
|
return LSUP_DB_ERR;
|
|
|
}
|
|
|
}
|
|
@@ -1073,21 +1065,25 @@ lookup_0bound (MDBIterator *it, size_t *ct)
|
|
|
|
|
|
*ct = stat.ms_entries;
|
|
|
}
|
|
|
- TRACE ("Found %lu keys.", *ct);
|
|
|
+ log_debug ("Found %lu keys.", *ct);
|
|
|
}
|
|
|
|
|
|
- mdb_cursor_open (it->txn, it->store->dbi[IDX_SPO_C], &it->cur);
|
|
|
+ it->rc = mdb_cursor_open (it->txn, it->store->dbi[IDX_SPO_C], &it->cur);
|
|
|
+ if (it->rc != MDB_SUCCESS) {
|
|
|
+ log_error ("Database error: %s", LSUP_strerror (it->rc));
|
|
|
+ return LSUP_DB_ERR;
|
|
|
+ }
|
|
|
|
|
|
it->rc = mdb_cursor_get (it->cur, &it->key, &it->data, MDB_FIRST);
|
|
|
+ /*
|
|
|
mdb_cursor_close (it->cur);
|
|
|
it->cur = NULL;
|
|
|
+ */
|
|
|
|
|
|
it->iter_op_fn = it_next_0bound;
|
|
|
|
|
|
if (it->rc != MDB_SUCCESS && it->rc != MDB_NOTFOUND) {
|
|
|
- fprintf (
|
|
|
- stderr, "%s:%d [%s]: Database error: %s\n",
|
|
|
- __FILE__, __LINE__, __func__, mdb_strerror (it->rc));
|
|
|
+ log_error ("Database error: %s", LSUP_strerror (it->rc));
|
|
|
return LSUP_DB_ERR;
|
|
|
}
|
|
|
|
|
@@ -1100,7 +1096,7 @@ lookup_1bound (uint8_t idx0, MDBIterator *it, size_t *ct)
|
|
|
{
|
|
|
it->term_order = (const uint8_t*)lookup_ordering_1bound[idx0];
|
|
|
|
|
|
- TRACE ("Looking up 1 bound term: %lx\n", it->luk[0]);
|
|
|
+ log_debug ("Looking up 1 bound term: %lx", it->luk[0]);
|
|
|
|
|
|
if (!it->txn) {
|
|
|
if (it->store->txn) it->txn = it->store->txn;
|
|
@@ -1108,9 +1104,7 @@ lookup_1bound (uint8_t idx0, MDBIterator *it, size_t *ct)
|
|
|
it->rc = mdb_txn_begin (
|
|
|
it->store->env, NULL, MDB_RDONLY, &it->txn);
|
|
|
if (it->rc != MDB_SUCCESS) {
|
|
|
- fprintf (
|
|
|
- stderr, "%s:%d [%s]: Database error: %s",
|
|
|
- __FILE__, __LINE__, __func__, mdb_strerror (it->rc));
|
|
|
+ log_error ("Database error: %s", LSUP_strerror (it->rc));
|
|
|
return LSUP_DB_ERR;
|
|
|
}
|
|
|
}
|
|
@@ -1125,7 +1119,7 @@ lookup_1bound (uint8_t idx0, MDBIterator *it, size_t *ct)
|
|
|
// If a context is specified, the only way to count triples matching
|
|
|
// the context is to loop over them.
|
|
|
if (it->ck != NULL_KEY) {
|
|
|
- TRACE ("Counting in context: %lx\n", it->ck);
|
|
|
+ log_debug ("Counting in context: %lx", it->ck);
|
|
|
MDBIterator *ct_it;
|
|
|
MALLOC_GUARD (ct_it, LSUP_MEM_ERR);
|
|
|
|
|
@@ -1146,7 +1140,7 @@ lookup_1bound (uint8_t idx0, MDBIterator *it, size_t *ct)
|
|
|
|
|
|
while (LSUP_mdbiter_next (ct_it, NULL) != LSUP_END) {
|
|
|
(*ct)++;
|
|
|
- TRACE ("Counter increased to %lu.", *ct);
|
|
|
+ log_debug ("Counter increased to %lu.", *ct);
|
|
|
}
|
|
|
|
|
|
// Free the counter iterator without freeing the shared txn.
|
|
@@ -1167,9 +1161,7 @@ lookup_1bound (uint8_t idx0, MDBIterator *it, size_t *ct)
|
|
|
it->rc = mdb_cursor_get (it->cur, &it->key, &it->data, MDB_GET_MULTIPLE);
|
|
|
|
|
|
if (it->rc != MDB_SUCCESS && it->rc != MDB_NOTFOUND) {
|
|
|
- fprintf (
|
|
|
- stderr, "%s:%d [%s]: Database error: %s",
|
|
|
- __FILE__, __LINE__, __func__, mdb_strerror (it->rc));
|
|
|
+ log_error ("Database error: %s", LSUP_strerror (it->rc));
|
|
|
return LSUP_DB_ERR;
|
|
|
}
|
|
|
|
|
@@ -1203,8 +1195,8 @@ lookup_2bound(uint8_t idx0, uint8_t idx1, MDBIterator *it, size_t *ct)
|
|
|
luk2_offset = 0;
|
|
|
}
|
|
|
dbi = it->store->dbi[lookup_indices[i + 3]];
|
|
|
- TRACE(
|
|
|
- "Looking up 2 bound in %s\n",
|
|
|
+ log_debug(
|
|
|
+ "Looking up 2 bound in %s",
|
|
|
db_labels[lookup_indices[i + 3]]);
|
|
|
|
|
|
break;
|
|
@@ -1212,7 +1204,7 @@ lookup_2bound(uint8_t idx0, uint8_t idx1, MDBIterator *it, size_t *ct)
|
|
|
}
|
|
|
|
|
|
if (dbi == 0) {
|
|
|
- TRACE(
|
|
|
+ log_debug(
|
|
|
"Values %d and %d not found in lookup keys.",
|
|
|
idx0, idx1);
|
|
|
return LSUP_VALUE_ERR;
|
|
@@ -1229,9 +1221,7 @@ lookup_2bound(uint8_t idx0, uint8_t idx1, MDBIterator *it, size_t *ct)
|
|
|
it->rc = mdb_txn_begin (
|
|
|
it->store->env, NULL, MDB_RDONLY, &it->txn);
|
|
|
if (it->rc != MDB_SUCCESS) {
|
|
|
- fprintf (
|
|
|
- stderr, "%s:%d [%s]: Database error: %s",
|
|
|
- __FILE__, __LINE__, __func__, mdb_strerror (it->rc));
|
|
|
+ log_error ("Database error: %s", LSUP_strerror (it->rc));
|
|
|
return LSUP_DB_ERR;
|
|
|
}
|
|
|
}
|
|
@@ -1283,9 +1273,7 @@ lookup_2bound(uint8_t idx0, uint8_t idx1, MDBIterator *it, size_t *ct)
|
|
|
it->rc = mdb_cursor_get (it->cur, &it->key, &it->data, MDB_GET_MULTIPLE);
|
|
|
|
|
|
if (it->rc != MDB_SUCCESS && it->rc != MDB_NOTFOUND) {
|
|
|
- fprintf (
|
|
|
- stderr, "%s:%d [%s]: Database error: %s\n",
|
|
|
- __FILE__, __LINE__, __func__, mdb_strerror (it->rc));
|
|
|
+ log_error ("Database error: %s", LSUP_strerror (it->rc));
|
|
|
return LSUP_DB_ERR;
|
|
|
}
|
|
|
|
|
@@ -1296,7 +1284,7 @@ lookup_2bound(uint8_t idx0, uint8_t idx1, MDBIterator *it, size_t *ct)
|
|
|
inline static LSUP_rc
|
|
|
lookup_3bound (MDBIterator *it, size_t *ct)
|
|
|
{
|
|
|
- TRACE(
|
|
|
+ log_debug (
|
|
|
"Looking up 3 bound: {%lx, %lx, %lx}",
|
|
|
it->luk[0], it->luk[1], it->luk[2]);
|
|
|
|
|
@@ -1304,9 +1292,7 @@ lookup_3bound (MDBIterator *it, size_t *ct)
|
|
|
else {
|
|
|
it->rc = mdb_txn_begin (it->store->env, NULL, MDB_RDONLY, &it->txn);
|
|
|
if (it->rc != MDB_SUCCESS) {
|
|
|
- fprintf (
|
|
|
- stderr, "%s:%d [%s]: Database error: %s\n",
|
|
|
- __FILE__, __LINE__, __func__, mdb_strerror (it->rc));
|
|
|
+ log_error ("Database error: %s", LSUP_strerror (it->rc));
|
|
|
return LSUP_DB_ERR;
|
|
|
}
|
|
|
}
|
|
@@ -1332,9 +1318,7 @@ lookup_3bound (MDBIterator *it, size_t *ct)
|
|
|
it->rc = mdb_cursor_get (it->cur, &it->key, &it->data, MDB_GET_BOTH);
|
|
|
|
|
|
if (it->rc != MDB_SUCCESS && it->rc != MDB_NOTFOUND) {
|
|
|
- fprintf (
|
|
|
- stderr, "%s:%d [%s]: Database error: %s\n",
|
|
|
- __FILE__, __LINE__, __func__, mdb_strerror (it->rc));
|
|
|
+ log_error ("Database error: %s", LSUP_strerror (it->rc));
|
|
|
return LSUP_DB_ERR;
|
|
|
}
|
|
|
|