1. 18 3月, 2021 1 次提交
    • A
      Use SST file manager to track blob files as well (#8037) · 27d57a03
      Akanksha Mahajan 提交于
      Summary:
      Extend support to track blob files in SST File manager.
       This PR notifies SstFileManager whenever a new blob file is created,
       via OnAddFile and  an obsolete blob file deleted via OnDeleteFile
       and delete file via ScheduleFileDeletion.
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/8037
      
      Test Plan: Add new unit tests
      
      Reviewed By: ltamasi
      
      Differential Revision: D26891237
      
      Pulled By: akankshamahajan15
      
      fbshipit-source-id: 04c69ccfda2a73782fd5c51982dae58dd11979b6
      27d57a03
  2. 07 1月, 2021 1 次提交
    • M
      Create a CustomEnv class; Add WinFileSystem; Make LegacyFileSystemWrapper private (#7703) · e628f59e
      mrambacher 提交于
      Summary:
      This PR does the following:
      -> Creates a WinFileSystem class.  This class is the Windows equivalent of the PosixFileSystem and will be used on Windows systems.
      -> Introduces a CustomEnv class.  A CustomEnv is an Env that takes a FileSystem as constructor argument.  I believe there will only ever be two implementations of this class (PosixEnv and WinEnv).  There is still a CustomEnvWrapper class that takes an Env and a FileSystem and wraps the Env calls with the input Env but uses the FileSystem for the FileSystem calls
      -> Eliminates the public uses of the LegacyFileSystemWrapper.
      
      With this change in place, there are effectively the following patterns of Env:
      - "Base Env classes" (PosixEnv, WinEnv).  These classes implement the core Env functions (e.g. Threads) and have a hard-coded input FileSystem.  These classes inherit from CompositeEnv, implement the core Env functions (threads) and delegate the FileSystem-like calls to the input file system.
      - Wrapped Composite Env classes (MemEnv).  These classes take in an Env and a FileSystem.  The core env functions are re-directed to the wrapped env.  The file system calls are redirected to the input file system
      - Legacy Wrapped Env classes.  These classes take in an Env input (but no FileSystem).  The core env functions are re-directed to the wrapped env.  A "Legacy File System" is created using this env and the file system calls directed to the env itself.
      
      With these changes in place, the PosixEnv becomes a singleton -- there is only ever one created.  Any other use of the PosixEnv is via another wrapped env.  This cleans up some of the issues with the env construction and destruction.
      
      Additionally, there were places in the code that required had an Env when they required a FileSystem.  Many of these places would wrap the Env with a LegacyFileSystemWrapper instead of using the env->GetFileSystem().  These places were changed, thereby removing layers of additional redirection (LegacyFileSystem --> Env --> Env::FileSystem).
      
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/7703
      
      Reviewed By: zhichao-cao
      
      Differential Revision: D25762190
      
      Pulled By: anand1976
      
      fbshipit-source-id: 1a088e97fc916f28ac69c149cd1dcad0ab31704b
      e628f59e
  3. 30 9月, 2020 1 次提交
  4. 18 8月, 2020 1 次提交
  5. 03 7月, 2020 1 次提交
  6. 02 7月, 2020 1 次提交
  7. 21 2月, 2020 1 次提交
    • S
      Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) · fdf882de
      sdong 提交于
      Summary:
      When dynamically linking two binaries together, different builds of RocksDB from two sources might cause errors. To provide a tool for user to solve the problem, the RocksDB namespace is changed to a flag which can be overridden in build time.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6433
      
      Test Plan: Build release, all and jtest. Try to build with ROCKSDB_NAMESPACE with another flag.
      
      Differential Revision: D19977691
      
      fbshipit-source-id: aa7f2d0972e1c31d75339ac48478f34f6cfcfb3e
      fdf882de
  8. 14 12月, 2019 1 次提交
    • A
      Introduce a new storage specific Env API (#5761) · afa2420c
      anand76 提交于
      Summary:
      The current Env API encompasses both storage/file operations, as well as OS related operations. Most of the APIs return a Status, which does not have enough metadata about an error, such as whether its retry-able or not, scope (i.e fault domain) of the error etc., that may be required in order to properly handle a storage error. The file APIs also do not provide enough control over the IO SLA, such as timeout, prioritization, hinting about placement and redundancy etc.
      
      This PR separates out the file/storage APIs from Env into a new FileSystem class. The APIs are updated to return an IOStatus with metadata about the error, as well as to take an IOOptions structure as input in order to allow more control over the IO.
      
      The user can set both ```options.env``` and ```options.file_system``` to specify that RocksDB should use the former for OS related operations and the latter for storage operations. Internally, a ```CompositeEnvWrapper``` has been introduced that inherits from ```Env``` and redirects individual methods to either an ```Env``` implementation or the ```FileSystem``` as appropriate. When options are sanitized during ```DB::Open```, ```options.env``` is replaced with a newly allocated ```CompositeEnvWrapper``` instance if both env and file_system have been specified. This way, the rest of the RocksDB code can continue to function as before.
      
      This PR also ports PosixEnv to the new API by splitting it into two - PosixEnv and PosixFileSystem. PosixEnv is defined as a sub-class of CompositeEnvWrapper, and threading/time functions are overridden with Posix specific implementations in order to avoid an extra level of indirection.
      
      The ```CompositeEnvWrapper``` translates ```IOStatus``` return code to ```Status```, and sets the severity to ```kSoftError``` if the io_status is retryable. The error handling code in RocksDB can then recover the DB automatically.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5761
      
      Differential Revision: D18868376
      
      Pulled By: anand1976
      
      fbshipit-source-id: 39efe18a162ea746fabac6360ff529baba48486f
      afa2420c
  9. 01 6月, 2019 1 次提交
  10. 30 5月, 2019 1 次提交
  11. 13 10月, 2018 1 次提交
  12. 29 8月, 2018 1 次提交
    • A
      Sync CURRENT file during checkpoint (#4322) · 42733637
      Andrew Kryczka 提交于
      Summary: For the CURRENT file forged during checkpoint, we were forgetting to `fsync` or `fdatasync` it after its creation. This PR fixes it.
      
      Differential Revision: D9525939
      
      Pulled By: ajkr
      
      fbshipit-source-id: a505483644026ee3f501cfc0dcbe74832165b2e3
      42733637
  13. 16 4月, 2018 1 次提交
  14. 11 10月, 2017 1 次提交
    • A
      fix file numbers after repair · 70aa9421
      Andrew Kryczka 提交于
      Summary:
      The file numbers assigned post-repair were sometimes smaller than older files' numbers due to `LogAndApply` saving the wrong next file number in the manifest.
      
      - Mark the highest file seen during repair as used before `LogAndApply` so the correct next file number will be stored.
      - Renamed `MarkFileNumberUsedDuringRecovery` to `MarkFileNumberUsed` since now it's used during repair in addition to during recovery
      - Added `TEST_Current_Next_FileNo` to expose the next file number for the unit test.
      Closes https://github.com/facebook/rocksdb/pull/2988
      
      Differential Revision: D6018083
      
      Pulled By: ajkr
      
      fbshipit-source-id: 3f25cbf74439cb8f16dd12af90b67f9f9f75e718
      70aa9421
  15. 23 9月, 2017 1 次提交
    • A
      Repair DBs with trailing slash in name · 4708a687
      Andrew Kryczka 提交于
      Summary:
      Problem:
      
      - `DB::SanitizeOptions` strips trailing slash from `wal_dir` but not `dbname`
      - We check whether `wal_dir` and `dbname` refer to the same directory using string equality: https://github.com/facebook/rocksdb/blob/master/db/repair.cc#L258
      - Providing `dbname` with trailing slash causes default `wal_dir` to be misidentified as a separate directory.
      - Then the repair tries to add all SST files to the `VersionEdit` twice (once for `dbname` dir, once for `wal_dir`) and fails with coredump.
      
      Solution:
      
      - Add a new `Env` function, `AreFilesSame`, which uses device and inode number to check whether files are the same. It's currently only implemented in `PosixEnv`.
      - Migrate repair to use `AreFilesSame` to check whether `dbname` and `wal_dir` are same. If unsupported, falls back to string comparison.
      Closes https://github.com/facebook/rocksdb/pull/2827
      
      Differential Revision: D5761349
      
      Pulled By: ajkr
      
      fbshipit-source-id: c839d548678b742af1166d60b09abd94e5476238
      4708a687
  16. 09 8月, 2017 1 次提交
    • C
      Try to repair db with wal_dir option, avoid leak some WAL files · d97a72d6
      Chang Liu 提交于
      Summary:
      We should search wal_dir in Repairer::FindFiles function, and avoid use
      LogFileNmae(dbname, number) to get WAL file's name, which will get a wrong
      WAL filename. as following:
      
      ```
      [WARN] [/home/liuchang/Workspace/rocksdb/db/repair.cc:310] Log #3: ignoring conversion error: IO error: While opening a file for sequentially reading: /tmp/rocksdbtest-1000/repair_test/000003.log: No such file or directory
      ```
        I have added a new test case to repair_test.cc, which try to repair db with all WAL options.
      Signed-off-by: NChang Liu <liuchang0812@gmail.com>
      Closes https://github.com/facebook/rocksdb/pull/2692
      
      Differential Revision: D5575888
      
      Pulled By: ajkr
      
      fbshipit-source-id: 5b93e9f85cddc01663ccecd87631fa723ac466a3
      d97a72d6
  17. 16 7月, 2017 1 次提交
  18. 28 4月, 2017 1 次提交
  19. 17 2月, 2017 1 次提交
  20. 16 2月, 2017 1 次提交
  21. 11 2月, 2017 1 次提交
    • D
      Fix repair issues · a5adda06
      Dmitri Smirnov 提交于
      Summary:
      Record the first parsed sequence number as the minimum
        so we can find the true minimum otherwise everything is larger than zero.
        Fix the comparator name comparision.
      Closes https://github.com/facebook/rocksdb/pull/1858
      
      Differential Revision: D4544365
      
      Pulled By: ajkr
      
      fbshipit-source-id: 439cbc2
      a5adda06
  22. 25 6月, 2016 3 次提交
    • A
      ColumnFamilyOptions API [CF + RepairDB part 3/3] · 3b7ed677
      Andrew Kryczka 提交于
      Summary:
      Overload RepairDB to take vector-of-ColumnFamilyDescriptor, which tells
      us CF name + options. Also takes a ColumnFamilyOptions for unspecified column
      families encountered during the repair.
      
      One potentially confusing thing is that we store options in the constructor and
      don't invoke AddColumnFamily() until discovering the CF in ScanTable. This is
      because we don't know the CF ID until we find a table belonging to that CF.
      
      Depends on D59781.
      
      Test Plan:
        $ ./repair_test
      
      Reviewers: yhchiang, IslamAbdelRahman, sdong
      
      Reviewed By: sdong
      
      Subscribers: andrewkr, dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D59853
      3b7ed677
    • A
      Detect column family from properties [CF + RepairDB part 2/3] · 56ac6862
      Andrew Kryczka 提交于
      Summary:
      This diff uses the CF ID and CF name properties in the SST file
      to associate recovered data with the proper column family. Depends on D59775.
      
      - In ScanTable(), create column families in VersionSet each time a new one is discovered (via reading SST file properties)
      - In ConvertLogToTable(), dump an SST file for every column family with data in the WAL
      - In AddTables(), make a VersionEdit per-column family that adds all of that CF's tables
      
      Test Plan:
        $ ./repair_test
      
      Reviewers: yhchiang, IslamAbdelRahman, sdong
      
      Reviewed By: sdong
      
      Subscribers: andrewkr, dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D59781
      56ac6862
    • A
      Refactor to use VersionSet [CF + RepairDB part 1/3] · 343507af
      Andrew Kryczka 提交于
      Summary:
      To support column families, it is easiest to use VersionSet to manage
      our column families (if we don't have Versions then ColumnFamilyData always
      behaves as a dummy column family). This diff only refactors the existing repair
      logic to use VersionSet; the next two parts will add support for multiple
      column families.
      
      Test Plan:
        $ ./repair_test
      
      Reviewers: yhchiang, IslamAbdelRahman, sdong
      
      Reviewed By: sdong
      
      Subscribers: andrewkr, dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D59775
      343507af
  23. 19 3月, 2016 1 次提交
    • A
      Add unit tests for RepairDB · e182f03c
      Andrew Kryczka 提交于
      Summary:
      Basic test cases:
      
      - Manifest is lost or corrupt
      - Manifest refers to too many or too few SST files
      - SST file is corrupt
      - Unflushed data is present when RepairDB is called
      
      Depends on D55065 for its CreateFile() function in file_utils
      
      Test Plan: Ran the tests.
      
      Reviewers: IslamAbdelRahman, yhchiang, yoshinorim, sdong
      
      Reviewed By: sdong
      
      Subscribers: leveldb, andrewkr, dhruba
      
      Differential Revision: https://reviews.facebook.net/D55485
      e182f03c