|
@@ -279,6 +279,8 @@ LSUP_mdbstore_new (const char *path, const LSUP_Buffer *default_ctx)
|
|
char *env_mapsize = getenv ("LSUP_MDB_MAPSIZE");
|
|
char *env_mapsize = getenv ("LSUP_MDB_MAPSIZE");
|
|
if (env_mapsize == NULL) mapsize = DEFAULT_MAPSIZE;
|
|
if (env_mapsize == NULL) mapsize = DEFAULT_MAPSIZE;
|
|
else sscanf (env_mapsize, "%lu", &mapsize);
|
|
else sscanf (env_mapsize, "%lu", &mapsize);
|
|
|
|
+ printf ("Setting environment map size to %lu bytes.\n", mapsize);
|
|
|
|
+ db_rc = mdb_env_set_mapsize (store->env, mapsize);
|
|
|
|
|
|
db_rc = mdb_env_set_maxdbs (store->env, N_DB);
|
|
db_rc = mdb_env_set_maxdbs (store->env, N_DB);
|
|
if (UNLIKELY (db_rc != MDB_SUCCESS)) return NULL;
|
|
if (UNLIKELY (db_rc != MDB_SUCCESS)) return NULL;
|
|
@@ -403,9 +405,11 @@ LSUP_mdbstore_add_iter (MDBIterator *it, const LSUP_SerTriple *sspo)
|
|
for (int i = 0; i < 3; i++) {
|
|
for (int i = 0; i < 3; i++) {
|
|
LSUP_Buffer *st = LSUP_striple_pos (sspo, i);
|
|
LSUP_Buffer *st = LSUP_striple_pos (sspo, i);
|
|
|
|
|
|
|
|
+#ifdef DEBUG
|
|
printf ("Inserting term: ");
|
|
printf ("Inserting term: ");
|
|
LSUP_buffer_print (st);
|
|
LSUP_buffer_print (st);
|
|
printf ("\n");
|
|
printf ("\n");
|
|
|
|
+#endif
|
|
|
|
|
|
spok[i] = LSUP_sterm_to_key (st);
|
|
spok[i] = LSUP_sterm_to_key (st);
|
|
|
|
|
|
@@ -418,6 +422,9 @@ LSUP_mdbstore_add_iter (MDBIterator *it, const LSUP_SerTriple *sspo)
|
|
it->store->txn, it->store->dbi[IDX_T_ST],
|
|
it->store->txn, it->store->dbi[IDX_T_ST],
|
|
&it->key, &it->data, MDB_NOOVERWRITE);
|
|
&it->key, &it->data, MDB_NOOVERWRITE);
|
|
if (db_rc != MDB_SUCCESS && db_rc != MDB_KEYEXIST) {
|
|
if (db_rc != MDB_SUCCESS && db_rc != MDB_KEYEXIST) {
|
|
|
|
+ fprintf (
|
|
|
|
+ stderr, "MDB error while inserting term: %s\n",
|
|
|
|
+ mdb_strerror(db_rc));
|
|
return LSUP_DB_ERR;
|
|
return LSUP_DB_ERR;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -437,7 +444,12 @@ LSUP_mdbstore_add_iter (MDBIterator *it, const LSUP_SerTriple *sspo)
|
|
&it->key, &it->data, MDB_NODUPDATA);
|
|
&it->key, &it->data, MDB_NODUPDATA);
|
|
|
|
|
|
if (db_rc == MDB_KEYEXIST) return LSUP_NOACTION;
|
|
if (db_rc == MDB_KEYEXIST) return LSUP_NOACTION;
|
|
- if (db_rc != MDB_SUCCESS) return LSUP_DB_ERR;
|
|
|
|
|
|
+ if (db_rc != MDB_SUCCESS) {
|
|
|
|
+ fprintf (
|
|
|
|
+ stderr, "MDB error while inserting triple: %s\n",
|
|
|
|
+ mdb_strerror(db_rc));
|
|
|
|
+ return LSUP_DB_ERR;
|
|
|
|
+ }
|
|
|
|
|
|
// Index.
|
|
// Index.
|
|
rc = index_triple (it->store, OP_ADD, spok, it->ck);
|
|
rc = index_triple (it->store, OP_ADD, spok, it->ck);
|
|
@@ -809,7 +821,7 @@ index_triple(
|
|
LSUP_rc rc = LSUP_NOACTION;
|
|
LSUP_rc rc = LSUP_NOACTION;
|
|
MDB_val v1, v2;
|
|
MDB_val v1, v2;
|
|
|
|
|
|
- printf ("Indexing triple: %lx %lx %lx\n", spok[0], spok[1], spok[2]);
|
|
|
|
|
|
+ TRACE ("Indexing triple: %lx %lx %lx\n", spok[0], spok[1], spok[2]);
|
|
|
|
|
|
// Index c:spo.
|
|
// Index c:spo.
|
|
if (op == OP_REMOVE) {
|
|
if (op == OP_REMOVE) {
|