Revision 9d9d2965cb4df6163624a31d2b5dd7364813f27f authored by Yueh-Hsuan Chiang on 30 April 2014, 00:13:46 UTC, committed by Yueh-Hsuan Chiang on 30 April 2014, 00:13:46 UTC
Summary:
= Major Changes =
* Add a new mem-table representation, HashCuckooRep, which is based cuckoo hash.
  Cuckoo hash uses multiple hash functions.  This allows each key to have multiple
  possible locations in the mem-table.

  - Put: When insert a key, it will try to find whether one of its possible
    locations is vacant and store the key.  If none of its possible
    locations are available, then it will kick out a victim key and
    store at that location.  The kicked-out victim key will then be
    stored at a vacant space of its possible locations or kick-out
    another victim.  In this diff, the kick-out path (known as
    cuckoo-path) is found using BFS, which guarantees to be the shortest.

 - Get: Simply tries all possible locations of a key --- this guarantees
   worst-case constant time complexity.

 - Time complexity: O(1) for Get, and average O(1) for Put if the
   fullness of the mem-table is below 80%.

 - Default using two hash functions, the number of hash functions used
   by the cuckoo-hash may dynamically increase if it fails to find a
   short-enough kick-out path.

 - Currently, HashCuckooRep does not support iteration and snapshots,
   as our current main purpose of this is to optimize point access.

= Minor Changes =
* Add IsSnapshotSupported() to DB to indicate whether the current DB
  supports snapshots.  If it returns false, then DB::GetSnapshot() will
  always return nullptr.

Test Plan:
Run existing tests.  Will develop a test specifically for cuckoo hash in
the next diff.

Reviewers: sdong, haobo

Reviewed By: sdong

CC: leveldb, dhruba, igor

Differential Revision: https://reviews.facebook.net/D16155
1 parent f1c9aa6
History
File Mode Size
auto_sanity_test.sh -rwxr-xr-x 2.1 KB
blob_store_bench.cc -rw-r--r-- 7.5 KB
db_crashtest.py -rw-r--r-- 4.8 KB
db_crashtest2.py -rw-r--r-- 5.7 KB
db_repl_stress.cc -rw-r--r-- 4.0 KB
db_sanity_test.cc -rw-r--r-- 5.5 KB
db_stress.cc -rw-r--r-- 58.0 KB
ldb.cc -rw-r--r-- 424 bytes
ldb_test.py -rw-r--r-- 17.0 KB
reduce_levels_test.cc -rw-r--r-- 4.9 KB
sst_dump.cc -rw-r--r-- 10.8 KB

back to top