Skip to content

Commit 0dec006

Browse files
authored
Merge pull request #725 from IntersectMBO/wenkokke/fix-diskio-cost
doc: fix disk I/O complexity of several operators
2 parents 583aab6 + b18ea28 commit 0dec006

File tree

2 files changed

+28
-22
lines changed

2 files changed

+28
-22
lines changed

src/Database/LSMTree.hs

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -380,16 +380,16 @@ Run an action with access to a session opened from a session directory.
380380
If the session directory is empty, a new session is created.
381381
Otherwise, the session directory is opened as an existing session.
382382
383-
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
383+
If there are no open tables or cursors when the session terminates, then this disk I\/O complexity of this operation is \(O(1)\).
384+
Otherwise, 'closeTable' is called for each open table and 'closeCursor' is called for each open cursor.
385+
Consequently, the worst-case disk I\/O complexity of this operation depends on the merge policy of the open tables in the session.
386+
The following assumes all tables in the session have the same merge policy:
384387
385388
['LazyLevelling']:
386-
\(O(o \: T \log_T \frac{n}{B})\).
389+
\(O(o \: T \log_T \frac{n}{B})\).
387390
388391
The variable \(o\) refers to the number of open tables and cursors in the session.
389392
390-
If the session has any open tables, then 'closeTable' is called for each open table and 'closeCursor' is called for each open cursor.
391-
Otherwise, the disk I\/O cost operation is \(O(1)\).
392-
393393
This function is exception-safe for both synchronous and asynchronous exceptions.
394394
395395
It is recommended to use this function instead of 'openSession' and 'closeSession'.
@@ -496,16 +496,16 @@ openSessionIO tracer sessionDir = do
496496
{- |
497497
Close a session.
498498
499-
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
499+
If there are no open tables or cursors in the session, then this disk I\/O complexity of this operation is \(O(1)\).
500+
Otherwise, 'closeTable' is called for each open table and 'closeCursor' is called for each open cursor.
501+
Consequently, the worst-case disk I\/O complexity of this operation depends on the merge policy of the tables in the session.
502+
The following assumes all tables in the session have the same merge policy:
500503
501504
['LazyLevelling']:
502-
\(O(o \: T \log_T \frac{n}{B})\).
505+
\(O(o \: T \log_T \frac{n}{B})\).
503506
504507
The variable \(o\) refers to the number of open tables and cursors in the session.
505508
506-
If the session has any open tables, then 'closeTable' is called for each open table and 'closeCursor' is called for each open cursor.
507-
Otherwise, this operation takes constant time.
508-
509509
Closing is idempotent, i.e., closing a closed session does nothing.
510510
All other operations on a closed session will throw an exception.
511511
-}
@@ -531,7 +531,10 @@ closeSession (Session session) =
531531
{- |
532532
Run an action with access to an empty table.
533533
534-
The worst-case disk I\/O complexity of this operation is \(O(1)\).
534+
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
535+
536+
['LazyLevelling']:
537+
\(O(T \log_T \frac{n}{B})\).
535538
536539
This function is exception-safe for both synchronous and asynchronous exceptions.
537540
@@ -621,7 +624,10 @@ newTableWith tableConfig (Session session) =
621624
{- |
622625
Close a table.
623626
624-
The worst-case disk I\/O complexity of this operation is \(O(T \log_T \frac{n}{B})\).
627+
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
628+
629+
['LazyLevelling']:
630+
\(O(T \log_T \frac{n}{B})\).
625631
626632
Closing is idempotent, i.e., closing a closed table does nothing.
627633
All other operations on a closed table will throw an exception.

src/Database/LSMTree/Simple.hs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -344,16 +344,16 @@ newtype Session = Session (LSMT.Session IO)
344344
{- |
345345
Run an action with access to a session opened from a session directory.
346346
347-
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
347+
If there are no open tables or cursors when the session terminates, then this disk I\/O complexity of this operation is \(O(1)\).
348+
Otherwise, 'closeTable' is called for each open table and 'closeCursor' is called for each open cursor.
349+
Consequently, the worst-case disk I\/O complexity of this operation depends on the merge policy of the open tables in the session.
350+
The following assumes all tables in the session have the same merge policy:
348351
349352
['LazyLevelling']:
350-
\(O(o \: T \log_T \frac{n}{B})\).
353+
\(O(o \: T \log_T \frac{n}{B})\).
351354
352355
The variable \(o\) refers to the number of open tables and cursors in the session.
353356
354-
If the session has any open tables, then 'closeTable' is called for each open table and 'closeCursor' is called for each open cursor.
355-
Otherwise, the disk I\/O cost operation is \(O(1)\).
356-
357357
This function is exception-safe for both synchronous and asynchronous exceptions.
358358
359359
It is recommended to use this function instead of 'openSession' and 'closeSession'.
@@ -406,16 +406,16 @@ openSession dir = do
406406
{- |
407407
Close a session.
408408
409-
The worst-case disk I\/O complexity of this operation depends on the merge policy of the table:
409+
If there are no open tables or cursors in the session, then this disk I\/O complexity of this operation is \(O(1)\).
410+
Otherwise, 'closeTable' is called for each open table and 'closeCursor' is called for each open cursor.
411+
Consequently, the worst-case disk I\/O complexity of this operation depends on the merge policy of the tables in the session.
412+
The following assumes all tables in the session have the same merge policy:
410413
411414
['LazyLevelling']:
412-
\(O(o \: T \log_T \frac{n}{B})\).
415+
\(O(o \: T \log_T \frac{n}{B})\).
413416
414417
The variable \(o\) refers to the number of open tables and cursors in the session.
415418
416-
If the session has any open tables, then 'closeTable' is called for each open table and 'closeCursor' is called for each open cursor.
417-
Otherwise, the disk I\/O cost operation is \(O(1)\).
418-
419419
Closing is idempotent, i.e., closing a closed session does nothing.
420420
All other operations on a closed session will throw an exception.
421421
-}

0 commit comments

Comments
 (0)