Skip to content

Commit 4a75aec

Browse files
authored
Merge pull request #703 from IntersectMBO/wenkokke/rename-lazy-levelling
fix: rename `MergePolicyLazyLevelling` to `LazyLevelling`
2 parents 5a63797 + 4953bb2 commit 4a75aec

File tree

11 files changed

+93
-93
lines changed

11 files changed

+93
-93
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ Otherwise, the merge policy is listed as N/A.
154154
<tr>
155155
<td></td>
156156
<td>Close</td>
157-
<td><code>MergePolicyLazyLevelling</code></td>
157+
<td><code>LazyLevelling</code></td>
158158
<td><span class="math inline">$O(o \: T \: \log_T
159159
\frac{n}{B})$</span></td>
160160
</tr>
@@ -167,27 +167,27 @@ Otherwise, the merge policy is listed as N/A.
167167
<tr>
168168
<td></td>
169169
<td>Close</td>
170-
<td><code>MergePolicyLazyLevelling</code></td>
170+
<td><code>LazyLevelling</code></td>
171171
<td><span class="math inline">$O(T \: \log_T \frac{n}{B})$</span></td>
172172
</tr>
173173
<tr>
174174
<td></td>
175175
<td>Lookup</td>
176-
<td><code>MergePolicyLazyLevelling</code></td>
176+
<td><code>LazyLevelling</code></td>
177177
<td><span class="math inline">$O(T \: \log_T \frac{n}{B})$</span></td>
178178
</tr>
179179
<tr>
180180
<td></td>
181181
<td>Range Lookup</td>
182-
<td><code>MergePolicyLazyLevelling</code></td>
182+
<td><code>LazyLevelling</code></td>
183183
<td><span class="math inline">$O(T \: \log_T \frac{n}{B} +
184184
\frac{b}{P})$</span>
185185
*</td>
186186
</tr>
187187
<tr>
188188
<td></td>
189189
<td>Insert/Delete/Update</td>
190-
<td><code>MergePolicyLazyLevelling</code></td>
190+
<td><code>LazyLevelling</code></td>
191191
<td><span class="math inline">$O(\frac{1}{P} \: \log_T
192192
\frac{n}{B})$</span></td>
193193
</tr>
@@ -206,7 +206,7 @@ Otherwise, the merge policy is listed as N/A.
206206
<tr>
207207
<td>Snapshot</td>
208208
<td>Save</td>
209-
<td><code>MergePolicyLazyLevelling</code></td>
209+
<td><code>LazyLevelling</code></td>
210210
<td><span class="math inline">$O(T \: \log_T \frac{n}{B})$</span></td>
211211
</tr>
212212
<tr>
@@ -218,7 +218,7 @@ Otherwise, the merge policy is listed as N/A.
218218
<tr>
219219
<td></td>
220220
<td>Delete</td>
221-
<td><code>MergePolicyLazyLevelling</code></td>
221+
<td><code>LazyLevelling</code></td>
222222
<td><span class="math inline">$O(T \: \log_T \frac{n}{B})$</span></td>
223223
</tr>
224224
<tr>
@@ -230,13 +230,13 @@ Otherwise, the merge policy is listed as N/A.
230230
<tr>
231231
<td>Cursor</td>
232232
<td>Create</td>
233-
<td><code>MergePolicyLazyLevelling</code></td>
233+
<td><code>LazyLevelling</code></td>
234234
<td><span class="math inline">$O(T \: \log_T \frac{n}{B})$</span></td>
235235
</tr>
236236
<tr>
237237
<td></td>
238238
<td>Close</td>
239-
<td><code>MergePolicyLazyLevelling</code></td>
239+
<td><code>LazyLevelling</code></td>
240240
<td><span class="math inline">$O(T \: \log_T \frac{n}{B})$</span></td>
241241
</tr>
242242
<tr>

lsm-tree.cabal

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -82,41 +82,41 @@ description:
8282
If the cost depends on the merge policy, the table contains one entry for each merge policy.
8383
Otherwise, the merge policy is listed as N\/A.
8484

85-
+----------+------------------------+----------------------------+------------------------------------------------+
86-
| Resource | Operation | Merge policy | Cost in disk I\/O operations |
87-
+==========+========================+============================+================================================+
88-
| Session | Create\/Open | N\/A | \(O(1)\) |
89-
+----------+------------------------+----------------------------+------------------------------------------------+
90-
| | Close | @MergePolicyLazyLevelling@ | \(O(o \: T \: \log_T \frac{n}{B})\) |
91-
+----------+------------------------+----------------------------+------------------------------------------------+
92-
| Table | Create | N\/A | \(O(1)\) |
93-
+----------+------------------------+----------------------------+------------------------------------------------+
94-
| | Close | @MergePolicyLazyLevelling@ | \(O(T \: \log_T \frac{n}{B})\) |
95-
+----------+------------------------+----------------------------+------------------------------------------------+
96-
| | Lookup | @MergePolicyLazyLevelling@ | \(O(T \: \log_T \frac{n}{B})\) |
97-
+----------+------------------------+----------------------------+------------------------------------------------+
98-
| | Range Lookup | @MergePolicyLazyLevelling@ | \(O(T \: \log_T \frac{n}{B} + \frac{b}{P})\)* |
99-
+----------+------------------------+----------------------------+------------------------------------------------+
100-
| | Insert\/Delete\/Update | @MergePolicyLazyLevelling@ | \(O(\frac{1}{P} \: \log_T \frac{n}{B})\) |
101-
+----------+------------------------+----------------------------+------------------------------------------------+
102-
| | Duplicate | N\/A | \(O(0)\) |
103-
+----------+------------------------+----------------------------+------------------------------------------------+
104-
| | Union | N\/A | \(O(\frac{n}{P})\) |
105-
+----------+------------------------+----------------------------+------------------------------------------------+
106-
| Snapshot | Save | @MergePolicyLazyLevelling@ | \(O(T \: \log_T \frac{n}{B})\) |
107-
+----------+------------------------+----------------------------+------------------------------------------------+
108-
| | Open | N\/A | \(O(\frac{n}{P})\) |
109-
+----------+------------------------+----------------------------+------------------------------------------------+
110-
| | Delete | @MergePolicyLazyLevelling@ | \(O(T \: \log_T \frac{n}{B})\) |
111-
+----------+------------------------+----------------------------+------------------------------------------------+
112-
| | List | N\/A | \(O(s)\) |
113-
+----------+------------------------+----------------------------+------------------------------------------------+
114-
| Cursor | Create | @MergePolicyLazyLevelling@ | \(O(T \: \log_T \frac{n}{B})\) |
115-
+----------+------------------------+----------------------------+------------------------------------------------+
116-
| | Close | @MergePolicyLazyLevelling@ | \(O(T \: \log_T \frac{n}{B})\) |
117-
+----------+------------------------+----------------------------+------------------------------------------------+
118-
| | Read next entry | N\/A | \(O(\frac{1}{P})\) |
119-
+----------+------------------------+----------------------------+------------------------------------------------+
85+
+----------+------------------------+-----------------+------------------------------------------------+
86+
| Resource | Operation | Merge policy | Cost in disk I\/O operations |
87+
+==========+========================+=================+================================================+
88+
| Session | Create\/Open | N\/A | \(O(1)\) |
89+
+----------+------------------------+-----------------+------------------------------------------------+
90+
| | Close | @LazyLevelling@ | \(O(o \: T \: \log_T \frac{n}{B})\) |
91+
+----------+------------------------+-----------------+------------------------------------------------+
92+
| Table | Create | N\/A | \(O(1)\) |
93+
+----------+------------------------+-----------------+------------------------------------------------+
94+
| | Close | @LazyLevelling@ | \(O(T \: \log_T \frac{n}{B})\) |
95+
+----------+------------------------+-----------------+------------------------------------------------+
96+
| | Lookup | @LazyLevelling@ | \(O(T \: \log_T \frac{n}{B})\) |
97+
+----------+------------------------+-----------------+------------------------------------------------+
98+
| | Range Lookup | @LazyLevelling@ | \(O(T \: \log_T \frac{n}{B} + \frac{b}{P})\)* |
99+
+----------+------------------------+-----------------+------------------------------------------------+
100+
| | Insert\/Delete\/Update | @LazyLevelling@ | \(O(\frac{1}{P} \: \log_T \frac{n}{B})\) |
101+
+----------+------------------------+-----------------+------------------------------------------------+
102+
| | Duplicate | N\/A | \(O(0)\) |
103+
+----------+------------------------+-----------------+------------------------------------------------+
104+
| | Union | N\/A | \(O(\frac{n}{P})\) |
105+
+----------+------------------------+-----------------+------------------------------------------------+
106+
| Snapshot | Save | @LazyLevelling@ | \(O(T \: \log_T \frac{n}{B})\) |
107+
+----------+------------------------+-----------------+------------------------------------------------+
108+
| | Open | N\/A | \(O(\frac{n}{P})\) |
109+
+----------+------------------------+-----------------+------------------------------------------------+
110+
| | Delete | @LazyLevelling@ | \(O(T \: \log_T \frac{n}{B})\) |
111+
+----------+------------------------+-----------------+------------------------------------------------+
112+
| | List | N\/A | \(O(s)\) |
113+
+----------+------------------------+-----------------+------------------------------------------------+
114+
| Cursor | Create | @LazyLevelling@ | \(O(T \: \log_T \frac{n}{B})\) |
115+
+----------+------------------------+-----------------+------------------------------------------------+
116+
| | Close | @LazyLevelling@ | \(O(T \: \log_T \frac{n}{B})\) |
117+
+----------+------------------------+-----------------+------------------------------------------------+
118+
| | Read next entry | N\/A | \(O(\frac{1}{P})\) |
119+
+----------+------------------------+-----------------+------------------------------------------------+
120120

121121
(*The variable \(b\) refers to the number of entries retrieved by the range lookup.)
122122

src/Database/LSMTree.hs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ module Database.LSMTree (
104104
-- * Table Configuration #table_configuration#
105105
TableConfig (..),
106106
defaultTableConfig,
107-
MergePolicy (MergePolicyLazyLevelling),
107+
MergePolicy (LazyLevelling),
108108
SizeRatio (Four),
109109
WriteBufferAlloc (AllocNumEntries),
110110
BloomFilterAlloc (AllocFixed, AllocRequestFPR),
@@ -381,7 +381,7 @@ Otherwise, the session directory is opened as an existing session.
381381
382382
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
383383
384-
['MergePolicyLazyLevelling']:
384+
['LazyLevelling']:
385385
\(O(o \: T \log_T \frac{n}{B})\).
386386
387387
The variable \(o\) refers to the number of open tables and cursors in the session.
@@ -497,7 +497,7 @@ Close a session.
497497
498498
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
499499
500-
['MergePolicyLazyLevelling']:
500+
['LazyLevelling']:
501501
\(O(o \: T \log_T \frac{n}{B})\).
502502
503503
The variable \(o\) refers to the number of open tables and cursors in the session.
@@ -657,7 +657,7 @@ True
657657
658658
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
659659
660-
['MergePolicyLazyLevelling']:
660+
['LazyLevelling']:
661661
\(O(T \log_T \frac{n}{B})\).
662662
663663
Membership tests can be performed concurrently from multiple Haskell threads.
@@ -693,7 +693,7 @@ The batch of keys corresponds in-order to the batch of results.
693693
694694
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
695695
696-
['MergePolicyLazyLevelling']:
696+
['LazyLevelling']:
697697
\(O(T \log_T \frac{n}{B})\).
698698
699699
The variable \(b\) refers to the length of the input vector.
@@ -793,7 +793,7 @@ FoundWithBlob (Value "Hello") (Blob "World")
793793
794794
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
795795
796-
['MergePolicyLazyLevelling']:
796+
['LazyLevelling']:
797797
\(O(T \log_T \frac{n}{B})\).
798798
799799
Lookups can be performed concurrently from multiple Haskell threads.
@@ -832,7 +832,7 @@ The batch of keys corresponds in-order to the batch of results.
832832
833833
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
834834
835-
['MergePolicyLazyLevelling']:
835+
['LazyLevelling']:
836836
\(O(T \log_T \frac{n}{B})\).
837837
838838
The variable \(b\) refers to the length of the input vector.
@@ -959,7 +959,7 @@ Found (Value "Goodbye")
959959
960960
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
961961
962-
['MergePolicyLazyLevelling']:
962+
['LazyLevelling']:
963963
\(O(\log_T \frac{n}{B})\).
964964
965965
Throws the following exceptions:
@@ -995,7 +995,7 @@ Variant of 'insert' for batch insertions.
995995
996996
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
997997
998-
['MergePolicyLazyLevelling']:
998+
['LazyLevelling']:
999999
\(O(b \: \log_T \frac{n}{B})\).
10001000
10011001
The variable \(b\) refers to the length of the input vector.
@@ -1048,7 +1048,7 @@ Found (Value "Hello Goodbye")
10481048
10491049
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
10501050
1051-
['MergePolicyLazyLevelling']:
1051+
['LazyLevelling']:
10521052
\(O(\log_T \frac{n}{B})\).
10531053
10541054
Throws the following exceptions:
@@ -1091,7 +1091,7 @@ Variant of 'upsert' for batch insertions.
10911091
10921092
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
10931093
1094-
['MergePolicyLazyLevelling']:
1094+
['LazyLevelling']:
10951095
\(O(b \: \log_T \frac{n}{B})\).
10961096
10971097
The variable \(b\) refers to the length of the input vector.
@@ -1140,7 +1140,7 @@ Found (Value "Hello")
11401140
11411141
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
11421142
1143-
['MergePolicyLazyLevelling']:
1143+
['LazyLevelling']:
11441144
\(O(\log_T \frac{n}{B})\).
11451145
11461146
Throws the following exceptions:
@@ -1172,7 +1172,7 @@ Variant of 'delete' for batch deletions.
11721172
11731173
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
11741174
1175-
['MergePolicyLazyLevelling']:
1175+
['LazyLevelling']:
11761176
\(O(b \: \log_T \frac{n}{B})\).
11771177
11781178
The variable \(b\) refers to the length of the input vector.
@@ -1217,7 +1217,7 @@ Update generalises 'insert', 'delete', and 'upsert'.
12171217
12181218
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
12191219
1220-
['MergePolicyLazyLevelling']:
1220+
['LazyLevelling']:
12211221
\(O(\log_T \frac{n}{B})\).
12221222
12231223
Throws the following exceptions:
@@ -1257,7 +1257,7 @@ Variant of 'update' for batch updates.
12571257
12581258
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
12591259
1260-
['MergePolicyLazyLevelling']:
1260+
['LazyLevelling']:
12611261
\(O(b \: \log_T \frac{n}{B})\).
12621262
12631263
The variable \(b\) refers to the length of the input vector.

src/Database/LSMTree/Internal/Config.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ instance NFData TableConfig where
8585
defaultTableConfig :: TableConfig
8686
defaultTableConfig =
8787
TableConfig
88-
{ confMergePolicy = MergePolicyLazyLevelling
88+
{ confMergePolicy = LazyLevelling
8989
, confSizeRatio = Four
9090
, confWriteBufferAlloc = AllocNumEntries 20_000
9191
, confBloomFilterAlloc = defaultBloomFilterAlloc
@@ -112,12 +112,12 @@ data MergePolicy =
112112
-- | Use tiering on intermediate levels, and levelling on the last level.
113113
-- This makes it easier for delete operations to disappear on the last
114114
-- level.
115-
MergePolicyLazyLevelling
115+
LazyLevelling
116116
-- TODO: add other merge policies, like tiering and levelling.
117117
deriving stock (Eq, Show)
118118

119119
instance NFData MergePolicy where
120-
rnf MergePolicyLazyLevelling = ()
120+
rnf LazyLevelling = ()
121121

122122
{-------------------------------------------------------------------------------
123123
Size ratio

src/Database/LSMTree/Internal/MergeSchedule.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ mergePolicyForLevel ::
823823
-> Levels m h
824824
-> UnionLevel m h
825825
-> MergePolicyForLevel
826-
mergePolicyForLevel MergePolicyLazyLevelling (LevelNo n) nextLevels unionLevel
826+
mergePolicyForLevel LazyLevelling (LevelNo n) nextLevels unionLevel
827827
| n == 1
828828
= LevelTiering -- always use tiering on first level
829829

src/Database/LSMTree/Internal/Snapshot/Codec.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,13 +314,13 @@ instance DecodeVersioned TableConfig where
314314
-- MergePolicy
315315

316316
instance Encode MergePolicy where
317-
encode MergePolicyLazyLevelling = encodeWord 0
317+
encode LazyLevelling = encodeWord 0
318318

319319
instance DecodeVersioned MergePolicy where
320320
decodeVersioned V0 = do
321321
tag <- decodeWord
322322
case tag of
323-
0 -> pure MergePolicyLazyLevelling
323+
0 -> pure LazyLevelling
324324
_ -> fail ("[MergePolicy] Unexpected tag: " <> show tag)
325325

326326
-- SizeRatio

0 commit comments

Comments
 (0)