Skip to content

Commit 850e312

Browse files
ravindk89kay-kim
authored andcommitted
DOCS-8478: Size and Count accuracy in WT after unexpected shutdown
Extension of DOCS-7979, applied to count dbcommand, dbstats and helper methods Signed-off-by: kay <[email protected]>
1 parent 1517851 commit 850e312

File tree

5 files changed

+38
-21
lines changed

5 files changed

+38
-21
lines changed

source/includes/fact-unexpected-shutdown-accuracy.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ The amount of drift depends on the number of insert, update, or delete
66
operations performed between the last :ref:`checkpoint
77
<storage-wiredtiger-checkpoints>` and the unclean shutdown. Checkpoints
88
usually occur every 60 seconds. However, :program:`mongod` instances running
9-
with non-default :option:`syncDelay` settings may have more or less frequent
9+
with non-default :option:`--syncdelay` settings may have more or less frequent
1010
checkpoints.
1111

1212
Run :dbcommand:`validate` on each collection on the :program:`mongod` to
13-
to restore the correct statistics after an unclean shutdown.
13+
to restore the correct statistics after an unclean shutdown. If multiple
14+
:program:`mongod` instances experienced an unclean shutdown, perform the
15+
validation procedure on each :program:`mongod`.

source/reference/command/count.txt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,17 @@ Behavior
4444

4545
.. include:: /includes/extracts/fact-count-on-sharded-clusters-cmd-count.rst
4646

47-
For MongoDB instances using the :doc:`WiredTiger </core/wiredtiger>`
48-
storage engine, after an unclean shutdown, statistics on size and count
49-
may off by up to 1000 documents as reported by :dbcommand:`collStats`,
50-
:dbcommand:`dbStats`, :dbcommand:`count`. To restore the correct
51-
statistics for the collection, run :dbcommand:`validate` on the
52-
collection.
47+
Accuracy after Unexpected Shutdown
48+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
49+
50+
.. |cmd| replace:: :dbcommand:`count`
51+
.. |opt| replace:: count
52+
53+
.. include:: /includes/fact-unexpected-shutdown-accuracy.rst
54+
55+
.. note::
56+
This loss of accuracy only applies to :dbcommand:`count`
57+
operations that do *not* include a query document.
5358

5459
Examples
5560
--------

source/reference/command/dbStats.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,13 @@ The time required to run the command depends on the total size of the
4545
database. Because the command must touch all data files, the command
4646
may take several seconds to run.
4747

48-
For MongoDB instances using the :doc:`WiredTiger </core/wiredtiger>`
49-
storage engine, after an unclean shutdown, statistics on size and count
50-
may off by up to 1000 documents as reported by :dbcommand:`collStats`,
51-
:dbcommand:`dbStats`, :dbcommand:`count`. To restore the correct
52-
statistics for the collection, run :dbcommand:`validate` on the
53-
collection.
48+
Accuracy after Unexpected Shutdown
49+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50+
51+
.. |cmd| replace:: :dbcommand:`dbStats`
52+
.. |opt| replace:: count and size
53+
54+
.. include:: /includes/fact-unexpected-shutdown-accuracy.rst
5455

5556
.. _dbstats-output:
5657

source/reference/method/db.collection.stats.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,18 @@ by ``scale``.
4949
.. note::
5050

5151
The scale factor rounds values to whole numbers.
52-
52+
5353
Depending on the storage engine, the data returned may differ. For details on
5454
the fields, see :ref:`output details <collStats-output>`.
5555

56+
Accuracy after Unexpected Shutdown
57+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
58+
59+
.. |cmd| replace:: :method:`db.collection.stats()`
60+
.. |opt| replace:: count and size
61+
62+
.. include:: /includes/fact-unexpected-shutdown-accuracy.rst
63+
5664
Index Filter Behavior
5765
~~~~~~~~~~~~~~~~~~~~~
5866

source/reference/method/db.stats.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ Description
3131
Behavior
3232
--------
3333

34-
For MongoDB instances using the :doc:`WiredTiger </core/wiredtiger>`
35-
storage engine, after an unclean shutdown, statistics on size and count
36-
may off by up to 1000 documents as reported by :dbcommand:`collStats`,
37-
:dbcommand:`dbStats`, :dbcommand:`count`. To restore the correct
38-
statistics for the collection, run :dbcommand:`validate` on the
39-
collection.
34+
Accuracy after Unexpected Shutdown
35+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36+
37+
.. |cmd| replace:: :method:`db.stats`
38+
.. |opt| replace:: count and size
39+
40+
.. include:: /includes/fact-unexpected-shutdown-accuracy.rst
4041

4142
Example
4243
-------

0 commit comments

Comments
 (0)