1. 21 10月, 2012 1 次提交
    • D
      Delete files outside the mutex. · 64c4b9f0
      Dhruba Borthakur 提交于
      Summary:
      The compaction process deletes a large number of files. This takes
      quite a bit of time and is best done outside the mutex lock.
      
      Test Plan:
      
      Reviewers:
      
      CC:
      
      Task ID: #
      
      Blame Rev:
      64c4b9f0
  2. 20 10月, 2012 2 次提交
    • D
      Do not enable checksums for zlib compression. · 507f5aac
      Dhruba Borthakur 提交于
      Summary:
      Leveldb code already calculates checksums for each block. There
      is no need to generate checksums inside zlib. This patch switches-off checksum generation/checking in zlib library.
      
      (The Inno support for zlib uses windowsBits=14 as well.)
      
      pfabricator marks this file as binary. But here is the diff
      
      diff --git a/port/port_posix.h b/port/port_posix.h
      index 86a0927..db4e0b8 100644
      --- a/port/port_posix.h
      +++ b/port/port_posix.h
      @@ -163,7 +163,7 @@ inline bool Snappy_Uncompress(const char* input, size_t length,
       }
      
       inline bool Zlib_Compress(const char* input, size_t length,
      -    ::std::string* output, int windowBits = 15, int level = -1,
      +    ::std::string* output, int windowBits = -14, int level = -1,
            int strategy = 0) {
       #ifdef ZLIB
         // The memLevel parameter specifies how much memory should be allocated for
      @@ -223,7 +223,7 @@ inline bool Zlib_Compress(const char* input, size_t length,
       }
      
       inline char* Zlib_Uncompress(const char* input_data, size_t input_length,
      -    int* decompress_size, int windowBits = 15) {
      +    int* decompress_size, int windowBits = -14) {
       #ifdef ZLIB
         z_stream _stream;
         memset(&_stream, 0, sizeof(z_stream));
      
      Test Plan: run db_bench with zlib compression.
      
      Reviewers: heyongqiang, MarkCallaghan
      
      Reviewed By: heyongqiang
      
      Differential Revision: https://reviews.facebook.net/D6105
      507f5aac
    • D
      db_bench was not correctly initializing the value for delete_obsolete_files_period_micros option. · cf5adc80
      Dhruba Borthakur 提交于
      Summary:
      The parameter delete_obsolete_files_period_micros controls the
      periodicity of deleting obsolete files. db_bench was reading in
      this parameter intoa local variable called 'l' but was incorrectly
      using another local variable called 'n' while setting it in the
      db.options data structure.
      This patch also logs the value of delete_obsolete_files_period_micros
      in the LOG file at db startup time.
      
      I am hoping that this will improve the overall write throughput drastically.
      
      Test Plan: run db_bench
      
      Reviewers: MarkCallaghan, heyongqiang
      
      Reviewed By: MarkCallaghan
      
      Differential Revision: https://reviews.facebook.net/D6099
      cf5adc80
  3. 18 10月, 2012 1 次提交
  4. 17 10月, 2012 1 次提交
    • D
      The deletion of obsolete files should not occur very frequently. · aa73538f
      Dhruba Borthakur 提交于
      Summary:
      The method DeleteObsolete files is a very costly methind, especially
      when the number of files in a system is large. It makes a list of
      all live-files and then scans the directory to compute the diff.
      By default, this method is executed after every compaction run.
      
      This patch makes it such that DeleteObsolete files is never
      invoked twice within a configured period.
      
      Test Plan: run all unit tests
      
      Reviewers: heyongqiang, MarkCallaghan
      
      Reviewed By: MarkCallaghan
      
      Differential Revision: https://reviews.facebook.net/D6045
      aa73538f
  5. 16 10月, 2012 1 次提交
  6. 13 10月, 2012 1 次提交
  7. 11 10月, 2012 1 次提交
    • A
      [tools] Add a tool to stress test concurrent writing to levelDB · 24f7983b
      Asad K Awan 提交于
      Summary:
      Created a tool that runs multiple threads that concurrently read and write to levelDB.
      All writes to the DB are stored in an in-memory hashtable and verified at the end of the
      test. All writes for a given key are serialzied.
      
      Test Plan:
       - Verified by writing only a few keys and logging all writes and verifying that values read and written are correct.
       - Verified correctness of value generator.
       - Ran with various parameters of number of keys, locks, and threads.
      
      Reviewers: dhruba, MarkCallaghan, heyongqiang
      
      Reviewed By: dhruba
      
      Differential Revision: https://reviews.facebook.net/D5829
      24f7983b
  8. 06 10月, 2012 2 次提交
  9. 04 10月, 2012 4 次提交
    • D
      Implement RowLocks for assoc schema · f7975ac7
      Dhruba Borthakur 提交于
      Summary:
      Each assoc is identified by (id1, assocType). This is the rowkey.
      Each row has a read/write rowlock. There is statically allocated array
      of 2000 read/write locks. A rowkey is murmur-hashed to one of the
      read/write locks.
      
      assocPut and assocDelete acquires the rowlock in Write mode.
      The key-updates are done within the rowlock with a atomic nosync
      batch write to leveldb. Then the rowlock is released and
      a write-with-sync is done to sync leveldb transaction log.
      
      Test Plan: added unit test
      
      Reviewers: heyongqiang
      
      Reviewed By: heyongqiang
      
      Differential Revision: https://reviews.facebook.net/D5859
      f7975ac7
    • D
      An configurable option to write data using write instead of mmap. · c1006d42
      Dhruba Borthakur 提交于
      Summary:
      We have seen that reading data via the pread call (instead of
      mmap) is much faster on Linux 2.6.x kernels. This patch makes
      an equivalent option to switch off mmaps for the write path
      as well.
      
      db_bench --mmap_write=0 will use write() instead of mmap() to
      write data to a file.
      
      This change is backward compatible, the default
      option is to continue using mmap for writing to a file.
      
      Test Plan: "make check all"
      
      Differential Revision: https://reviews.facebook.net/D5781
      c1006d42
    • M
      Add --stats_interval option to db_bench · e678a594
      Mark Callaghan 提交于
      Summary:
      The option is zero by default and in that case reporting is unchanged.
      By unchanged, the interval at which stats are reported is scaled after each
      report and newline is not issued after each report so one line is rewritten.
      When non-zero it specifies the constant interval (in operations) at which
      statistics are reported and the stats include the rate per interval. This
      makes it easier to determine whether QPS changes over the duration of the test.
      
      Task ID: #
      
      Blame Rev:
      
      Test Plan:
      run db_bench
      
      Revert Plan:
      
      Database Impact:
      
      Memcache Impact:
      
      Other Notes:
      
      EImportant:
      
      - begin *PUBLIC* platform impact section -
      Bugzilla: #
      - end platform impact -
      
      Reviewers: dhruba
      
      Reviewed By: dhruba
      
      CC: heyongqiang
      
      Differential Revision: https://reviews.facebook.net/D5817
      e678a594
    • M
      Fix the bounds check for the --readwritepercent option · d8763abe
      Mark Callaghan 提交于
      Summary:
      see above
      
      Task ID: #
      
      Blame Rev:
      
      Test Plan:
      run db_bench with invalid value for option
      
      Revert Plan:
      
      Database Impact:
      
      Memcache Impact:
      
      Other Notes:
      
      EImportant:
      
      - begin *PUBLIC* platform impact section -
      Bugzilla: #
      - end platform impact -
      
      Reviewers: dhruba
      
      Reviewed By: dhruba
      
      CC: heyongqiang
      
      Differential Revision: https://reviews.facebook.net/D5823
      d8763abe
  10. 03 10月, 2012 1 次提交
    • M
      Fix compiler warnings and errors in ldb.c · 98804f91
      Mark Callaghan 提交于
      Summary:
      stdlib.h is needed for exit()
      --readhead --> --readahead
      
      Task ID: #
      
      Blame Rev:
      
      Test Plan:
      compile
      
      Revert Plan:
      
      Database Impact:
      
      Memcache Impact:
      
      Other Notes:
      
      EImportant:
      
      - begin *PUBLIC* platform impact section -
      Bugzilla: #
      - end platform impact -
      fix compiler warnings & errors
      
      Reviewers: dhruba
      
      Reviewed By: dhruba
      
      CC: heyongqiang
      
      Differential Revision: https://reviews.facebook.net/D5805
      98804f91
  11. 02 10月, 2012 3 次提交
  12. 30 9月, 2012 1 次提交
  13. 29 9月, 2012 1 次提交
    • D
      Trigger read compaction only if seeks to storage are incurred. · c1bb32e1
      Dhruba Borthakur 提交于
      Summary:
      In the current code, a Get() call can trigger compaction if it has to look at more than one file. This causes unnecessary compaction because looking at more than one file is a penalty only if the file is not yet in the cache. Also, th current code counts these files before the bloom filter check is applied.
      
      This patch counts a 'seek' only if the file fails the bloom filter
      check and has to read in data block(s) from the storage.
      
      This patch also counts a 'seek' if a file is not present in the file-cache, because opening a file means that its index blocks need to be read into cache.
      
      Test Plan: unit test attached. I will probably add one more unti tests.
      
      Reviewers: heyongqiang
      
      Reviewed By: heyongqiang
      
      CC: MarkCallaghan
      
      Differential Revision: https://reviews.facebook.net/D5709
      c1bb32e1
  14. 28 9月, 2012 1 次提交
    • G
      Add db_dump tool to dump DB keys · 92368ab8
      gjain 提交于
      Summary:
      Create a tool to iterate through keys and dump values. Current options
      as follows:
      
      db_dump --start=[START_KEY] --end=[END_KEY] --max_keys=[NUM] --stats
      [PATH]
      
      START_KEY: First key to start at
      END_KEY: Key to end at (not inclusive)
      NUM: Maximum number of keys to dump
      PATH: Path to leveldb DB
      
      The --stats command line argument prints out the DB stats before dumping
      the keys.
      
      Test Plan:
      - Tested with invalid args
      - Tested with invalid path
      - Used empty DB
      - Used filled DB
      - Tried various permutations of command line options
      
      Reviewers: dhruba, heyongqiang
      
      Reviewed By: dhruba
      
      Differential Revision: https://reviews.facebook.net/D5643
      92368ab8
  15. 26 9月, 2012 2 次提交
  16. 25 9月, 2012 2 次提交
    • D
      Release 1.5.3.fb. · 26e0ecbd
      Dhruba Borthakur 提交于
      Summary:
      
      Test Plan:
      
      Reviewers:
      
      CC:
      
      Task ID: #
      
      Blame Rev:
      26e0ecbd
    • D
      The BackupAPI should also list the length of the manifest file. · ae36e509
      Dhruba Borthakur 提交于
      Summary:
      The GetLiveFiles() api lists the set of sst files and the current
      MANIFEST file. But the database continues to append new data to the
      MANIFEST file even when the application is backing it up to the
      backup location. This means that the database-version that is
      stored in the MANIFEST FILE in the backup location
      does not correspond to the sst files returned by GetLiveFiles.
      
      This API adds a new parameter to GetLiveFiles. This new parmeter
      returns the current size of the MANIFEST file.
      
      Test Plan: Unit test attached.
      
      Reviewers: heyongqiang
      
      Reviewed By: heyongqiang
      
      Differential Revision: https://reviews.facebook.net/D5631
      ae36e509
  17. 22 9月, 2012 3 次提交
    • D
      Keep symbols even for production release. · dd45b8cd
      Dhruba Borthakur 提交于
      Summary:
      Keeping symbols in the binary increases the size of the library but makes
      it easier to debug. The optimization level is still -O2, so this should
      have no impact on performance.
      
      Test Plan: make all
      
      Reviewers: heyongqiang, MarkCallaghan
      
      Reviewed By: MarkCallaghan
      
      CC: MarkCallaghan
      
      Differential Revision: https://reviews.facebook.net/D5601
      dd45b8cd
    • D
      Release 1.5.2.fb · 653add3c
      Dhruba Borthakur 提交于
      Summary:
      
      Test Plan:
      
      Reviewers:
      
      CC:
      
      Task ID: #
      
      Blame Rev:
      653add3c
    • D
      Segfault in DoCompactionWork caused by buffer overflow · bb2dcd24
      Dhruba Borthakur 提交于
      Summary:
      The code was allocating 200 bytes on the stack but it
      writes 256 bytes into the array.
      
      x8a8ea5 std::_Rb_tree<>::erase()
          @     0x7f134bee7eb0 (unknown)
          @           0x8a8ea5 std::_Rb_tree<>::erase()
          @           0x8a35d6 leveldb::DBImpl::CleanupCompaction()
          @           0x8a7810 leveldb::DBImpl::BackgroundCompaction()
          @           0x8a804d leveldb::DBImpl::BackgroundCall()
          @           0x8c4eff leveldb::(anonymous namespace)::PosixEnv::BGThreadWrapper()
          @     0x7f134b3c010d start_thread
          @     0x7f134bf9f10d clone
      
      Test Plan: run db_bench with overwrite option
      
      Reviewers: heyongqiang
      
      Reviewed By: heyongqiang
      
      Differential Revision: https://reviews.facebook.net/D5595
      bb2dcd24
  18. 20 9月, 2012 1 次提交
    • D
      Allow a configurable number of background threads. · 9e84834e
      Dhruba Borthakur 提交于
      Summary:
      The background threads are necessary for compaction.
      For slower storage, it might be necessary to have more than
      one compaction thread per DB. This patch allows creating
      a configurable number of worker threads.
      The default reamins at 1 (to maintain backward compatibility).
      
      Test Plan:
      run all unit tests. changes to db-bench coming in
      a separate patch.
      
      Reviewers: heyongqiang
      
      Reviewed By: heyongqiang
      
      CC: MarkCallaghan
      
      Differential Revision: https://reviews.facebook.net/D5559
      9e84834e
  19. 19 9月, 2012 1 次提交
  20. 18 9月, 2012 7 次提交
  21. 17 9月, 2012 2 次提交
  22. 15 9月, 2012 1 次提交
    • M
      Remove use of mmap for random reads · 33323f21
      Mark Callaghan 提交于
      Summary:
      Reads via mmap on concurrent workloads are much slower than pread.
      For example on a 24-core server with storage that can do 100k IOPS or more
      I can get no more than 10k IOPS with mmap reads and 32+ threads.
      
      Test Plan: db_bench benchmarks
      
      Reviewers: dhruba, heyongqiang
      
      Reviewed By: heyongqiang
      
      Differential Revision: https://reviews.facebook.net/D5433
      33323f21