Skip to content

Commit 0394d22

Browse files
committed
Merge branch 'release/0.11.0'
2 parents 3764b97 + 845693a commit 0394d22

20 files changed

+314
-93
lines changed

.github/workflows/main.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: ObjectiveRocks CI
2+
3+
on: [push]
4+
5+
jobs:
6+
macOS:
7+
name: Test macOS
8+
runs-on: macOS-latest
9+
steps:
10+
- uses: actions/checkout@v1
11+
with:
12+
submodules: recursive
13+
- name: macOS
14+
run: xcodebuild -workspace "ObjectiveRocks.xcworkspace" -scheme "ObjectiveRocks" -destination "platform=macOS" clean test
15+
pod_lint:
16+
name: Pod Lint
17+
runs-on: macOS-latest
18+
needs: [macOS]
19+
steps:
20+
- uses: actions/checkout@v1
21+
with:
22+
submodules: recursive
23+
- name: Pod Lint
24+
run: pod lib lint --skip-import-validation --allow-warnings

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Change Log
22

3+
## [0.11.0](https://github.com/iabudiab/ObjectiveRocks/releases/tag/0.11.0)
4+
5+
Released on 2020.01.08
6+
7+
- Improve `ColumnFamilyOptions` by @jurmous in PR #19
8+
- Add `compactionStyle` setting
9+
- Change `maxBytesForLevelMultiplier` to a double to match internal type
10+
- Add missing `level0FileNumCompactionTrigger` implementation
11+
- Expand `WriteOptions` with `noSlowdown` and `lowPriority` options by @jurmous in PR #21
12+
- Expand `RocksDBIterator` with `seekForPrev` and `status` methods by @jurmous in PR #22
13+
- Expand `CompactRangeOptions` by @jurmous in PR #25
14+
- `allowWriteStall`, `maxSubcompactions`, `targetPathId`, `exclusiveManualCompaction`
15+
- Removed redundant mem-copy in Iterator and improved release semantics in `enumerate` methods by @myeyesareblind in PRs #27 & #28
16+
- Fix `bottommostLevelCompaction` switch statement by @jurmous in PR #20
17+
18+
19+
### Updated
20+
21+
- Project settings to Xcode11
22+
323

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

Code/RocksDB.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ - (void)close
180180

181181
- (BOOL)isClosed {
182182
@synchronized(self) {
183-
return _db == nullptr;
183+
return _db == nullptr;
184184
}
185185
}
186186

Code/RocksDBColumnFamilyOptions.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616

1717
NS_ASSUME_NONNULL_BEGIN
1818

19+
/** The DB compression type. */
20+
typedef NS_ENUM(char, RocksDBCompactionStyle)
21+
{
22+
RocksDBCompressionStyleLevel = 0x0,
23+
RocksDBCompressionStyleUniversal = 0x1,
24+
RocksDBCompressionStyleFifo = 0x2,
25+
RocksDBCompressionStyleNone = 0x3
26+
};
27+
1928
/** The DB compression type. */
2029
typedef NS_ENUM(char, RocksDBCompressionType)
2130
{
@@ -70,6 +79,11 @@ typedef NS_ENUM(char, RocksDBCompressionType)
7079
*/
7180
@property (nonatomic, assign) RocksDBCompressionType compressionType;
7281

82+
/** @brief Set compaction style for DB.
83+
Default: RocksDBCompactionStyleLevel
84+
*/
85+
@property (nonatomic, assign) RocksDBCompactionStyle compactionStyle;
86+
7387
/** @brief If non-nil, the specified function to determine the
7488
prefixes for keys will be used. These prefixes will be placed in the filter.
7589
@@ -106,7 +120,7 @@ typedef NS_ENUM(char, RocksDBCompressionType)
106120
@property (nonatomic, assign) uint64_t maxBytesForLevelBase;
107121

108122
/** @brief Default: 10 */
109-
@property (nonatomic, assign) int maxBytesForLevelMultiplier;
123+
@property (nonatomic, assign) double maxBytesForLevelMultiplier;
110124

111125
/** @brief Puts are delayed 0-1 ms when any level has a compaction score that
112126
exceeds this limit.

Code/RocksDBColumnFamilyOptions.mm

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,16 @@ - (void)setCompressionType:(RocksDBCompressionType)compressionType
135135
_options.compression = (rocksdb::CompressionType)compressionType;
136136
}
137137

138+
- (void)setCompactionStyle:(RocksDBCompactionStyle)compactionStyle
139+
{
140+
_options.compaction_style = (rocksdb::CompactionStyle)compactionStyle;
141+
}
142+
143+
- (RocksDBCompactionStyle)compactionStyle
144+
{
145+
return (RocksDBCompactionStyle)_options.compaction_style;
146+
}
147+
138148
- (void)setPrefixExtractor:(RocksDBPrefixExtractor *)prefixExtractor
139149
{
140150
_prefixExtractorWrapper = prefixExtractor;
@@ -161,6 +171,11 @@ - (void)setLevel0FileNumCompactionTrigger:(int)level0FileNumCompactionTrigger
161171
_options.level0_file_num_compaction_trigger = level0FileNumCompactionTrigger;
162172
}
163173

174+
- (int)level0FileNumCompactionTrigger
175+
{
176+
return _options.level0_file_num_compaction_trigger;
177+
}
178+
164179
- (void)setLevel0SlowdownWritesTrigger:(int)level0SlowdownWritesTrigger
165180
{
166181
_options.level0_slowdown_writes_trigger = level0SlowdownWritesTrigger;
@@ -211,12 +226,12 @@ - (uint64_t)maxBytesForLevelBase
211226
return _options.max_bytes_for_level_base;
212227
}
213228

214-
- (void)setMaxBytesForLevelMultiplier:(int)maxBytesForLevelMultiplier
229+
- (void)setMaxBytesForLevelMultiplier:(double)maxBytesForLevelMultiplier
215230
{
216231
_options.max_bytes_for_level_multiplier = maxBytesForLevelMultiplier;
217232
}
218233

219-
- (int)maxBytesForLevelMultiplier
234+
- (double)maxBytesForLevelMultiplier
220235
{
221236
return _options.max_bytes_for_level_multiplier;
222237
}

Code/RocksDBCompactRangeOptions.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ typedef NS_ENUM(NSUInteger, RocksDBBottommostLevelCompaction)
2626
*/
2727
@interface RocksDBCompactRangeOptions : NSObject
2828

29+
/**
30+
If true the compaction is exclusive, if false other compactions may run concurrently at the same time.
31+
Default: true
32+
*/
33+
@property (nonatomic, assign) BOOL exclusiveManualCompaction;
34+
2935
/**
3036
If true, compacted files will be moved to the minimum level capable
3137
of holding the data or given level (specified non-negative targetLevel).
@@ -38,11 +44,30 @@ typedef NS_ENUM(NSUInteger, RocksDBBottommostLevelCompaction)
3844
*/
3945
@property (nonatomic, assign) int targetLevel;
4046

47+
/**
48+
target_path_id for compaction output. Compaction outputs will be placed in options.dbPaths[target_path_id].
49+
Default: 0
50+
*/
51+
@property (nonatomic, assign) uint32_t targetPathId;
52+
4153
/**
4254
By default level based compaction will only compact the bottommost level if there is a compaction filter.
4355
*/
4456
@property (nonatomic, assign) RocksDBBottommostLevelCompaction bottommostLevelCompaction;
4557

58+
/**
59+
If true, compaction will execute immediately even if doing so would cause the DB to
60+
enter write stall mode. Otherwise, it'll sleep until load is low enough.
61+
Default: false
62+
*/
63+
@property (nonatomic, assign) BOOL allowWriteStall;
64+
65+
/**
66+
If > 0, it will replace the option in the DBOptions for this compaction
67+
Default: 0
68+
*/
69+
@property (nonatomic, assign) uint32_t maxSubcompactions;
70+
4671
@end
4772

4873
NS_ASSUME_NONNULL_END

Code/RocksDBCompactRangeOptions.mm

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@ - (instancetype)init
3131

3232
#pragma mark - Options
3333

34+
- (BOOL)exclusiveManualCompaction
35+
{
36+
return _options.exclusive_manual_compaction;
37+
}
38+
39+
- (void)setExclusiveManualCompaction:(BOOL)exclusiveManualCompaction
40+
{
41+
_options.exclusive_manual_compaction = exclusiveManualCompaction;
42+
}
43+
3444
- (BOOL)changeLevel
3545
{
3646
return _options.change_level;
@@ -51,6 +61,16 @@ - (void)setTargetLevel:(int)targetLevel
5161
_options.target_level = targetLevel;
5262
}
5363

64+
- (uint32_t)targetPathId
65+
{
66+
return _options.target_path_id;
67+
}
68+
69+
- (void)setTargetPathId:(uint32_t)targetPathId
70+
{
71+
_options.target_path_id = targetPathId;
72+
}
73+
5474
- (RocksDBBottommostLevelCompaction)bottommostLevelCompaction
5575
{
5676
switch (_options.bottommost_level_compaction) {
@@ -62,21 +82,45 @@ - (RocksDBBottommostLevelCompaction)bottommostLevelCompaction
6282
return RocksDBBottommostLevelCompactionForce;
6383
case rocksdb::BottommostLevelCompaction::kForceOptimized:
6484
return RocksDBBottommostLevelCompactionForceOptimized;
65-
}
85+
}
6686
}
6787

6888
- (void)setBottommostLevelCompaction:(RocksDBBottommostLevelCompaction)bottommostLevelCompaction
6989
{
7090
switch (bottommostLevelCompaction) {
7191
case RocksDBBottommostLevelCompactionSkip:
7292
_options.bottommost_level_compaction = rocksdb::BottommostLevelCompaction::kSkip;
93+
break;
7394
case RocksDBBottommostLevelCompactionIfHaveCompactionFilter:
7495
_options.bottommost_level_compaction = rocksdb::BottommostLevelCompaction::kIfHaveCompactionFilter;
96+
break;
7597
case RocksDBBottommostLevelCompactionForce:
7698
_options.bottommost_level_compaction = rocksdb::BottommostLevelCompaction::kForce;
99+
break;
77100
case RocksDBBottommostLevelCompactionForceOptimized:
78101
_options.bottommost_level_compaction = rocksdb::BottommostLevelCompaction::kForceOptimized;
79-
}
102+
break;
103+
}
104+
}
105+
106+
- (BOOL)allowWriteStall
107+
{
108+
return _options.allow_write_stall;
109+
}
110+
111+
- (void)setAllowWriteStall:(BOOL)allowWriteStall
112+
{
113+
_options.allow_write_stall = allowWriteStall;
114+
}
115+
116+
- (uint32_t)maxSubcompactions
117+
{
118+
return _options.max_subcompactions;
119+
}
120+
121+
- (void)setMaxSubcompactions:(uint32_t)maxSubcompactions
122+
{
123+
_options.max_subcompactions = maxSubcompactions;
80124
}
81125

82126
@end

Code/RocksDBError.mm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ + (NSError *)errorWithRocksStatus:(rocksdb::Status)status
2020
NSString *reason = [NSString stringWithUTF8String:status.ToString().c_str()];
2121

2222
NSDictionary *userInfo = @{
23-
NSLocalizedDescriptionKey : @"Operation couldn't be completed",
24-
NSLocalizedFailureReasonErrorKey : reason,
25-
RocksDBSubcodeKey: @(status.subcode())
26-
};
23+
NSLocalizedDescriptionKey : @"Operation couldn't be completed",
24+
NSLocalizedFailureReasonErrorKey : reason,
25+
RocksDBSubcodeKey: @(status.subcode())
26+
};
2727

2828
return [NSError errorWithDomain:RocksDBErrorDomain code:status.code() userInfo:userInfo];
2929
}

Code/RocksDBIterator.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,19 @@ NS_ASSUME_NONNULL_BEGIN
4343
The iterator `isValid` after this call if the source contains an entry that comes at
4444
or past the given key.
4545
46-
@param aKey The key to position the tartaritartor at.
46+
@param aKey The key to position the iterator at.
4747
*/
4848
- (void)seekToKey:(NSData *)aKey;
4949

50+
/**
51+
Positions the iterator at the last key in the source at or before the given key.
52+
The iterator `isValid` after this call if the source contains an entry that comes at
53+
or past the given key.
54+
55+
@param aKey The key to position the iterator at.
56+
*/
57+
- (void)seekForPrev:(NSData *)aKey;
58+
5059
/**
5160
Moves to the next entry in the source. After this call, `isValid` is
5261
true if the iterator was not positioned at the last entry in the source.
@@ -75,6 +84,15 @@ NS_ASSUME_NONNULL_BEGIN
7584
*/
7685
- (NSData *)value;
7786

87+
/**
88+
If an error has occurred, throw it. Else just continue
89+
If non-blocking IO is requested and this operation cannot be
90+
satisfied without doing some IO, then this throws Error with Status::Incomplete.
91+
92+
@param error RocksDBError if error happens in underlying native library.
93+
*/
94+
- (void)status:(NSError * __autoreleasing *)error;
95+
7896
/**
7997
Executes a given block for each key in the iterator.
8098

0 commit comments

Comments
 (0)