Commit 215d94f8 authored by Yoni Fogel's avatar Yoni Fogel

Addresses #123

DB->del deletes silently anything out of date.
If DB->del deletes everything silently (doesn't find anything that was not out of date), it returns DB_NOTFOUND

git-svn-id: file:///svn/tokudb@973 c7de825b-a66e-492c-adef-691d508d4ae1
parent 9a7cf6a1
...@@ -811,6 +811,7 @@ static int toku_db_del(DB * db, DB_TXN * txn, DBT * key, u_int32_t flags) { ...@@ -811,6 +811,7 @@ static int toku_db_del(DB * db, DB_TXN * txn, DBT * key, u_int32_t flags) {
if ((brtflags & TOKU_DB_DUPSORT) || (brtflags & TOKU_DB_DUP)) { if ((brtflags & TOKU_DB_DUPSORT) || (brtflags & TOKU_DB_DUP)) {
int r2; int r2;
DBC *dbc; DBC *dbc;
BOOL found = FALSE;
/* If we are deleting all copies from a secondary with duplicates, /* If we are deleting all copies from a secondary with duplicates,
* We have to make certain we cascade all the deletes. */ * We have to make certain we cascade all the deletes. */
...@@ -823,11 +824,12 @@ static int toku_db_del(DB * db, DB_TXN * txn, DBT * key, u_int32_t flags) { ...@@ -823,11 +824,12 @@ static int toku_db_del(DB * db, DB_TXN * txn, DBT * key, u_int32_t flags) {
while (r==0) { while (r==0) {
r = dbc->c_del(dbc, 0); r = dbc->c_del(dbc, 0);
if (r!=0) goto cleanup; if (r==0) found = TRUE;
if (r!=0 && r!=DB_KEYEMPTY) goto cleanup;
r = toku_c_get_noassociate(dbc, key, &data, DB_NEXT_DUP); r = toku_c_get_noassociate(dbc, key, &data, DB_NEXT_DUP);
if (r == DB_NOTFOUND) { if (r == DB_NOTFOUND) {
//Already deleted at least one. Quit out. //If we deleted at least one we're happy. Quit out.
r = 0; if (found) r = 0;
goto cleanup; goto cleanup;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment