1. 23 10月, 2013 2 次提交
    • M
      Dbid feature · 9b50106f
      Mayank Agarwal 提交于
      Summary:
      Create a new type of file on startup if it doesn't already exist called DBID.
      This will store a unique number generated from boost library's uuid header file.
      The use-case is to identify the case of a db losing all its data and coming back up either empty or from an image(backup/live replica's recovery)
      the key point to note is that DBID is not stored in a backup or db snapshot
      It's preferable to use Boost for uuid because:
      1) A non-standard way of generating uuid is not good
      2) /proc/sys/kernel/random/uuid generates a uuid but only on linux environments and the solution would not be clean
      3) c++ doesn't have any direct way to get a uuid
      4) Boost is a very good library that was already having linkage in rocksdb from third-party
      Note: I had to update the TOOLCHAIN_REV in build files to get latest verison of boost from third-party as the older version had a bug.
      I had to put Wno-uninitialized in Makefile because boost-1.51 has an unitialized variable and rocksdb would not comiple otherwise. Latet open-source for boost is 1.54 but is not there in third-party. I have notified the concerned people in fbcode about it.
      @kailiu : While releasing to third-party, an additional dependency will need to be created for boost in TARGETS file. I can help identify.
      
      Test Plan:
      Expand db_test to test 2 cases
      1) Restarting db with Id file present - verify that no change to Id
      2)Restarting db with Id file deleted - verify that a different Id is there after reopen
      Also run make all check
      
      Reviewers: dhruba, haobo, kailiu, sdong
      
      Reviewed By: dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D13587
      9b50106f
    • M
      Disallow transaction log iterator to skip sequences · ae8e0770
      Mayank Agarwal 提交于
      Summary:
      This is expected to solve the "gaps in transaction log iterator" problem.
      * After a lot of observations on the gaps on the sigmafio machines I found that it is due to a race between log reader and writer always.
      * So when we drop the wormhole subscription and refresh the iterator, the gaps are not there.
      * It is NOT due to some boundary or corner case left unattended in the iterator logic because I checked many instances of the gaps against their log files with ldb. The log files are NOT corrupted also.
      * The solution is to not allow the iterator to read incompletely written sequences and detect gaps inside itself and invalidate it which will cause the application to refresh the iterator normally and seek to the required sequence properly.
      * Thus, the iterator can at least guarantee that it will not give any gaps.
      
      Test Plan:
      * db_test based log iterator tests
      * db_repl_stress
      * testing on sigmafio setup to see gaps go away
      
      Reviewers: dhruba, haobo
      
      Reviewed By: dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D13593
      ae8e0770
  2. 22 10月, 2013 1 次提交
  3. 21 10月, 2013 1 次提交
  4. 18 10月, 2013 4 次提交
    • I
      tmpfs does not support fallocate · bcc85579
      Igor Canadi 提交于
      Summary: This caused Siying's unit test to fail.
      
      Test Plan: Unittest
      
      Reviewers: dhruba, kailiu, haobo
      
      Reviewed By: dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D13539
      bcc85579
    • S
      Fix Bug: iterator.Prev() or iterator.SeekToLast() might return the first... · 65428b0c
      Siying Dong 提交于
      Fix Bug: iterator.Prev() or iterator.SeekToLast() might return the first element instead of the correct one
      
      Summary:
      Recent patch https://reviews.facebook.net/D11865 introduced a regression bug:
      
      DBIter::FindPrevUserEntry(), which is called by DBIter::Prev() (and also implicitly if calling iterator.SeekToLast())  might do issue a seek when having skipped too many entries. If the skipped entry just before the seek() is a delete, the saved key is erased so that it seeks to the front, so Prev() would return the first element.
      
      This patch fixes the bug by not doing seek() in DBIter::FindNextUserEntry() if saved key has been erased.
      
      Test Plan: Add a test DBTest.IterPrevMaxSkip which would fail without the patch and would pass with the change.
      
      Reviewers: dhruba, xjin, haobo
      
      Reviewed By: dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D13557
      65428b0c
    • S
      Universal Compaction to Have a Size Percentage Threshold To Decide Whether to Compress · 9edda370
      Siying Dong 提交于
      Summary:
      This patch adds a option for universal compaction to allow us to only compress output files if the files compacted previously did not yet reach a specified ratio, to save CPU costs in some cases.
      
      Compression is always skipped for flushing. This is because the size information is not easy to evaluate for flushing case. We can improve it later.
      
      Test Plan:
      add test
      DBTest.UniversalCompactionCompressRatio1 and DBTest.UniversalCompactionCompressRatio12
      
      Reviewers: dhruba, haobo
      
      Reviewed By: dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D13467
      9edda370
    • K
      Add bloom filter to predefined table stats · aac44226
      Kai Liu 提交于
      Summary: As title.
      
      Test Plan: Updated the unit tests to make sure new statistic is correctly written/read.
      
      Reviewers: dhruba, haobo
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D13497
      aac44226
  5. 17 10月, 2013 5 次提交
    • V
      [ldb compact is not allowing ttl flag] · 6731997f
      Vamsi Ponnekanti 提交于
      Summary: Allow ttl flag
      
      Test Plan:
      tested on my database that has merge operations and ttl
      
      Revert Plan: OK
      
      Task ID: #3038186
      
      Reviewers: emayanke, dhruba, haobo
      
      Reviewed By: emayanke
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D13503
      6731997f
    • D
      Add appropriate LICENSE and Copyright message. · 9cd22109
      Dhruba Borthakur 提交于
      Summary:
      Add appropriate LICENSE and Copyright message.
      
      Test Plan:
      make check
      
      Reviewers:
      
      CC:
      
      Task ID: #
      
      Blame Rev:
      9cd22109
    • I
      External Value Store · fc4616d8
      Igor Canadi 提交于
      Summary:
      Developing a capability for storing values on external backing file(s).
      
      This is just a highly unoptimized first pass - supports:
      1) Allocating some portion of external file to be used to store value
      2) Freeing the range, enabling it to be reused by other values
      
      As next steps, I plan to:
      1) Create some kind of stress testing. Once I can measure stuff, I can focus on optimizing.
      2) Optimize locking.
      3) Optimize freelist data structure. Currently we have O(n) for both freeing and allocation.
      4) Figure out how to do recovery.
      
      Test Plan: Created a unit test.
      
      Reviewers: dhruba, haobo, kailiu
      
      Reviewed By: dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D13389
      fc4616d8
    • K
      Fix the patent format · 0f31843c
      Kai Liu 提交于
      Summary:
      
      Formatted the PATENT file so that it's easier to read.
      
      Test Plan:
      
      Reviewers:
      
      CC:
      
      Task ID: #
      
      Blame Rev:
      0f31843c
    • S
      Enable background flush thread by default and fix issues related to it · 073cbfc8
      Siying Dong 提交于
      Summary:
      Enable background flush thread in this patch and fix unit tests with:
      (1) After background flush, schedule a background compaction if condition satisfied;
      (2) Fix a bug that if universal compaction is enabled and number of levels are set to be 0, compaction will not be automatically triggered
      (3) Fix unit tests to wait for compaction to finish instead of flush, before checking the compaction results.
      
      Test Plan: pass all unit tests
      
      Reviewers: haobo, xjin, dhruba
      
      Reviewed By: haobo
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D13461
      073cbfc8
  6. 16 10月, 2013 3 次提交
  7. 15 10月, 2013 4 次提交
    • M
      Fix rocksdb->levledb BytewiseComparator and inverted order of error in db/version_set.cc · da2fd001
      Mayank Agarwal 提交于
      Summary:
      This is needed to make existing dbs be able to open and also because BytewiseComparator was not changed since leveldb.
      The inverted order in the error message caused confusion prebiously
      
      Test Plan: make; open existing db
      
      Reviewers: leveldb, dhruba
      
      Reviewed By: dhruba
      
      Differential Revision: https://reviews.facebook.net/D13449
      da2fd001
    • M
      Features in Transaction log iterator · fe371396
      Mayank Agarwal 提交于
      Summary:
      * Logstore requests a valid change of reutrning an empty iterator and not an error in case of no log files.
      * Changed the code to return the writebatch containing the sequence number requested from GetupdatesSince even if it lies in the middle. Earlier we used to return the next writebatch,. This also allows me oto guarantee that no files played upon by the iterator are redundant. I mean the starting log file has at least a sequence number >= the sequence number requested form GetupdatesSince.
      * Cleaned up redundant logic in Iterator::Next and made a new function SeekToStartSequence for greater readability and maintainibilty.
      * Modified a test in db_test accordingly
      Please check the logic carefully and suggest improvements. I have a separate patch out for more improvements like restricting reader to read till written sequences.
      
      Test Plan:
      * transaction log iterator tests in db_test,
      * db_repl_stress.
      * rocks_log_iterator_test in fbcode/wormhole/rocksdb/test - 2 tests thriving on hacks till now can get simplified
      * testing on the shadow setup for sigma with replication
      
      Reviewers: dhruba, haobo, kailiu, sdong
      
      Reviewed By: dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D13437
      fe371396
    • K
      Add statistics to sst file · 86ef6c3f
      Kai Liu 提交于
      Summary:
      So far we only have key/value pairs as well as bloom filter stored in the
      sst file.  It will be great if we are able to store more metadata about
      this table itself, for example, the entry size, bloom filter name, etc.
      
      This diff is the first step of this effort. It allows table to keep the
      basic statistics mentioned in http://fburl.com/14995441, as well as
      allowing writing user-collected stats to stats block.
      
      After this diff, we will figure out the interface of how to allow user to collect their interested statistics.
      
      Test Plan:
      1. Added several unit tests.
      2. Ran `make check` to ensure it doesn't break other tests.
      
      Reviewers: dhruba, haobo
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D13419
      86ef6c3f
    • S
      Change Function names from Compaction->Flush When they really mean Flush · 88f2f890
      Siying Dong 提交于
      Summary: When I debug the unit test failures when enabling background flush thread, I feel the function names can be made clearer for people to understand. Also, if the names are fixed, in many places, some tests' bugs are obvious (and some of those tests are failing). This patch is to clean it up for future maintenance.
      
      Test Plan: Run test suites.
      
      Reviewers: haobo, dhruba, xjin
      
      Reviewed By: dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D13431
      88f2f890
  8. 12 10月, 2013 1 次提交
    • S
      LRUCache to try to clean entries not referenced first. · f8509653
      sdong 提交于
      Summary:
      With this patch, when LRUCache.Insert() is called and the cache is full, it will first try to free up entries whose reference counter is 1 (would become 0 after remo\
      ving from the cache). We do it in two passes, in the first pass, we only try to release those unreferenced entries. If we cannot free enough space after traversing t\
      he first remove_scan_cnt_ entries, we start from the beginning again and remove those entries being used.
      
      Test Plan: add two unit tests to cover the codes
      
      Reviewers: dhruba, haobo, emayanke
      
      Reviewed By: emayanke
      
      CC: leveldb, emayanke, xjin
      
      Differential Revision: https://reviews.facebook.net/D13377
      f8509653
  9. 11 10月, 2013 3 次提交
    • D
      Bad nfs file checked in a long time back. · c0ce562c
      Dhruba Borthakur 提交于
      Summary:
      Bad nfs file checked in a long time back.
      
      Test Plan:
      
      Reviewers:
      
      CC:
      
      Task ID: #
      
      Blame Rev:
      c0ce562c
    • M
      Fixing error in ParseFileName causing DestroyDB to fail on archive directory · a8b4a69d
      Mayank Agarwal 提交于
      Summary:
      This careless error was causing ASSERT_OK(DestroyDB) to fail in db_test.
      Basically .. was being returned as a child of db/archive and ParseFileName returned false on that,
      but 'type' was set to LogFile from earlier and not reset. The return of ParseFileName was not being checked to delete the log file or not.
      
      Test Plan: make all check
      
      Reviewers: dhruba, haobo, xjin, kailiu, nkg-
      
      Reviewed By: nkg-
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D13413
      a8b4a69d
    • S
      Minor: Fix a lint error in cache_test.cc · 40a1e31f
      Siying Dong 提交于
      Summary:
      As title. Fix an lint error:
      
      Lint: CppLint Error
      Single-argument constructor 'Value(int v)' may inadvertently be used as a type conversion constructor. Prefix the function with the 'explicit' keyword to avoid this, or add an /* implicit */ comment to suppress this warning.
      
      Test Plan: N/A
      
      Reviewers: emayanke, haobo, dhruba
      
      Reviewed By: emayanke
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D13401
      40a1e31f
  10. 10 10月, 2013 4 次提交
    • I
      Fixing build failure · d2ca2bd1
      Igor Canadi 提交于
      Summary: virtual NewRandomRWFile is not implemented on EnvHdfs, causing build failure.
      
      Test Plan: make clean; make all check
      
      Reviewers: dhruba, haobo, kailiu
      
      Reviewed By: kailiu
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D13383
      d2ca2bd1
    • I
      Env class that can randomly read and write · d0beadd4
      Igor Canadi 提交于
      Summary: I have implemented basic simple use case that I need for External Value Store I'm working on. There is a potential for making this prettier by refactoring/combining WritableFile and RandomAccessFile, avoiding some copypasta. However, I decided to implement just the basic functionality, so I can continue working on the other diff.
      
      Test Plan: Added a unittest
      
      Reviewers: dhruba, haobo, kailiu
      
      Reviewed By: haobo
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D13365
      d0beadd4
    • D
      Add draft logo. · 7ac3c796
      Dhruba Borthakur 提交于
      Summary:
      Add draft logo in jpg format.
      
      Test Plan:
      
      Reviewers:
      
      CC:
      
      Task ID: #
      
      Blame Rev:
      7ac3c796
    • D
      A bare-bones rocksdb logo. · 6d5f6a4b
      Dhruba Borthakur 提交于
      Summary:
      A hand-crafted rocksdb logo.
      
      Test Plan:
      
      Reviewers:
      
      CC:
      
      Task ID: #
      
      Blame Rev:
      6d5f6a4b
  11. 09 10月, 2013 3 次提交
    • D
      Remove obsolete namespace mappings. · 3c37955a
      Dhruba Borthakur 提交于
      Summary:
      The previous release 2.4 had a mapping to alias the older
      namespace to rocksdb. This mapping is not needed in the new
      release.
      
      Test Plan:
      make check
      make release
      
      Reviewers: emayanke
      
      Reviewed By: emayanke
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D13359
      3c37955a
    • N
      Add option for storing transaction logs in a separate dir · cbf4a064
      Naman Gupta 提交于
      Summary: In some cases, you might not want to store the data log (write ahead log) files in the same dir as the sst files. An example use case is leaf, which stores sst files in tmpfs. And would like to save the log files in a separate dir (disk) to save memory.
      
      Test Plan: make all. Ran db_test test. A few test failing. P2785018. If you guys don't see an obvious problem with the code, maybe somebody from the rocksdb team could help me debug the issue here. Running this on leaf worked well. I could see logs stored on disk, and deleted appropriately after compactions. Obviously this is only one set of options. The unit tests cover different options. Seems like I'm missing some edge cases.
      
      Reviewers: dhruba, haobo, leveldb
      
      CC: xinyaohu, sumeet
      
      Differential Revision: https://reviews.facebook.net/D13239
      cbf4a064
    • N
      Make db_test more robust · 11607141
      Naman Gupta 提交于
      Summary: While working on D13239, I noticed that the same options are not used for opening and destroying at db. So adding that. Also added asserts for successful DestroyDB calls.
      
      Test Plan: Ran unit tests. Atleast 1 unit test is failing. They failures are a result of some past logic change. I'm not really planning to fix those. But I would like to check this in. And hopefully the respective unit test owners can fix the broken tests
      
      Reviewers: leveldb, haobo
      
      CC: xinyaohu, sumeet, dhruba
      
      Differential Revision: https://reviews.facebook.net/D13329
      11607141
  12. 08 10月, 2013 2 次提交
    • K
      Fix a bug in table builder · 1f8ade6b
      Kai Liu 提交于
      Summary:
      In talbe.cc, when reading the metablock, it uses BytewiseComparator();
      However in table_builder.cc, we use r->options.comparator. After tracing
      the creation of r->options.comparator, I found this comparator is an
      InternalKeyComparator, which wraps the user defined comparator(details
      can be found in DBImpl::SanitizeOptions().
      
      I encountered this problem when adding metadata about "bloom filter"
      before. With different comparator, we may fail to do the binary sort.
      
      Current code works well since there is only one entry in meta block.
      
      Test Plan:
      make all check
      
      I've also tested this change in https://reviews.facebook.net/D8283 before.
      
      Reviewers: dhruba, haobo
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D13335
      1f8ade6b
    • I
      Move delete and free outside of crtical section · fa46ddb4
      Igor Canadi 提交于
      Summary: Split Unref into two parts -> cheap and expensive. Try to call expensive Unref outside of critical section to decrease lock contention.
      
      Test Plan: unittests
      
      Reviewers: dhruba, haobo
      
      Reviewed By: dhruba
      
      CC: leveldb, kailiu
      
      Differential Revision: https://reviews.facebook.net/D13299
      fa46ddb4
  13. 06 10月, 2013 3 次提交
  14. 05 10月, 2013 4 次提交