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

Don't immediately remove temp initial/deleted items from HashTable

    XMLWordPrintable

Details

    • 1

    Description

      (As highlighted by a recent CBSE)

      If running in full-eviction and Bloom filters are either not available (e.g. MB-40172), or user is accessing a key which is missing the filter, then we attempt to bgFetch the item from disk. If the bgfetch finds the item doesn't exist, we discard from the HashTable as soon as the response has been generated for the user - e.g.:

      cb::EngineErrorItemPair EventuallyPersistentEngine::get(
              CookieIface& cookie,
              const DocKey& key,
              Vbid vbucket,
              DocStateFilter documentStateFilter) {
          auto options = static_cast<get_options_t>(
                  QUEUE_BG_FETCH | HONOR_STATES | TRACK_REFERENCE | DELETE_TEMP |
                  HIDE_LOCKED_CAS | TRACK_STATISTICS);
      ...
      

      GetValue VBucket::getInternal(...) {
      ...
              // If SV is otherwise a temp non-existent (i.e. a marker added after a
              // BgFetch to note that no such item exists) or temp deleted, then we
              // should cleanup the SV (if requested) before returning ENOENT (so we
              // don't keep temp items in HT).
              if (v->isTempDeletedItem() || v->isTempNonExistentItem()) {
                  if (options & DELETE_TEMP) {
                      deleteStoredValue(res.lock, *v);
                  }
                  return {};
              }
      

      While there is merit in keeping the HashTable free of items we "shouldn't need" again - reducing how often the ItemPager must run to clean it up - in this scenario we are discarding useful information - another request for the same key in the future would have to go back to disk again (and again, and again...); when we could avoid that by keeping the temp_non_existent item in the HashTable.

      Attachments

        Issue Links

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

          Activity

            People

              owend Daniel Owen
              drigby Dave Rigby (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty