1. 07 3月, 2014 4 次提交
    • K
      More precise calculation of sub_index_size · 566f18e6
      Kai Liu 提交于
      Summary:
      Previous we did rough estimation of subindex size, which in worst case may result in array reallocation.
      This patch aims to get the exact size and avoid any reallocation.
      
      Test Plan: make all check
      
      Reviewers: sdong, dhruba, haobo
      
      Reviewed By: haobo
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D16125
      566f18e6
    • S
      Fix Valgrind error introduced by D16515 · e1f52b6a
      sdong 提交于
      Summary: valgrind reports issues. This patch seems to fix it.
      
      Test Plan: run the tests that fails in valgrind
      
      Reviewers: igor, haobo, kailiu
      
      Reviewed By: kailiu
      
      CC: dhruba, ljin, yhchiang, leveldb
      
      Differential Revision: https://reviews.facebook.net/D16653
      e1f52b6a
    • I
      Truncate unused space on PosixWritableFile::Close() · 26ac5603
      Igor Canadi 提交于
      Summary:
      Blocks allocated with fallocate will take extra space on disk even if they are unused and the file is close.
      
      Now we remove the extra blocks at the end of the file by calling `ftruncate`.
      
      Test Plan: added a test to env_test
      
      Reviewers: dhruba
      
      Reviewed By: dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D16647
      26ac5603
    • I
      DB Sanity Test · 9c8ad626
      Igor Canadi 提交于
      Summary:
      @kailiu mentioned on meeting yesterday that we sometimes have trouble opening DB created by old version with the new version. This will be very important to test for column families, since I'm changing disk format for the MANIFEST.
      
      I added a tool that can help us test that. Usage:
      ./db_sanity_test <path> create
      will create a bunch of DBs under <path>
      <change RocksDB version>
      ./db_sanity_test <path> verify
      will verify consistency of DBs created under <path>
      
      Test Plan: ran the db_sanity_test
      
      Reviewers: kailiu, dhruba, haobo
      
      Reviewed By: kailiu
      
      CC: leveldb, kailiu, xjin
      
      Differential Revision: https://reviews.facebook.net/D16605
      9c8ad626
  2. 06 3月, 2014 9 次提交
    • K
      Make sure GetUniqueID releated tests run on "regular" storage · abeee9f2
      Kai Liu 提交于
      Summary:
      With the use of tmpfs or ramfs, unit tests related to GetUniqueID()
      failed because of the failure from ioctl, which doesn't work with these
      fancy file systems at all.
      
      I fixed this issue and make sure all related tests run on the "regular"
      storage (disk or flash).
      
      Test Plan: TEST_TMPDIR=/dev/shm make check -j32
      
      Reviewers: igor, dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D16593
      abeee9f2
    • S
      Buffer info logs when picking compactions and write them out after releasing the mutex · ecb1ffa2
      sdong 提交于
      Summary: Now while the background thread is picking compactions, it writes out multiple info_logs, especially for universal compaction, which introduces a chance of waiting log writing in mutex, which is bad. To remove this risk, write all those info logs to a buffer and flush it after releasing the mutex.
      
      Test Plan:
      make all check
      check the log lines while running some tests that trigger compactions.
      
      Reviewers: haobo, igor, dhruba
      
      Reviewed By: dhruba
      
      CC: i.am.jin.lei, dhruba, yhchiang, leveldb, nkg-
      
      Differential Revision: https://reviews.facebook.net/D16515
      ecb1ffa2
    • S
      Allow user to specify log level for info_log · 4405f3a0
      sdong 提交于
      Summary:
      Currently, there is no easy way for user to change log level of info log. Add a parameter in options to specify that.
      Also make the default level to INFO level. Removing the [INFO] tag if it is INFO level as I don't want to cause performance regression. (add [LOG] means another mem-copy and string formatting).
      
      Test Plan:
      make all check
      manual check the levels work as expected.
      
      Reviewers: dhruba, yhchiang
      
      Reviewed By: yhchiang
      
      CC: dhruba, igor, i.am.jin.lei, ljin, haobo, leveldb
      
      Differential Revision: https://reviews.facebook.net/D16563
      4405f3a0
    • I
      Merge pull request #47 from mlin/kCompactionStopStyleSimilarSize · 8ca30bd5
      Igor Canadi 提交于
      An initial implementation of kCompactionStopStyleSimilarSize for universal compaction
      8ca30bd5
    • L
      output perf_context in db_bench readrandom · 04298f8c
      Lei Jin 提交于
      Summary:
      Add helper function to print perf context data in db_bench if enabled.
      I didn't find any code that actually exports perf context data. Not sure
      if I missed anything
      
      Test Plan: ran db_bench
      
      Reviewers: haobo, sdong, igor
      
      Reviewed By: igor
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D16575
      04298f8c
    • L
      fix db_bench to use HashSkipList for real · 64138b5d
      Lei Jin 提交于
      Summary:
      For HashSkipList case, DBImpl has sanity check to see if prefix_extractor in
      options is the same as the one in memtable factory. If not, it falls
      back to SkipList. As result, I was experimenting with SkipList
      performance. No wonder it is much worse than LinkedList
      
      Test Plan: ran benchmark
      
      Reviewers: haobo, sdong, igor
      
      Reviewed By: igor
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D16569
      64138b5d
    • L
      config max_background_flushes in db_bench · 51560ba7
      Lei Jin 提交于
      Summary: as title
      
      Test Plan: make release
      
      Reviewers: haobo, sdong, igor
      
      Reviewed By: haobo
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D16437
      51560ba7
    • I
      MergingIterator assertion · c0ccf436
      Igor Canadi 提交于
      Summary: I wrote a test that triggers assertion in MergingIterator. I have not touched that code ever, so I'm looking for somebody with good understanding of the MergingIterator code to fix this. The solution is probably a one-liner. Let me know if you're willing to take a look.
      
      Test Plan: This test fails with an assertion `use_heap_ == false`
      
      Reviewers: dhruba, haobo, sdong, kailiu
      
      Reviewed By: sdong
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D16521
      c0ccf436
    • I
      CloseDB in BackupableDBTest to make valgrind happy · 2b5155fb
      Igor Canadi 提交于
      2b5155fb
  3. 05 3月, 2014 4 次提交
  4. 04 3月, 2014 6 次提交
    • K
      Uncomment the unit tests in table test · a1d56e73
      kailiu 提交于
      a1d56e73
    • K
      Add a hash-index component for block · 906f3dca
      kailiu 提交于
      Summary:
      this is the key component extracted from diff: https://reviews.facebook.net/D14271
      I separate it to a dedicated patch to make the review easier.
      
      Test Plan: added a unit test and passed it.
      
      Reviewers: haobo, sdong, dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D16245
      906f3dca
    • K
      Get rid of all optimization flags in debug mode · 6b9da48a
      kailiu 提交于
      6b9da48a
    • S
      Fix issue with iterator operations in this order: Prev(), Seek(), Prev() · f0ee2356
      sdong 提交于
      Summary:
      Due to a bad merge of D14163 and D14001 before checking in D14001, "direction_ = kForward;" in MergeIterator::Seek() was deleted my mistake (in commit b135d01e ). It will generate wrong results or assert failure after the sequence of Prev() (or SeekToLast()), Seek() and Prev().
      
      Fix it
      
      Test Plan: make all check
      
      Reviewers: igor, haobo, dhruba
      
      Reviewed By: igor
      
      CC: yhchiang, i.am.jin.lei, ljin, leveldb
      
      Differential Revision: https://reviews.facebook.net/D16527
      f0ee2356
    • I
      Fix a group commit bug in LogAndApply · 5142b370
      Igor Canadi 提交于
      Summary:
      EncodeTo(&record) does not overwrite, it appends to it.
      
      This means that group commit log and apply will look something like:
      record1
      record1record2
      record1record2record3
      
      I'm surprised this didn't show up in production, but I think the reason is that MANIFEST group commit almost never happens.
      
      This bug turned up in column family work, where opening a database failed with "adding a same column family twice".
      
      Test Plan: Tested the change in column family branch and observed that the problem is gone (with db_stress)
      
      Reviewers: dhruba, haobo
      
      Reviewed By: dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D16461
      5142b370
    • I
      Reopen DB in crash test · 97eddef2
      Igor Canadi 提交于
      Summary:
      Why don't we automatically reopen DB when running crash test (running in our nightly build)? If I understand correctly, crashtest is manually reopenning the DB, but then the DB does not check its consistency when you kill db_stress process and then re-run it again.
      Does this make sense?
      
      Test Plan: not reall
      
      Reviewers: dhruba, haobo, emayanke
      
      Reviewed By: emayanke
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D16167
      97eddef2
  5. 02 3月, 2014 2 次提交
  6. 01 3月, 2014 5 次提交
    • K
      Fix the unit test failure in devbox · ff151132
      Kai Liu 提交于
      Summary:
      My last diff was developed in MacOS but in devserver environment error occurs.
      
      I dug into the problem and found the way we calcuate approximate data size is pretty out-of-date. We can use table properties to get more accurate results.
      
      Test Plan: ran ./table_test and passed
      
      Reviewers: igor, dhruba, haobo, sdong
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D16509
      ff151132
    • K
      Make the block-based table's index pluggable · 74939a9e
      kailiu 提交于
      Summary:
      This patch introduced a new table options that allows us to make
      block-based table's index pluggable.
      
      To support that new features:
      
      * Code has been refacotred to be more flexible and supports this option well.
      * More documentation is added for the existing obsecure functionalities.
      * Big surgeon on DataBlockReader(), where the logic was really convoluted.
      * Other small code cleanups.
      
      The pluggablility will mostly affect development of internal modules
      and won't change frequently, as a result I intentionally avoid
      heavy-weight patterns (like factory) and try to make it simple.
      
      Test Plan: make all check
      
      Reviewers: haobo, sdong
      
      Reviewed By: sdong
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D16395
      74939a9e
    • K
      Remove the terrible hack in for flush_block_policy_factory · bf86af51
      kailiu 提交于
      Summary:
      Previous code is too convoluted and I must be drunk for letting
      such code to be written without a second thought.
      
      Thanks to the discussion with @sdong, I added the `Options` when
      generating the flusher, thus avoiding the tricks.
      
      Just FYI: I resisted to add Options in flush_block_policy.h since I
      wanted to avoid cyclic dependencies: FlushBlockPolicy dpends on Options
      and Options also depends FlushBlockPolicy... While I appreciate my
      effort to prevent it, the old design turns out creating more troubles than
      it tried to avoid.
      
      Test Plan: ran ./table_test
      
      Reviewers: sdong
      
      Reviewed By: sdong
      
      CC: sdong, leveldb
      
      Differential Revision: https://reviews.facebook.net/D16503
      bf86af51
    • I
      Make Log::Reader more robust · 58ca641d
      Igor Canadi 提交于
      Summary:
      This diff does two things:
      (1) Log::Reader does not report a corruption when the last record in a log or manifest file is truncated (meaning that log writer died in the middle of the write). Inherited the code from LevelDB: https://code.google.com/p/leveldb/source/detail?r=269fc6ca9416129248db5ca57050cd5d39d177c8#
      (2) Turn off mmap writes for all writes to log and manifest files
      
      (2) is necessary because if we use mmap writes, the last record is not truncated, but is actually filled with zeros, making checksum fail. It is hard to recover from checksum failing.
      
      Test Plan:
      Added unit tests from LevelDB
      Actually recovered a "corrupted" MANIFEST file.
      
      Reviewers: dhruba, haobo
      
      Reviewed By: haobo
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D16119
      58ca641d
    • Y
      Add ReadOptions to TransactionLogIterator. · a77527f2
      Yueh-Hsuan Chiang 提交于
      Summary:
      Add an optional input parameter ReadOptions to DB::GetUpdateSince(),
      which allows the verification of checksums to be disabled by setting
      ReadOptions::verify_checksums to false.
      
      Test Plan: Tests are done off-line and will not be included in the regular unit test.
      
      Reviewers: igor
      
      Reviewed By: igor
      
      CC: leveldb, xjin, dhruba
      
      Differential Revision: https://reviews.facebook.net/D16305
      a77527f2
  7. 28 2月, 2014 4 次提交
  8. 27 2月, 2014 4 次提交
    • K
      Make sure logger is safely released in `InfoLogLevel` · e41c060a
      kailiu 提交于
      Summary: fix the memory leak that was captured by jenkin build.
      
      Test Plan: ran the valgrind test locally
      
      Reviewers: yhchiang
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D16389
      e41c060a
    • K
      Fix inconsistent code format · 444cafc2
      kailiu 提交于
      Summary:
      Found some function follows camel style. When naming funciton, we have two styles:
      
      Trivially expose internal data in readonly mode: `all_lower_case()`
      Regular function: `CapitalizeFirstLetter()`
      
      I renames these functions.
      
      Test Plan: make -j32
      
      Reviewers: haobo, sdong, dhruba, igor
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D16383
      444cafc2
    • S
      PlainTable::Next() should pass the error message from ReadKey() · a04dbf6e
      sdong 提交于
      Summary:
      PlainTable::Next() should pass the error message from ReadKey(). Now it would return a wrong error message.
      Also improve the messages of status when failing to read
      
      Test Plan: make all check
      
      Reviewers: ljin, kailiu, haobo
      
      Reviewed By: kailiu
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D16365
      a04dbf6e
    • Y
      Enable log info with different levels. · ccaedd16
      Yueh-Hsuan Chiang 提交于
      Summary:
      * Now each Log related function has a variant that takes an additional
        argument indicating its log level, which is one of the following:
       - DEBUG, INFO, WARN, ERROR, FATAL.
      
      * To ensure backward-compatibility, old version Log functions are kept
        unchanged.
      
      * Logger now has a member variable indicating its log level.  Any incoming
        Log request which log level is lower than Logger's log level will not
        be output.
      
      * The output of the newer version Log will be prefixed by its log level.
      
      Test Plan:
      Add a LogType test in auto_roll_logger_test.cc
      
       = Sample log output =
          2014/02/11-00:03:07.683895 7feded179840 [DEBUG] this is the message to be written to the log file!!
          2014/02/11-00:03:07.683898 7feded179840 [INFO] this is the message to be written to the log file!!
          2014/02/11-00:03:07.683900 7feded179840 [WARN] this is the message to be written to the log file!!
          2014/02/11-00:03:07.683903 7feded179840 [ERROR] this is the message to be written to the log file!!
          2014/02/11-00:03:07.683906 7feded179840 [FATAL] this is the message to be written to the log file!!
      
      Reviewers: dhruba, xjin, kailiu
      
      Reviewed By: kailiu
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D16071
      ccaedd16
  9. 26 2月, 2014 2 次提交
    • L
      thread local pointer storage · b2795b79
      Lei Jin 提交于
      Summary:
      This is not a generic thread local implementation in the sense that it
      only takes pointer. But it does support multiple instances per thread
      and lets user plugin function to perform cleanup when thread exits or an
      instance gets destroyed.
      
      Test Plan: unit test for now
      
      Reviewers: haobo, igor, sdong, dhruba
      
      Reviewed By: igor
      
      CC: leveldb, kailiu
      
      Differential Revision: https://reviews.facebook.net/D16131
      b2795b79
    • I
      Schedule flush when waiting on flush · 42095163
      Igor Canadi 提交于
      Summary:
      This will also help with avoiding the deadlock. If a flush failed and we're waiting for a memtable to be flushed, we should schedule a new flush and hope a new one succeedes.
      
      If paranoid_checks = false, Wait() will still hang on ENOSPC, but at least it will automatically continue when the space frees up. Current behavior both hangs and deadlocks.
      
      Also, I renamed some 'compaction' to 'flush'. 'compaction' was leveldb way of saying things.
      
      Test Plan: make check
      
      Reviewers: dhruba, haobo, ljin
      
      Reviewed By: haobo
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D16281
      42095163