1. 29 11月, 2012 3 次提交
    • D
      Release 1.5.6.fb · 9b838535
      Dhruba Borthakur 提交于
      Summary:
      
      Test Plan:
      
      Reviewers:
      
      CC:
      
      Task ID: #
      
      Blame Rev:
      9b838535
    • D
      Delete non-visible keys during a compaction even in the presense of snapshots. · 9a357847
      Dhruba Borthakur 提交于
      Summary:
       LevelDB should delete almost-new keys when a long-open snapshot exists.
      The previous behavior is to keep all versions that were created after the
      oldest open snapshot. This can lead to database size bloat for
      high-update workloads when there are long-open snapshots and long-open
      snapshot will be used for logical backup. By "almost new" I mean that the
      key was updated more than once after the oldest snapshot.
      
      If there were two snapshots with seq numbers s1 and s2 (s1 < s2), and if
      we find two instances of the same key k1 that lie entirely within s1 and
      s2 (i.e. s1 < k1 < s2), then the earlier version
      of k1 can be safely deleted because that version is not visible in any snapshot.
      
      Test Plan:
      unit test attached
      make clean check
      
      Differential Revision: https://reviews.facebook.net/D6999
      9a357847
    • A
      Moved FBCode Linter's to LevelDB. · 34487af4
      Abhishek Kona 提交于
      Summary: Added FBCODE like linting support to our codebase.
      
      Test Plan: arc lint  lint's the code.
      
      Reviewers: dhruba
      
      Reviewed By: dhruba
      
      CC: emayanke, leveldb
      
      Differential Revision: https://reviews.facebook.net/D7041
      34487af4
  2. 28 11月, 2012 1 次提交
  3. 27 11月, 2012 5 次提交
    • S
      Remove unused varibles. Cause compiler warnings. · 43f5a079
      sheki 提交于
      Test Plan: make check
      
      Reviewers: dhruba
      
      Reviewed By: dhruba
      
      CC: emayanke
      
      Differential Revision: https://reviews.facebook.net/D6993
      43f5a079
    • D
      Assertion failure while running with unit tests with OPT=-g · 2a396999
      Dhruba Borthakur 提交于
      Summary:
      When we expand the range of keys for a level 0 compaction, we
      need to invoke ParentFilesInCompaction() only once for the
      entire range of keys that is being compacted. We were invoking
      it for each file that was being compacted, but this triggers
      an assertion because each file's range were contiguous but
      non-overlapping.
      
      I renamed ParentFilesInCompaction to ParentRangeInCompaction
      to adequately represent that it is the range-of-keys and
      not individual files that we compact in a single compaction run.
      
      Here is the assertion that is fixed by this patch.
      db_test: db/version_set.cc:585: void leveldb::Version::ExtendOverlappingInputs(int, const leveldb::Slice&, const leveldb::Slice&, std::vector<leveldb::FileMetaData*, std::allocator<leveldb::FileMetaData*> >*, int): Assertion `user_cmp->Compare(flimit, user_begin) >= 0' failed.
      
      Test Plan: make clean check OPT=-g
      
      Reviewers: sheki
      
      Reviewed By: sheki
      
      CC: MarkCallaghan, emayanke, leveldb
      
      Differential Revision: https://reviews.facebook.net/D6963
      2a396999
    • D
      Merge branch 'performance' · 7c6f5278
      Dhruba Borthakur 提交于
      7c6f5278
    • D
      The c_test was sometimes failing with an assertion. · e0cd6bf0
      Dhruba Borthakur 提交于
      Summary:
      On fast filesystems (e.g. /dev/shm and ext4), the flushing
      of memstore to disk was fast and quick, and the background compaction
      thread was not getting scheduled fast enough to delete obsolete
      files before the db was closed. This caused the repair method
      to pick up those files that were not part of the db and the unit
      test was failing.
      
      The fix is to enhance the unti test to run a compaction before
      closing the database so that all files that are not part of the
      database are truly deleted from the filesystem.
      
      Test Plan: make c_test; ./c_test
      
      Reviewers: chip, emayanke, sheki
      
      Reviewed By: chip
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D6915
      e0cd6bf0
    • C
      Fix broken test; some ldb commands can run without a db_ · 6caf3b8e
      Chip Turner 提交于
      Summary:
      It would appear our unit tests make use of code from ldb_cmd,
      and don't always require a valid database handle.  D6855 was not aware
      db_ could sometimes be NULL for such commands, and so it broke
      reduce_levels_test.
      
      This moves the check elsewhere to (at least) fix the 'ldb dump' case of
      segfaulting when it couldn't open a database.
      
      Test Plan: make check
      
      Reviewers: dhruba
      
      Reviewed By: dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D6903
      6caf3b8e
  4. 22 11月, 2012 2 次提交
    • C
      Fix ldb segfault and use static libsnappy for all builds · 879e45eb
      Chip Turner 提交于
      Summary:
      Link statically against snappy, using the gvfs one for facebook
      environments, and the bundled one otherwise.
      
      In addition, fix a few minor segfaults in ldb when it couldn't open the
      database, and update .gitignore to include a few other build artifacts.
      
      Test Plan: make check
      
      Reviewers: dhruba
      
      Reviewed By: dhruba
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D6855
      879e45eb
    • D
      Support taking a configurable number of files from the same level to compact... · 7632fdb5
      Dhruba Borthakur 提交于
      Support taking a configurable number of  files from the same level to compact in a single compaction run.
      
      Summary:
      The compaction process takes some files from LevelK and
      merges it into LevelK+1. The number of files it picks from
      LevelK was capped such a way that the total amount of
      data picked does not exceed the maxfilesize of that level.
      This essentially meant that only one file from LevelK
      is picked for a single compaction.
      
      For bulkloads, we would like to take many many file from
      LevelK and compact them using a single compaction run.
      
      This patch introduces a option called the 'source_compaction_factor'
      (similar to expanded_compaction_factor). It is a multiplier
      that is multiplied by the maxfilesize of that level to arrive
      at the limit that is used to throttle the number of source
      files from LevelK.  For bulk loads, set source_compaction_factor
      to a very high number so that multiple files from the same
      level are picked for compaction in a single compaction.
      
      The default value of source_compaction_factor is 1, so that
      we can keep backward compatibilty with existing compaction semantics.
      
      Test Plan: make clean check
      
      Reviewers: emayanke, sheki
      
      Reviewed By: emayanke
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D6867
      7632fdb5
  5. 21 11月, 2012 2 次提交
    • D
      Support to disable background compactions on a database. · fbb73a4a
      Dhruba Borthakur 提交于
      Summary:
      This option is needed for fast bulk uploads. The goal is to load
      all the data into files in L0 without any interference from
      background compactions.
      
      Test Plan: make clean check
      
      Reviewers: sheki
      
      Reviewed By: sheki
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D6849
      fbb73a4a
    • D
      A major bug that was not considering the compaction score of the n-1 level. · 3754f2f4
      Dhruba Borthakur 提交于
      Summary:
      The method Finalize() recomputes the compaction score of each
      level and then sorts these score from largest to smallest. The
      idea is that the level with the largest compaction score will
      be a better candidate for compaction.  There are usually very
      few levels, and a bubble sort code was used to sort these
      compaction scores. There existed a bug in the sorting code that
      skipped looking at the score for the n-1 level. This meant that
      even if the compaction score of the n-1 level is large, it will
      not be picked for compaction.
      
      This patch fixes the bug and also introduces "asserts" in the
      code to detect any possible inconsistencies caused by future bugs.
      
      This bug existed in the very first code change that introduced
      multi-threaded compaction to the leveldb code. That version of
      code was committed on Oct 19th via
      https://github.com/facebook/leveldb/commit/1ca0584345af85d2dccc434f451218119626d36e
      
      Test Plan: make clean check OPT=-g
      
      Reviewers: emayanke, sheki, MarkCallaghan
      
      Reviewed By: sheki
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D6837
      3754f2f4
  6. 20 11月, 2012 10 次提交
    • D
      Fix asserts · dde70898
      Dhruba Borthakur 提交于
      Summary:
      make check OPT=-g fails with the following assert.
      ==== Test DBTest.ApproximateSizes
      db_test: db/version_set.cc:765: void leveldb::VersionSet::Builder::CheckConsistencyForDeletes(leveldb::VersionEdit*, int, int): Assertion `found' failed.
      
      The assertion was that file #7 that was being deleted did not
      preexists, but actualy it did pre-exist as shown in the manifest
      dump shows below. The bug was that we did not check for file
      existance at the same level.
      
      *************************Edit[0] = VersionEdit {
        Comparator: leveldb.BytewiseComparator
      }
      
      *************************Edit[1] = VersionEdit {
        LogNumber: 8
        PrevLogNumber: 0
        NextFile: 9
        LastSeq: 80
        AddFile: 0 7 8005319 'key000000' @ 1 : 1 .. 'key000079' @ 80 : 1
      }
      
      *************************Edit[2] = VersionEdit {
        LogNumber: 8
        PrevLogNumber: 0
        NextFile: 13
        LastSeq: 80
        CompactPointer: 0 'key000079' @ 80 : 1
        DeleteFile: 0 7
        AddFile: 1 9 2101425 'key000000' @ 1 : 1 .. 'key000020' @ 21 : 1
        AddFile: 1 10 2101425 'key000021' @ 22 : 1 .. 'key000041' @ 42 : 1
        AddFile: 1 11 2101425 'key000042' @ 43 : 1 .. 'key000062' @ 63 : 1
        AddFile: 1 12 1701165 'key000063' @ 64 : 1 .. 'key000079' @ 80 : 1
      }
      
      Test Plan:
      
      Reviewers:
      
      CC:
      
      Task ID: #
      
      Blame Rev:
      dde70898
    • D
      Merge branch 'master' into performance · a4b79b6e
      Dhruba Borthakur 提交于
      a4b79b6e
    • D
      Fix compilation error while compiling unit tests with OPT=-g · 74054fa9
      Dhruba Borthakur 提交于
      Summary:
      Fix compilation error while compiling with OPT=-g
      
      Test Plan:
      make clean check OPT=-g
      
      Reviewers:
      
      CC:
      
      Task ID: #
      
      Blame Rev:
      74054fa9
    • D
      Fix compilation error introduced by previous commit · 48dafb2c
      Dhruba Borthakur 提交于
      7889e094
      
      Summary:
      Fix compilation error introduced by previous commit
      7889e094
      
      Test Plan:
      make clean check
      48dafb2c
    • D
      Enhance manifest_dump to print each individual edit. · 7889e094
      Dhruba Borthakur 提交于
      Summary:
      The manifest file contains a series of edits. If the verbose
      option is switched on, then print each individual edit in the
      manifest file. This helps in debugging.
      
      Test Plan: make clean manifest_dump
      
      Reviewers: emayanke, sheki
      
      Reviewed By: sheki
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D6807
      7889e094
    • A
      Fix LDB dumpwal to print the messages as in the file. · 661dc157
      Abhishek Kona 提交于
      Summary:
      StringStream.clear() does not clear the stream. It sets some flags.
      Who knew? Fixing that is not printing the stuff again and again.
      
      Test Plan: ran it on a local db
      
      Reviewers: dhruba, emayanke
      
      Reviewed By: dhruba
      
      Differential Revision: https://reviews.facebook.net/D6795
      661dc157
    • A
      Fix a coding error in db_test.cc · 65b035a4
      amayank 提交于
      Summary: The new function MinLevelToCompress in db_test.cc was incomplete. It needs to tell the calling function-TEST whether the test has to be skipped or not
      
      Test Plan: make all;./db_test
      
      Reviewers: dhruba, heyongqiang
      
      Reviewed By: dhruba
      
      CC: sheki
      
      Differential Revision: https://reviews.facebook.net/D6771
      65b035a4
    • A
      LDB can read WAL. · 30742e16
      Abhishek Kona 提交于
      Summary:
      Add option to read WAL and print a summary for each record.
      facebook task => #1885013
      
      E.G. Output :
      ./ldb dump_wal --walfile=/tmp/leveldbtest-5907/dbbench/026122.log --header
      Sequence,Count,ByteSize
      49981,1,100033
      49981,1,100033
      49982,1,100033
      49981,1,100033
      49982,1,100033
      49983,1,100033
      49981,1,100033
      49982,1,100033
      49983,1,100033
      49984,1,100033
      49981,1,100033
      49982,1,100033
      
      Test Plan:
      Works run
      ./ldb read_wal --wal-file=/tmp/leveldbtest-5907/dbbench/000078.log --header
      
      Reviewers: dhruba, heyongqiang
      
      Reviewed By: dhruba
      
      CC: emayanke, leveldb, zshao
      
      Differential Revision: https://reviews.facebook.net/D6675
      30742e16
    • D
      Enhance manifest_dump to print each individual edit. · 4b622ab0
      Dhruba Borthakur 提交于
      Summary:
      The manifest file contains a series of edits. If the verbose
      option is switched on, then print each individual edit in the
      manifest file. This helps in debugging.
      
      Test Plan: make clean manifest_dump
      
      Reviewers: emayanke, sheki
      
      Reviewed By: sheki
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D6807
      4b622ab0
    • A
      Fix LDB dumpwal to print the messages as in the file. · b648401a
      Abhishek Kona 提交于
      Summary:
      StringStream.clear() does not clear the stream. It sets some flags.
      Who knew? Fixing that is not printing the stuff again and again.
      
      Test Plan: ran it on a local db
      
      Reviewers: dhruba, emayanke
      
      Reviewed By: dhruba
      
      Differential Revision: https://reviews.facebook.net/D6795
      b648401a
  7. 19 11月, 2012 1 次提交
    • D
      enhance dbstress to simulate hard crash · 62e7583f
      Dhruba Borthakur 提交于
      Summary:
      dbstress has an option to reopen the database. Make it such that the
      previous handle is not closed before we reopen, this simulates a
      situation similar to a process crash.
      
      Added new api to DMImpl to remove the lock file.
      
      Test Plan: run db_stress
      
      Reviewers: emayanke
      
      Reviewed By: emayanke
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D6777
      62e7583f
  8. 17 11月, 2012 2 次提交
    • A
      Fix a coding error in db_test.cc · de278a6d
      amayank 提交于
      Summary: The new function MinLevelToCompress in db_test.cc was incomplete. It needs to tell the calling function-TEST whether the test has to be skipped or not
      
      Test Plan: make all;./db_test
      
      Reviewers: dhruba, heyongqiang
      
      Reviewed By: dhruba
      
      CC: sheki
      
      Differential Revision: https://reviews.facebook.net/D6771
      de278a6d
    • A
      LDB can read WAL. · f5cdf931
      Abhishek Kona 提交于
      Summary:
      Add option to read WAL and print a summary for each record.
      facebook task => #1885013
      
      E.G. Output :
      ./ldb dump_wal --walfile=/tmp/leveldbtest-5907/dbbench/026122.log --header
      Sequence,Count,ByteSize
      49981,1,100033
      49981,1,100033
      49982,1,100033
      49981,1,100033
      49982,1,100033
      49983,1,100033
      49981,1,100033
      49982,1,100033
      49983,1,100033
      49984,1,100033
      49981,1,100033
      49982,1,100033
      
      Test Plan:
      Works run
      ./ldb read_wal --wal-file=/tmp/leveldbtest-5907/dbbench/000078.log --header
      
      Reviewers: dhruba, heyongqiang
      
      Reviewed By: dhruba
      
      CC: emayanke, leveldb, zshao
      
      Differential Revision: https://reviews.facebook.net/D6675
      f5cdf931
  9. 15 11月, 2012 3 次提交
  10. 14 11月, 2012 4 次提交
    • D
      Push release 1.5.5.fb. · 0f590af6
      Dhruba Borthakur 提交于
      Summary:
      
      Test Plan:
      
      Reviewers:
      
      CC:
      
      Task ID: #
      
      Blame Rev:
      0f590af6
    • D
      Make sse compilation optional. · 33cf6f3b
      Dhruba Borthakur 提交于
      Summary:
      The fbcode compilation was always switching on msse by default.
      This patch keeps the same behaviour but allows the compilation
      process to switch off msse if needed.
      
      If one does not want to use sse, then do the following:
      export USE_SSE=0
      make clean all
      
      Test Plan: make clean all
      
      Reviewers: heyongqiang
      
      Reviewed By: heyongqiang
      
      CC: leveldb
      
      Differential Revision: https://reviews.facebook.net/D6717
      33cf6f3b
    • D
      Improved CompactionFilter api: pass in a opaque argument to CompactionFilter invocation. · 5d16e503
      Dhruba Borthakur 提交于
      Summary:
      There are applications that operate on multiple leveldb instances.
      These applications will like to pass in an opaque type for each
      leveldb instance and this type should be passed back to the application
      with every invocation of the CompactionFilter api.
      
      Test Plan: Enehanced unit test for opaque parameter to CompactionFilter.
      
      Reviewers: heyongqiang
      
      Reviewed By: heyongqiang
      
      CC: MarkCallaghan, sheki, emayanke
      
      Differential Revision: https://reviews.facebook.net/D6711
      5d16e503
    • D
      Fix asserts so that "make check OPT=-g" works on performance branch · 43d9a822
      Dhruba Borthakur 提交于
      Summary:
      Compilation used to fail with the error:
      db/version_set.cc:1773: error: ‘number_of_files_to_sort_’ is not a member of ‘leveldb::VersionSet’
      
      I created a new method called CheckConsistencyForDeletes() so that
      all the high cost checking is done only when OPT=-g is specified.
      
      I also fixed a bug in PickCompactionBySize that was triggered when
      OPT=-g was switched on. The base_index in the compaction record
      was not set correctly.
      
      Test Plan: make check OPT=-g
      
      Differential Revision: https://reviews.facebook.net/D6687
      43d9a822
  11. 13 11月, 2012 3 次提交
    • D
      The db_bench utility was broken in 1.5.4.fb because of a signed-unsigned comparision. · a785e029
      Dhruba Borthakur 提交于
      Summary:
      The db_bench utility was broken in 1.5.4.fb because of a
      signed-unsigned comparision.
      
      The static variable FLAGS_min_level_to_compress was recently
      changed from int to 'unsigned in' but it is initilized to a
      nagative value -1.
      
      The segfault is of this type:
      Program received signal SIGSEGV, Segmentation fault.
      Open (this=0x7fffffffdee0) at db/db_bench.cc:939
      939	db/db_bench.cc: No such file or directory.
      (gdb) where
      
      Test Plan: run db_bench with no options.
      
      Reviewers: heyongqiang
      
      Reviewed By: heyongqiang
      
      CC: MarkCallaghan, emayanke, sheki
      
      Differential Revision: https://reviews.facebook.net/D6663
      a785e029
    • A
      Introducing "database reopens" into the stress test. Database will reopen... · e6262617
      amayank 提交于
      Introducing "database reopens" into the stress test. Database will reopen after a specified number of iterations (configurable) of each thread when they will wait for the databse to reopen.
      
      Summary: FLAGS_reopen (configurable) specifies the number of times the databse is to be reopened. FLAGS_ops_per_thread is divided into points based on that reopen field. At these points all threads come together to wait for the databse to reopen. Each thread "votes" for the database to reopen and when all have voted, the database reopens.
      
      Test Plan: make all;./db_stress
      
      Reviewers: dhruba, MarkCallaghan, sheki, asad, heyongqiang
      
      Reviewed By: dhruba
      
      Differential Revision: https://reviews.facebook.net/D6627
      e6262617
    • H
      Fix test failure of reduce_num_levels · c64796fd
      heyongqiang 提交于
      Summary:
      I changed the reduce_num_levels logic to avoid "compactRange()" call if the current number of levels in use (levels that contain files) is smaller than the new num of levels.
      And that change breaks the assert in reduce_levels_test
      
      Test Plan: run reduce_levels_test
      
      Reviewers: dhruba, MarkCallaghan
      
      Reviewed By: dhruba
      
      CC: emayanke, sheki
      
      Differential Revision: https://reviews.facebook.net/D6651
      c64796fd
  12. 11 11月, 2012 1 次提交
    • D
      Compilation error while compiling with OPT=-g · 9c6c232e
      Dhruba Borthakur 提交于
      Summary:
      make clean check OPT=-g fails
      leveldb::DBStatistics::getTickerCount(leveldb::Tickers)’:
      ./db/db_statistics.h:34: error: ‘MAX_NO_TICKERS’ was not declared in this scope
      util/ldb_cmd.cc:255: warning: left shift count >= width of type
      
      Test Plan:
      make clean check OPT=-g
      
      Reviewers:
      
      CC:
      
      Task ID: #
      
      Blame Rev:
      9c6c232e
  13. 10 11月, 2012 3 次提交