Skip to content

Commit

Permalink
Merge branch 'release/0.11.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
iabudiab committed Jan 8, 2020
2 parents 3764b97 + 845693a commit 0394d22
Show file tree
Hide file tree
Showing 20 changed files with 314 additions and 93 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: ObjectiveRocks CI

on: [push]

jobs:
macOS:
name: Test macOS
runs-on: macOS-latest
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- name: macOS
run: xcodebuild -workspace "ObjectiveRocks.xcworkspace" -scheme "ObjectiveRocks" -destination "platform=macOS" clean test
pod_lint:
name: Pod Lint
runs-on: macOS-latest
needs: [macOS]
steps:
- uses: actions/checkout@v1
with:
submodules: recursive
- name: Pod Lint
run: pod lib lint --skip-import-validation --allow-warnings
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Change Log

## [0.11.0](https://github.com/iabudiab/ObjectiveRocks/releases/tag/0.11.0)

Released on 2020.01.08

- Improve `ColumnFamilyOptions` by @jurmous in PR #19
- Add `compactionStyle` setting
- Change `maxBytesForLevelMultiplier` to a double to match internal type
- Add missing `level0FileNumCompactionTrigger` implementation
- Expand `WriteOptions` with `noSlowdown` and `lowPriority` options by @jurmous in PR #21
- Expand `RocksDBIterator` with `seekForPrev` and `status` methods by @jurmous in PR #22
- Expand `CompactRangeOptions` by @jurmous in PR #25
- `allowWriteStall`, `maxSubcompactions`, `targetPathId`, `exclusiveManualCompaction`
- Removed redundant mem-copy in Iterator and improved release semantics in `enumerate` methods by @myeyesareblind in PRs #27 & #28
- Fix `bottommostLevelCompaction` switch statement by @jurmous in PR #20


### Updated

- Project settings to Xcode11


## [0.10.0](https://github.com/iabudiab/ObjectiveRocks/releases/tag/0.10.0)

Expand Down
2 changes: 1 addition & 1 deletion Code/RocksDB.mm
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ - (void)close

- (BOOL)isClosed {
@synchronized(self) {
return _db == nullptr;
return _db == nullptr;
}
}

Expand Down
16 changes: 15 additions & 1 deletion Code/RocksDBColumnFamilyOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@

NS_ASSUME_NONNULL_BEGIN

/** The DB compression type. */
typedef NS_ENUM(char, RocksDBCompactionStyle)
{
RocksDBCompressionStyleLevel = 0x0,
RocksDBCompressionStyleUniversal = 0x1,
RocksDBCompressionStyleFifo = 0x2,
RocksDBCompressionStyleNone = 0x3
};

/** The DB compression type. */
typedef NS_ENUM(char, RocksDBCompressionType)
{
Expand Down Expand Up @@ -70,6 +79,11 @@ typedef NS_ENUM(char, RocksDBCompressionType)
*/
@property (nonatomic, assign) RocksDBCompressionType compressionType;

/** @brief Set compaction style for DB.
Default: RocksDBCompactionStyleLevel
*/
@property (nonatomic, assign) RocksDBCompactionStyle compactionStyle;

/** @brief If non-nil, the specified function to determine the
prefixes for keys will be used. These prefixes will be placed in the filter.
Expand Down Expand Up @@ -106,7 +120,7 @@ typedef NS_ENUM(char, RocksDBCompressionType)
@property (nonatomic, assign) uint64_t maxBytesForLevelBase;

/** @brief Default: 10 */
@property (nonatomic, assign) int maxBytesForLevelMultiplier;
@property (nonatomic, assign) double maxBytesForLevelMultiplier;

/** @brief Puts are delayed 0-1 ms when any level has a compaction score that
exceeds this limit.
Expand Down
19 changes: 17 additions & 2 deletions Code/RocksDBColumnFamilyOptions.mm
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ - (void)setCompressionType:(RocksDBCompressionType)compressionType
_options.compression = (rocksdb::CompressionType)compressionType;
}

- (void)setCompactionStyle:(RocksDBCompactionStyle)compactionStyle
{
_options.compaction_style = (rocksdb::CompactionStyle)compactionStyle;
}

- (RocksDBCompactionStyle)compactionStyle
{
return (RocksDBCompactionStyle)_options.compaction_style;
}

- (void)setPrefixExtractor:(RocksDBPrefixExtractor *)prefixExtractor
{
_prefixExtractorWrapper = prefixExtractor;
Expand All @@ -161,6 +171,11 @@ - (void)setLevel0FileNumCompactionTrigger:(int)level0FileNumCompactionTrigger
_options.level0_file_num_compaction_trigger = level0FileNumCompactionTrigger;
}

- (int)level0FileNumCompactionTrigger
{
return _options.level0_file_num_compaction_trigger;
}

- (void)setLevel0SlowdownWritesTrigger:(int)level0SlowdownWritesTrigger
{
_options.level0_slowdown_writes_trigger = level0SlowdownWritesTrigger;
Expand Down Expand Up @@ -211,12 +226,12 @@ - (uint64_t)maxBytesForLevelBase
return _options.max_bytes_for_level_base;
}

- (void)setMaxBytesForLevelMultiplier:(int)maxBytesForLevelMultiplier
- (void)setMaxBytesForLevelMultiplier:(double)maxBytesForLevelMultiplier
{
_options.max_bytes_for_level_multiplier = maxBytesForLevelMultiplier;
}

- (int)maxBytesForLevelMultiplier
- (double)maxBytesForLevelMultiplier
{
return _options.max_bytes_for_level_multiplier;
}
Expand Down
25 changes: 25 additions & 0 deletions Code/RocksDBCompactRangeOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ typedef NS_ENUM(NSUInteger, RocksDBBottommostLevelCompaction)
*/
@interface RocksDBCompactRangeOptions : NSObject

/**
If true the compaction is exclusive, if false other compactions may run concurrently at the same time.
Default: true
*/
@property (nonatomic, assign) BOOL exclusiveManualCompaction;

/**
If true, compacted files will be moved to the minimum level capable
of holding the data or given level (specified non-negative targetLevel).
Expand All @@ -38,11 +44,30 @@ typedef NS_ENUM(NSUInteger, RocksDBBottommostLevelCompaction)
*/
@property (nonatomic, assign) int targetLevel;

/**
target_path_id for compaction output. Compaction outputs will be placed in options.dbPaths[target_path_id].
Default: 0
*/
@property (nonatomic, assign) uint32_t targetPathId;

/**
By default level based compaction will only compact the bottommost level if there is a compaction filter.
*/
@property (nonatomic, assign) RocksDBBottommostLevelCompaction bottommostLevelCompaction;

/**
If true, compaction will execute immediately even if doing so would cause the DB to
enter write stall mode. Otherwise, it'll sleep until load is low enough.
Default: false
*/
@property (nonatomic, assign) BOOL allowWriteStall;

/**
If > 0, it will replace the option in the DBOptions for this compaction
Default: 0
*/
@property (nonatomic, assign) uint32_t maxSubcompactions;

@end

NS_ASSUME_NONNULL_END
48 changes: 46 additions & 2 deletions Code/RocksDBCompactRangeOptions.mm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ - (instancetype)init

#pragma mark - Options

- (BOOL)exclusiveManualCompaction
{
return _options.exclusive_manual_compaction;
}

- (void)setExclusiveManualCompaction:(BOOL)exclusiveManualCompaction
{
_options.exclusive_manual_compaction = exclusiveManualCompaction;
}

- (BOOL)changeLevel
{
return _options.change_level;
Expand All @@ -51,6 +61,16 @@ - (void)setTargetLevel:(int)targetLevel
_options.target_level = targetLevel;
}

- (uint32_t)targetPathId
{
return _options.target_path_id;
}

- (void)setTargetPathId:(uint32_t)targetPathId
{
_options.target_path_id = targetPathId;
}

- (RocksDBBottommostLevelCompaction)bottommostLevelCompaction
{
switch (_options.bottommost_level_compaction) {
Expand All @@ -62,21 +82,45 @@ - (RocksDBBottommostLevelCompaction)bottommostLevelCompaction
return RocksDBBottommostLevelCompactionForce;
case rocksdb::BottommostLevelCompaction::kForceOptimized:
return RocksDBBottommostLevelCompactionForceOptimized;
}
}
}

- (void)setBottommostLevelCompaction:(RocksDBBottommostLevelCompaction)bottommostLevelCompaction
{
switch (bottommostLevelCompaction) {
case RocksDBBottommostLevelCompactionSkip:
_options.bottommost_level_compaction = rocksdb::BottommostLevelCompaction::kSkip;
break;
case RocksDBBottommostLevelCompactionIfHaveCompactionFilter:
_options.bottommost_level_compaction = rocksdb::BottommostLevelCompaction::kIfHaveCompactionFilter;
break;
case RocksDBBottommostLevelCompactionForce:
_options.bottommost_level_compaction = rocksdb::BottommostLevelCompaction::kForce;
break;
case RocksDBBottommostLevelCompactionForceOptimized:
_options.bottommost_level_compaction = rocksdb::BottommostLevelCompaction::kForceOptimized;
}
break;
}
}

- (BOOL)allowWriteStall
{
return _options.allow_write_stall;
}

- (void)setAllowWriteStall:(BOOL)allowWriteStall
{
_options.allow_write_stall = allowWriteStall;
}

- (uint32_t)maxSubcompactions
{
return _options.max_subcompactions;
}

- (void)setMaxSubcompactions:(uint32_t)maxSubcompactions
{
_options.max_subcompactions = maxSubcompactions;
}

@end
8 changes: 4 additions & 4 deletions Code/RocksDBError.mm
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ + (NSError *)errorWithRocksStatus:(rocksdb::Status)status
NSString *reason = [NSString stringWithUTF8String:status.ToString().c_str()];

NSDictionary *userInfo = @{
NSLocalizedDescriptionKey : @"Operation couldn't be completed",
NSLocalizedFailureReasonErrorKey : reason,
RocksDBSubcodeKey: @(status.subcode())
};
NSLocalizedDescriptionKey : @"Operation couldn't be completed",
NSLocalizedFailureReasonErrorKey : reason,
RocksDBSubcodeKey: @(status.subcode())
};

return [NSError errorWithDomain:RocksDBErrorDomain code:status.code() userInfo:userInfo];
}
Expand Down
20 changes: 19 additions & 1 deletion Code/RocksDBIterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,19 @@ NS_ASSUME_NONNULL_BEGIN
The iterator `isValid` after this call if the source contains an entry that comes at
or past the given key.
@param aKey The key to position the tartaritartor at.
@param aKey The key to position the iterator at.
*/
- (void)seekToKey:(NSData *)aKey;

/**
Positions the iterator at the last key in the source at or before the given key.
The iterator `isValid` after this call if the source contains an entry that comes at
or past the given key.
@param aKey The key to position the iterator at.
*/
- (void)seekForPrev:(NSData *)aKey;

/**
Moves to the next entry in the source. After this call, `isValid` is
true if the iterator was not positioned at the last entry in the source.
Expand Down Expand Up @@ -75,6 +84,15 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (NSData *)value;

/**
If an error has occurred, throw it. Else just continue
If non-blocking IO is requested and this operation cannot be
satisfied without doing some IO, then this throws Error with Status::Incomplete.
@param error RocksDBError if error happens in underlying native library.
*/
- (void)status:(NSError * __autoreleasing *)error;

/**
Executes a given block for each key in the iterator.
Expand Down
Loading

0 comments on commit 0394d22

Please sign in to comment.