From 15dd0d1818102fd5d2e529f0dce25a222d444115 Mon Sep 17 00:00:00 2001 From: Sam Kleinman Date: Sat, 28 Jul 2012 10:03:24 -0400 Subject: [PATCH] adding language and support for better indexing of powerOf2Sizes --- .ext/mongodb_domain.py | 7 ++++++- source/reference/commands.txt | 25 +++++++++++++------------ source/reference/glossary.txt | 13 +++++++++++-- source/tutorial/expire-data.txt | 4 +++- 4 files changed, 33 insertions(+), 16 deletions(-) diff --git a/.ext/mongodb_domain.py b/.ext/mongodb_domain.py index 980e3cdcf75..8076d816983 100644 --- a/.ext/mongodb_domain.py +++ b/.ext/mongodb_domain.py @@ -108,7 +108,7 @@ def add_target_and_index(self, name_obj, sig, signode): def get_index_text(self, objectname, name_obj): name, obj = name_obj - if self.objtype == 'command': + if self.objtype == 'dbcommand': return _('%s (database command)') % name elif self.objtype == 'operator': return _('%s (operator)') % name @@ -124,6 +124,8 @@ def get_index_text(self, objectname, name_obj): return _('%s (shell output)') % (name) elif self.objtype == 'function': return _('%s (shell method)') % (name) + elif self.objtype == 'collflag': + return _('%s (collection flag)') % (name) return '' def run(self): @@ -200,6 +202,7 @@ class MongoDBDomain(Domain): 'aggregator': ObjType(l_('aggregator'), 'aggregator'), 'group': ObjType(l_('group'), 'group'), 'expression': ObjType(l_('expression'), 'expression'), + 'collflag': ObjType(l_('collflag'), 'collflag'), } directives = { @@ -214,6 +217,7 @@ class MongoDBDomain(Domain): 'aggregator': MongoDBCallable, 'group': MongoDBCallable, 'expression': MongoDBCallable, + 'collflag': MongoDBCallable, } roles = { 'dbcommand': MongoDBXRefRole(), @@ -227,6 +231,7 @@ class MongoDBDomain(Domain): 'aggregator': MongoDBXRefRole(), 'group': MongoDBXRefRole(), 'expression': MongoDBXRefRole(), + 'collflag': MongoDBXRefRole(), } initial_data = { 'objects': {}, # fullname -> docname, objtype diff --git a/source/reference/commands.txt b/source/reference/commands.txt index 5551d318e6a..fa1eedde718 100644 --- a/source/reference/commands.txt +++ b/source/reference/commands.txt @@ -1272,7 +1272,7 @@ Collections :dbcommand:`collMod` makes it possible to add flags to a collection to modify the behavior of MongoDB. In the current release the only - available flag is ``usePowerof2Sizes``. The command takes the + available flag is :collflag:`usePowerof2Sizes`. The command takes the following prototype form: .. code-block:: javascript @@ -1286,17 +1286,18 @@ Collections .. index:: document; space allocation .. index:: usePowerOf2Sizes .. _usePowerOf2Sizes: - - The ``usePowerOf2Sizes`` flag changes the method that MongoDB uses - to allocate space on disk for documents in this collection. By - setting ``usePowerOf2Sizes``, you ensure that MongoDB will - allocates space for documents in sizes that are powers of 2 - (e.g. 4, 8, 16, 32, 64, 128, 512...) With this option MongoDB will - be able to more effectively reuse space. - - ``usePowerOf2Sizes`` is useful for collection where you will be - inserting and deleting large numbers of documents to ensure that - MongoDB will effectively use space on disk. + .. collflag:: usePowerOf2Sizes + + The :collflag:`usePowerOf2Sizes` flag changes the method that + MongoDB uses to allocate space on disk for documents in this + collection. By setting :collflag:`usePowerOf2Sizes`, you ensure + that MongoDB will allocates space for documents in sizes that + are powers of 2 (e.g. 4, 8, 16, 32, 64, 128, 512...) With this + option MongoDB will be able to more effectively reuse space. + + :collflag:`usePowerOf2Sizes` is useful for collection where you + will be inserting and deleting large numbers of documents to + ensure that MongoDB will effectively use space on disk. Administration ~~~~~~~~~~~~~~ diff --git a/source/reference/glossary.txt b/source/reference/glossary.txt index d76141fc8e0..fc0849e8d31 100644 --- a/source/reference/glossary.txt +++ b/source/reference/glossary.txt @@ -784,8 +784,7 @@ Glossary belong to a namespace. replica pairs - The precursor to the MongoDB :term:`replica sets `. + The precursor to the MongoDB :term:`replica sets `. .. deprecated:: 1.6 @@ -818,3 +817,13 @@ Glossary Geohash A value is a binary representation of the location on a coordinate grid. + + powerOf2Sizes + A per-:term:`collection` setting that changes and normalizes the + way that MongoDB allocates space for each :term:`document` in an + effort to maximize storage reuse reduce fragmentation. This is + the default for :doc:`TTL Collections `. + See :dbcommand:`collMod` and :collflag:`usePowerOf2Sizes` for + more information. + + .. versionadded:: 2.2 diff --git a/source/tutorial/expire-data.txt b/source/tutorial/expire-data.txt index 5231c17fcb9..8146d8ce982 100644 --- a/source/tutorial/expire-data.txt +++ b/source/tutorial/expire-data.txt @@ -26,7 +26,9 @@ from the collection. You can use this feature to expire data from Use the ``expireAfterSeconds`` option to the :func:`ensureIndex ` method in conjunction with a TTL value -in seconds to create an expiring collection. +in seconds to create an expiring collection. Additionally, TTL +collections have the collection flag :collflag:`usePowerOf2Sizes` set +to support more efficient storage reuse. Constraints -----------