@@ -31,7 +31,7 @@ compact
31
31
activity.
32
32
33
33
.. versionchanged:: 2.2 :dbcommand:`compact` blocks activities only
34
- for its database.
34
+ for its database.
35
35
36
36
- ``paddingFactor: <factor>``
37
37
@@ -55,8 +55,9 @@ compact
55
55
56
56
.. versionadded:: v2.2
57
57
58
- It is recommended that you always add at least 100 bytes of padding,
59
- and at least 10% of the doc size.
58
+ In production deployments, collections should always have at least
59
+ 100 bytes of padding, and generally have a padding factor that is
60
+ 10% of the average document size.
60
61
61
62
.. code-block:: javascript
62
63
@@ -67,19 +68,20 @@ compact
67
68
Always have an up-to-date backup before performing server
68
69
maintenance such as the :dbcommand:`compact` operation.
69
70
70
- Note the following command behaviors:
71
+ Note the following behaviors:
71
72
72
73
- :dbcommand:`compact` blocks all other activity (in v2.2, blocks
73
74
activities only for its database.) You may view the intermediate
74
75
progress either by viewing the the :program:`mongod` log file, or
75
76
by running the :method:`db.currentOp()` in another shell instance.
76
77
77
78
- :dbcommand:`compact` removes any :term:`padding factor` in the
78
- collection if the command is run without either the
79
+ collection when issued without either the
79
80
``paddingFactor`` option or the ``paddingByte`` option. This may
80
- impact performance if the documents grow regularly. However, the
81
- existing paddingFactor statistics is kept for the collection and
82
- will be used for future inserts.
81
+ impact performance if the documents grow regularly. However,
82
+ :dbcommand:`compact` retains
83
+ existing paddingFactor statistics for the collection that MongoDB
84
+ will use to calculate the padding factor for future inserts.
83
85
84
86
- :dbcommand:`compact` generally uses less disk space than
85
87
:dbcommand:`repairDatabase` and is faster. However,the
@@ -90,14 +92,14 @@ compact
90
92
- If you kill the operation by running the :method:`db.killOp(opid) <db.killOP()>` or
91
93
restart the server before it has finished:
92
94
93
- + If you have journaling enabled, your data will
95
+ - If you have journaling enabled, your data will
94
96
be safe. However, you may have to manually rebuild the indexes.
95
97
96
- + If you do not have journaling enabled, the :dbcommand:`compact`
98
+ - If you do not have journaling enabled, the :dbcommand:`compact`
97
99
command is much less safe, and there are no guarantees made about
98
100
the safety of your data in the event of a shutdown or a kill.
99
101
100
- + In either case, much of the existing free space in the
102
+ - In either case, much of the existing free space in the
101
103
collection may become un-reusable. In this scenario, you should
102
104
rerun the compaction to completion to restore the use of this free
103
105
space.
@@ -119,16 +121,16 @@ compact
119
121
- :dbcommand:`compact` commands do not replicate. When running
120
122
compact on a :term:`replica set`:
121
123
122
- + Compact each member separately.
124
+ - Compact each member separately.
123
125
124
- + Ideally, compaction runs on a secondary. (See option
126
+ - Ideally, compaction runs on a secondary. (See option
125
127
``force:true`` above for information regarding compacting the
126
128
primary.)
127
129
128
- + If :dbcommand:`compact` runs on a secondary, the secondary will
129
- go into "recovering" state automatically to prevent reads from
130
- being routed to it during compation . Once the compaction is
131
- finished, it will automatically return to secondary state.
130
+ - If :dbcommand:`compact` runs on a secondary, the secondary will
131
+ enter a "recovering" state to prevent clients from directing
132
+ treads to it during compaction . Once the compaction
133
+ finishes the secondary will automatically return to secondary state.
132
134
133
135
You may refer to the "`partial script for automating step down
134
136
and compaction
@@ -148,4 +150,4 @@ compact
148
150
149
151
.. seealso::
150
152
151
- :dbcommand:`repairDatabase`
153
+ :dbcommand:`repairDatabase`
0 commit comments