Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-18753

Deleted docs become un-deleted after closing/re-opening database

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 4.5.0
    • 4.5.0
    • forestdb
    • None
    • Untriaged
    • MacOSX 64-bit
    • Unknown
    • ForestDB: Oct 17 - Nov 4

    Description

      Deleted documents become un-deleted after reopening a database. The following test shows this; the assertion marked "// FAILS" fails because fdb_get is able to retrieve the document even though it was deleted.

      This occurs with ForestDB commit 86f7ec6e on Mac OS X 10.11.4.

      The problem goes away if I add `fdb_commit(fh, FDB_COMMIT_MANUAL_WAL_FLUSH)` before the `fdb_close` call.

      In email, Sundar said "Looks like bug in wal_restore on file open – its pulling out deleted documents and restoring them as normal."

      #define check(X) assert((X) == FDB_RESULT_SUCCESS)

      static void test07_DeleteDocAndReopen_LOWLEVEL()

      { const char *path = "/tmp/fdb_test07_DeleteDocAndReopen_LOWLEVEL"; unlink(path); fdb_file_handle *fh; auto config = fdb_get_default_config(); check(fdb_open(&fh, path, &config)); fdb_kvs_handle *kv; check(fdb_kvs_open_default(fh, &kv, NULL)); check(fdb_begin_transaction(fh, FDB_ISOLATION_READ_COMMITTED)); check(fdb_set_kv(kv, "foo", 3, "value", 5)); check(fdb_end_transaction(fh, FDB_COMMIT_NORMAL)); void *value; size_t valueSize; check(fdb_get_kv(kv, "foo", 3, &value, &valueSize)); assert(valueSize == 5u); assert(memcmp(value, "value", 3) == 0); check(fdb_begin_transaction(fh, FDB_ISOLATION_READ_COMMITTED)); check(fdb_del_kv(kv, "foo", 3)); check(fdb_end_transaction(fh, FDB_COMMIT_NORMAL)); assert(fdb_get_kv(kv, "foo", 3, &value, &valueSize) == FDB_RESULT_KEY_NOT_FOUND); check(fdb_close(fh)); // Reopen: check(fdb_open(&fh, path, &config)); check(fdb_kvs_open_default(fh, &kv, NULL)); assert(fdb_get_kv(kv, "foo", 3, &value, &valueSize) == FDB_RESULT_KEY_NOT_FOUND); // FAILS! check(fdb_close(fh)); }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sundar Sundar Sridharan (Inactive)
            jens Jens Alfke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty