aboutsummaryrefslogtreecommitdiff
path: root/src/datastore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-08-03 20:59:58 +0000
committerChristian Grothoff <christian@grothoff.org>2011-08-03 20:59:58 +0000
commitba47d9ea31c6635578365484b993f252d7c2d022 (patch)
tree5c41f5faa60b0b1fa2224b1e293394bc91e6f053 /src/datastore
parentdd1dcb51fe9ad99b0f81598d4045d2e957834843 (diff)
downloadgnunet-ba47d9ea31c6635578365484b993f252d7c2d022.tar.gz
gnunet-ba47d9ea31c6635578365484b993f252d7c2d022.zip
improve API, speed up mysql
Diffstat (limited to 'src/datastore')
-rw-r--r--src/datastore/plugin_datastore_mysql.c179
-rw-r--r--src/datastore/plugin_datastore_sqlite.c4
2 files changed, 149 insertions, 34 deletions
diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c
index a5f8f2a3e..bb92d76a8 100644
--- a/src/datastore/plugin_datastore_mysql.c
+++ b/src/datastore/plugin_datastore_mysql.c
@@ -194,34 +194,34 @@ struct Plugin
194 /** 194 /**
195 * Prepared statements. 195 * Prepared statements.
196 */ 196 */
197#define INSERT_ENTRY "INSERT INTO gn090 (repl,type,prio,anonLevel,expire,rvalue,hash,vhash,value) VALUES (?,?,?,?,?,RAND(),?,?,?)" 197#define INSERT_ENTRY "INSERT INTO gn090 (repl,type,prio,anonLevel,expire,rvalue,hash,vhash,value) VALUES (?,?,?,?,?,?,?,?,?)"
198 struct GNUNET_MysqlStatementHandle *insert_entry; 198 struct GNUNET_MysqlStatementHandle *insert_entry;
199 199
200#define DELETE_ENTRY_BY_UID "DELETE FROM gn090 WHERE uid=?" 200#define DELETE_ENTRY_BY_UID "DELETE FROM gn090 WHERE uid=?"
201 struct GNUNET_MysqlStatementHandle *delete_entry_by_uid; 201 struct GNUNET_MysqlStatementHandle *delete_entry_by_uid;
202 202
203#define COUNT_ENTRY_BY_HASH "SELECT count(*) FROM gn090 WHERE hash=?" 203#define COUNT_ENTRY_BY_HASH "SELECT count(*) FROM gn090 FORCE INDEX (idx_hash) WHERE hash=?"
204 struct GNUNET_MysqlStatementHandle *count_entry_by_hash; 204 struct GNUNET_MysqlStatementHandle *count_entry_by_hash;
205 205
206#define SELECT_ENTRY_BY_HASH "SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 WHERE hash=? ORDER BY uid LIMIT 1 OFFSET ?" 206#define SELECT_ENTRY_BY_HASH "SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 FORCE INDEX (idx_hash) WHERE hash=? ORDER BY uid LIMIT 1 OFFSET ?"
207 struct GNUNET_MysqlStatementHandle *select_entry_by_hash; 207 struct GNUNET_MysqlStatementHandle *select_entry_by_hash;
208 208
209#define COUNT_ENTRY_BY_HASH_AND_VHASH "SELECT count(*) FROM gn090 WHERE hash=? AND vhash=?" 209#define COUNT_ENTRY_BY_HASH_AND_VHASH "SELECT count(*) FROM gn090 FORCE INDEX (idx_hash_vhash) WHERE hash=? AND vhash=?"
210 struct GNUNET_MysqlStatementHandle *count_entry_by_hash_and_vhash; 210 struct GNUNET_MysqlStatementHandle *count_entry_by_hash_and_vhash;
211 211
212#define SELECT_ENTRY_BY_HASH_AND_VHASH "SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 WHERE hash=? AND vhash=? ORDER BY uid LIMIT 1 OFFSET ?" 212#define SELECT_ENTRY_BY_HASH_AND_VHASH "SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 FORCE INDEX (idx_hash_vhash) WHERE hash=? AND vhash=? ORDER BY uid LIMIT 1 OFFSET ?"
213 struct GNUNET_MysqlStatementHandle *select_entry_by_hash_and_vhash; 213 struct GNUNET_MysqlStatementHandle *select_entry_by_hash_and_vhash;
214 214
215#define COUNT_ENTRY_BY_HASH_AND_TYPE "SELECT count(*) FROM gn090 WHERE hash=? AND type=?" 215#define COUNT_ENTRY_BY_HASH_AND_TYPE "SELECT count(*) FROM gn090 FORCE INDEX (idx_hash_type_uid) WHERE hash=? AND type=?"
216 struct GNUNET_MysqlStatementHandle *count_entry_by_hash_and_type; 216 struct GNUNET_MysqlStatementHandle *count_entry_by_hash_and_type;
217 217
218#define SELECT_ENTRY_BY_HASH_AND_TYPE "SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 WHERE hash=? AND type=? ORDER BY uid LIMIT 1 OFFSET ?" 218#define SELECT_ENTRY_BY_HASH_AND_TYPE "SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 FORCE INDEX (idx_hash_type_uid) WHERE hash=? AND type=? ORDER BY uid LIMIT 1 OFFSET ?"
219 struct GNUNET_MysqlStatementHandle *select_entry_by_hash_and_type; 219 struct GNUNET_MysqlStatementHandle *select_entry_by_hash_and_type;
220 220
221#define COUNT_ENTRY_BY_HASH_VHASH_AND_TYPE "SELECT count(*) FROM gn090 WHERE hash=? AND vhash=? AND type=?" 221#define COUNT_ENTRY_BY_HASH_VHASH_AND_TYPE "SELECT count(*) FROM gn090 FORCE INDEX (idx_hash_vhash) WHERE hash=? AND vhash=? AND type=?"
222 struct GNUNET_MysqlStatementHandle *count_entry_by_hash_vhash_and_type; 222 struct GNUNET_MysqlStatementHandle *count_entry_by_hash_vhash_and_type;
223 223
224#define SELECT_ENTRY_BY_HASH_VHASH_AND_TYPE "SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 WHERE hash=? AND vhash=? AND type=? ORDER BY uid ASC LIMIT 1 OFFSET ?" 224#define SELECT_ENTRY_BY_HASH_VHASH_AND_TYPE "SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 FORCE INDEX (idx_hash_vhash) WHERE hash=? AND vhash=? AND type=? ORDER BY uid ASC LIMIT 1 OFFSET ?"
225 struct GNUNET_MysqlStatementHandle *select_entry_by_hash_vhash_and_type; 225 struct GNUNET_MysqlStatementHandle *select_entry_by_hash_vhash_and_type;
226 226
227#define UPDATE_ENTRY "UPDATE gn090 SET prio=prio+?,expire=IF(expire>=?,expire,?) WHERE uid=?" 227#define UPDATE_ENTRY "UPDATE gn090 SET prio=prio+?,expire=IF(expire>=?,expire,?) WHERE uid=?"
@@ -233,27 +233,32 @@ struct Plugin
233#define SELECT_SIZE "SELECT SUM(BIT_LENGTH(value) DIV 8) FROM gn090" 233#define SELECT_SIZE "SELECT SUM(BIT_LENGTH(value) DIV 8) FROM gn090"
234 struct GNUNET_MysqlStatementHandle *get_size; 234 struct GNUNET_MysqlStatementHandle *get_size;
235 235
236#define SELECT_IT_NON_ANONYMOUS "SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 WHERE anonLevel=0 AND type=? ORDER BY uid DESC LIMIT 1 OFFSET ?" 236#define SELECT_IT_NON_ANONYMOUS "SELECT type,prio,anonLevel,expire,hash,value,uid "\
237 "FROM gn090 FORCE INDEX (idx_anonLevel_type_rvalue) "\
238 "WHERE anonLevel=0 AND type=? AND "\
239 "(rvalue >= ? OR"\
240 " NOT EXISTS (SELECT 1 FROM gn090 FORCE INDEX (idx_anonLevel_type_rvalue) WHERE anonLevel=0 AND type=? AND rvalue>=?)) "\
241 "ORDER BY rvalue ASC LIMIT 1"
237 struct GNUNET_MysqlStatementHandle *zero_iter; 242 struct GNUNET_MysqlStatementHandle *zero_iter;
238 243
239#define SELECT_IT_EXPIRATION "(SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 WHERE expire < ? ORDER BY prio ASC LIMIT 1) "\ 244#define SELECT_IT_EXPIRATION "SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 FORCE INDEX (idx_expire) WHERE expire < ? ORDER BY expire ASC LIMIT 1"
240 "UNION "\
241 "(SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 ORDER BY prio ASC LIMIT 1) "\
242 "ORDER BY expire ASC LIMIT 1"
243 struct GNUNET_MysqlStatementHandle *select_expiration; 245 struct GNUNET_MysqlStatementHandle *select_expiration;
244 246
245 // select type from (select rand() as v) AS t1 INNER JOIN gn090 ON expire>=t1.v limit 1; 247#define SELECT_IT_PRIORITY "SELECT type,prio,anonLevel,expire,hash,value,uid FROM gn090 FORCE INDEX (idx_prio) ORDER BY prio ASC LIMIT 1"
248 struct GNUNET_MysqlStatementHandle *select_priority;
246 249
247#define SELECT_IT_REPLICATION "SELECT type,prio,anonLevel,expire,hash,value,uid FROM "\ 250#define SELECT_IT_REPLICATION "SELECT type,prio,anonLevel,expire,hash,value,uid "\
248 "(SELECT RAND() AS v) AS t1 INNER JOIN "\ 251 "FROM gn090 FORCE INDEX (idx_repl_rvalue) "\
249 "(SELECT MAX(repl) AS m FROM gn090) AS t2 INNER JOIN "\ 252 "WHERE repl=? AND "\
250 "gn090 ON repl=t2.m AND"\ 253 " (rvalue>=? OR"\
251 " (rvalue>=t1.v OR"\ 254 " NOT EXISTS (SELECT 1 FROM gn090 FORCE INDEX (idx_repl_rvalue) WHERE repl=? AND rvalue>=?)) "\
252 " NOT EXISTS (SELECT 1 FROM gn090 WHERE repl=t2.m AND rvalue>=t1.v))"\
253 "ORDER BY rvalue ASC "\ 255 "ORDER BY rvalue ASC "\
254 "LIMIT 1" 256 "LIMIT 1"
255 struct GNUNET_MysqlStatementHandle *select_replication; 257 struct GNUNET_MysqlStatementHandle *select_replication;
256 258
259#define SELECT_MAX_REPL "SELECT MAX(repl) FROM gn090"
260 struct GNUNET_MysqlStatementHandle *max_repl;
261
257}; 262};
258 263
259 264
@@ -854,6 +859,8 @@ mysql_plugin_put (void *cls,
854 unsigned int ipriority = priority; 859 unsigned int ipriority = priority;
855 unsigned int ianonymity = anonymity; 860 unsigned int ianonymity = anonymity;
856 unsigned long long lexpiration = expiration.abs_value; 861 unsigned long long lexpiration = expiration.abs_value;
862 unsigned long long lrvalue = (unsigned long long) GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
863 UINT64_MAX);
857 unsigned long hashSize; 864 unsigned long hashSize;
858 unsigned long hashSize2; 865 unsigned long hashSize2;
859 unsigned long lsize; 866 unsigned long lsize;
@@ -877,6 +884,7 @@ mysql_plugin_put (void *cls,
877 MYSQL_TYPE_LONG, &ipriority, GNUNET_YES, 884 MYSQL_TYPE_LONG, &ipriority, GNUNET_YES,
878 MYSQL_TYPE_LONG, &ianonymity, GNUNET_YES, 885 MYSQL_TYPE_LONG, &ianonymity, GNUNET_YES,
879 MYSQL_TYPE_LONGLONG, &lexpiration, GNUNET_YES, 886 MYSQL_TYPE_LONGLONG, &lexpiration, GNUNET_YES,
887 MYSQL_TYPE_LONGLONG, &lrvalue, GNUNET_YES,
880 MYSQL_TYPE_BLOB, key, hashSize, &hashSize, 888 MYSQL_TYPE_BLOB, key, hashSize, &hashSize,
881 MYSQL_TYPE_BLOB, &vhash, hashSize2, &hashSize2, 889 MYSQL_TYPE_BLOB, &vhash, hashSize2, &hashSize2,
882 MYSQL_TYPE_BLOB, data, lsize, &lsize, 890 MYSQL_TYPE_BLOB, data, lsize, &lsize,
@@ -1234,16 +1242,16 @@ mysql_plugin_get_zero_anonymity (void *cls,
1234 PluginDatumProcessor proc, void *proc_cls) 1242 PluginDatumProcessor proc, void *proc_cls)
1235{ 1243{
1236 struct Plugin *plugin = cls; 1244 struct Plugin *plugin = cls;
1237 unsigned long long off; 1245 unsigned long long rvalue = (unsigned long long) GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
1238 1246 UINT64_MAX);
1239 off = (unsigned long long) offset;
1240 execute_select (plugin, 1247 execute_select (plugin,
1241 plugin->zero_iter, 1248 plugin->zero_iter,
1242 proc, proc_cls, 1249 proc, proc_cls,
1243 MYSQL_TYPE_LONG, &type, GNUNET_YES, 1250 MYSQL_TYPE_LONG, &type, GNUNET_YES,
1244 MYSQL_TYPE_LONGLONG, &off, GNUNET_YES, 1251 MYSQL_TYPE_LONGLONG, &rvalue, GNUNET_YES,
1252 MYSQL_TYPE_LONG, &type, GNUNET_YES,
1253 MYSQL_TYPE_LONGLONG, &rvalue, GNUNET_YES,
1245 -1); 1254 -1);
1246
1247} 1255}
1248 1256
1249 1257
@@ -1348,19 +1356,120 @@ mysql_plugin_get_replication (void *cls,
1348{ 1356{
1349 struct Plugin *plugin = cls; 1357 struct Plugin *plugin = cls;
1350 struct ReplCtx rc; 1358 struct ReplCtx rc;
1359 unsigned long long rvalue;
1360 unsigned long repl;
1361 MYSQL_BIND results;
1351 1362
1352 rc.plugin = plugin; 1363 rc.plugin = plugin;
1353 rc.proc = proc; 1364 rc.proc = proc;
1354 rc.proc_cls = proc_cls; 1365 rc.proc_cls = proc_cls;
1366 memset (&results, 0, sizeof (results));
1367 results.buffer_type = MYSQL_TYPE_LONG;
1368 results.buffer = &repl;
1369 results.is_unsigned = GNUNET_YES;
1370
1371 if (1 !=
1372 prepared_statement_run_select (plugin,
1373 plugin->max_repl,
1374 1,
1375 &results,
1376 -1))
1377 {
1378 proc (proc_cls,
1379 NULL, 0, NULL, 0, 0, 0,
1380 GNUNET_TIME_UNIT_ZERO_ABS, 0);
1381 return;
1382 }
1383
1384 rvalue = (unsigned long long) GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
1385 UINT64_MAX);
1355 execute_select (plugin, 1386 execute_select (plugin,
1356 plugin->select_replication, 1387 plugin->select_replication,
1357 &repl_proc, &rc, 1388 &repl_proc, &rc,
1389 MYSQL_TYPE_LONG, &repl, GNUNET_YES,
1390 MYSQL_TYPE_LONGLONG, &rvalue, GNUNET_YES,
1391 MYSQL_TYPE_LONG, &repl, GNUNET_YES,
1392 MYSQL_TYPE_LONGLONG, &rvalue, GNUNET_YES,
1358 -1); 1393 -1);
1359 1394
1360} 1395}
1361 1396
1362 1397
1363/** 1398/**
1399 * Context for 'expi_proc' function.
1400 */
1401struct ExpiCtx
1402{
1403
1404 /**
1405 * Plugin handle.
1406 */
1407 struct Plugin *plugin;
1408
1409 /**
1410 * Function to call for the result (or the NULL).
1411 */
1412 PluginDatumProcessor proc;
1413
1414 /**
1415 * Closure for proc.
1416 */
1417 void *proc_cls;
1418};
1419
1420
1421
1422/**
1423 * Wrapper for the processor for 'mysql_plugin_get_expiration'.
1424 * If no expired value was found, we do a second query for
1425 * low-priority content.
1426 *
1427 * @param cls closure
1428 * @param key key for the content
1429 * @param size number of bytes in data
1430 * @param data content stored
1431 * @param type type of the content
1432 * @param priority priority of the content
1433 * @param anonymity anonymity-level for the content
1434 * @param expiration expiration time for the content
1435 * @param uid unique identifier for the datum;
1436 * maybe 0 if no unique identifier is available
1437 *
1438 * @return GNUNET_SYSERR to abort the iteration, GNUNET_OK to continue
1439 * (continue on call to "next", of course),
1440 * GNUNET_NO to delete the item and continue (if supported)
1441 */
1442static int
1443expi_proc (void *cls,
1444 const GNUNET_HashCode *key,
1445 uint32_t size,
1446 const void *data,
1447 enum GNUNET_BLOCK_Type type,
1448 uint32_t priority,
1449 uint32_t anonymity,
1450 struct GNUNET_TIME_Absolute expiration,
1451 uint64_t uid)
1452{
1453 struct ExpiCtx *rc = cls;
1454 struct Plugin *plugin = rc->plugin;
1455
1456 if (NULL == key)
1457 {
1458 execute_select (plugin,
1459 plugin->select_priority,
1460 rc->proc, rc->proc_cls,
1461 -1);
1462 return GNUNET_SYSERR;
1463 }
1464 return rc->proc (rc->proc_cls,
1465 key,
1466 size, data,
1467 type, priority, anonymity, expiration,
1468 uid);
1469}
1470
1471
1472/**
1364 * Get a random item for expiration. 1473 * Get a random item for expiration.
1365 * Call 'proc' with all values ZERO or NULL if the datastore is empty. 1474 * Call 'proc' with all values ZERO or NULL if the datastore is empty.
1366 * 1475 *
@@ -1374,11 +1483,15 @@ mysql_plugin_get_expiration (void *cls,
1374{ 1483{
1375 struct Plugin *plugin = cls; 1484 struct Plugin *plugin = cls;
1376 long long nt; 1485 long long nt;
1377 1486 struct ExpiCtx rc;
1487
1488 rc.plugin = plugin;
1489 rc.proc = proc;
1490 rc.proc_cls = proc_cls;
1378 nt = (long long) GNUNET_TIME_absolute_get().abs_value; 1491 nt = (long long) GNUNET_TIME_absolute_get().abs_value;
1379 execute_select (plugin, 1492 execute_select (plugin,
1380 plugin->select_expiration, 1493 plugin->select_expiration,
1381 proc, proc_cls, 1494 expi_proc, &rc,
1382 MYSQL_TYPE_LONGLONG, &nt, GNUNET_YES, 1495 MYSQL_TYPE_LONGLONG, &nt, GNUNET_YES,
1383 -1); 1496 -1);
1384 1497
@@ -1433,7 +1546,7 @@ libgnunet_plugin_datastore_mysql_init (void *cls)
1433 " prio INT(11) UNSIGNED NOT NULL DEFAULT 0," 1546 " prio INT(11) UNSIGNED NOT NULL DEFAULT 0,"
1434 " anonLevel INT(11) UNSIGNED NOT NULL DEFAULT 0," 1547 " anonLevel INT(11) UNSIGNED NOT NULL DEFAULT 0,"
1435 " expire BIGINT UNSIGNED NOT NULL DEFAULT 0," 1548 " expire BIGINT UNSIGNED NOT NULL DEFAULT 0,"
1436 " rvalue DOUBLE UNSIGNED NOT NULL," 1549 " rvalue BIGINT UNSIGNED NOT NULL,"
1437 " hash BINARY(64) NOT NULL DEFAULT ''," 1550 " hash BINARY(64) NOT NULL DEFAULT '',"
1438 " vhash BINARY(64) NOT NULL DEFAULT ''," 1551 " vhash BINARY(64) NOT NULL DEFAULT '',"
1439 " value BLOB NOT NULL DEFAULT ''," 1552 " value BLOB NOT NULL DEFAULT '',"
@@ -1442,11 +1555,11 @@ libgnunet_plugin_datastore_mysql_init (void *cls)
1442 " INDEX idx_hash (hash(64))," 1555 " INDEX idx_hash (hash(64)),"
1443 " INDEX idx_hash_uid (hash(64),uid)," 1556 " INDEX idx_hash_uid (hash(64),uid),"
1444 " INDEX idx_hash_vhash (hash(64),vhash(64))," 1557 " INDEX idx_hash_vhash (hash(64),vhash(64)),"
1445 " INDEX idx_hash_type_uid (hash(64),type,uid)," 1558 " INDEX idx_hash_type_rvalue (hash(64),type,rvalue),"
1446 " INDEX idx_prio (prio)," 1559 " INDEX idx_prio (prio),"
1447 " INDEX idx_repl_rvalue (repl,rvalue)," 1560 " INDEX idx_repl_rvalue (repl,rvalue),"
1448 " INDEX idx_expire_prio (expire,prio)," 1561 " INDEX idx_expire (expire),"
1449 " INDEX idx_anonLevel_uid (anonLevel,uid)" 1562 " INDEX idx_anonLevel_type_rvalue (anonLevel,type,rvalue)"
1450 ") ENGINE=InnoDB") || 1563 ") ENGINE=InnoDB") ||
1451 MRUNS ("SET AUTOCOMMIT = 1") || 1564 MRUNS ("SET AUTOCOMMIT = 1") ||
1452 PINIT (plugin->insert_entry, INSERT_ENTRY) || 1565 PINIT (plugin->insert_entry, INSERT_ENTRY) ||
@@ -1466,6 +1579,8 @@ libgnunet_plugin_datastore_mysql_init (void *cls)
1466 || PINIT (plugin->dec_repl, DEC_REPL) 1579 || PINIT (plugin->dec_repl, DEC_REPL)
1467 || PINIT (plugin->zero_iter, SELECT_IT_NON_ANONYMOUS) 1580 || PINIT (plugin->zero_iter, SELECT_IT_NON_ANONYMOUS)
1468 || PINIT (plugin->select_expiration, SELECT_IT_EXPIRATION) 1581 || PINIT (plugin->select_expiration, SELECT_IT_EXPIRATION)
1582 || PINIT (plugin->select_priority, SELECT_IT_PRIORITY)
1583 || PINIT (plugin->max_repl, SELECT_MAX_REPL)
1469 || PINIT (plugin->select_replication, SELECT_IT_REPLICATION) ) 1584 || PINIT (plugin->select_replication, SELECT_IT_REPLICATION) )
1470 { 1585 {
1471 iclose (plugin); 1586 iclose (plugin);
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c
index 5036004b2..f551f048d 100644
--- a/src/datastore/plugin_datastore_sqlite.c
+++ b/src/datastore/plugin_datastore_sqlite.c
@@ -186,7 +186,7 @@ create_indices (sqlite3 * dbh)
186 sqlite3_exec (dbh, "CREATE INDEX IF NOT EXISTS idx_comb ON gn090 (anonLevel ASC,expire ASC,prio,type,hash)", 186 sqlite3_exec (dbh, "CREATE INDEX IF NOT EXISTS idx_comb ON gn090 (anonLevel ASC,expire ASC,prio,type,hash)",
187 NULL, NULL, NULL)) || 187 NULL, NULL, NULL)) ||
188 (SQLITE_OK != 188 (SQLITE_OK !=
189 sqlite3_exec (dbh, "CREATE INDEX IF NOT EXISTS idx_anon_type_exp ON gn090 (anonLevel ASC,type,hash)", 189 sqlite3_exec (dbh, "CREATE INDEX IF NOT EXISTS idx_anon_type_hash ON gn090 (anonLevel ASC,type,hash)",
190 NULL, NULL, NULL)) || 190 NULL, NULL, NULL)) ||
191 (SQLITE_OK != 191 (SQLITE_OK !=
192 sqlite3_exec (dbh, "CREATE INDEX IF NOT EXISTS idx_expire ON gn090 (expire ASC)", 192 sqlite3_exec (dbh, "CREATE INDEX IF NOT EXISTS idx_expire ON gn090 (expire ASC)",
@@ -357,7 +357,7 @@ database_setup (const struct GNUNET_CONFIGURATION_Handle *cfg,
357 &plugin->selExpi) != SQLITE_OK) || 357 &plugin->selExpi) != SQLITE_OK) ||
358 (sq_prepare (plugin->dbh, 358 (sq_prepare (plugin->dbh,
359 "SELECT type,prio,anonLevel,expire,hash,value,_ROWID_ " 359 "SELECT type,prio,anonLevel,expire,hash,value,_ROWID_ "
360 "FROM gn090 INDEXED BY idx_anon_type_exp " 360 "FROM gn090 INDEXED BY idx_anon_type_hash "
361 "WHERE (anonLevel = 0 AND type=?1) " 361 "WHERE (anonLevel = 0 AND type=?1) "
362 "ORDER BY hash DESC LIMIT 1 OFFSET ?2", 362 "ORDER BY hash DESC LIMIT 1 OFFSET ?2",
363 &plugin->selZeroAnon) != SQLITE_OK) || 363 &plugin->selZeroAnon) != SQLITE_OK) ||