Skip to content

DOCS-771 document config.changelog collection #495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 20, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions source/core/sharding-internals.txt
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ In general, you should *never* manipulate the content of the config
database directly. The ``config`` database contains the following
collections:

- :data:`changelog`
- :data:`chunks`
- :data:`collections`
- :data:`databases`
Expand Down Expand Up @@ -592,14 +593,14 @@ When sharding a :term:`GridFS` store, consider the following:

db.fs.chunks.ensureIndex( { files_id : 1 , n : 1 } )

db.runCommand( { shardcollection : "test.fs.chunks" , key : { files_id : 1 , n : 1 } } )
db.runCommand( { shardCollection : "test.fs.chunks" , key : { files_id : 1 , n : 1 } } )

You may also want shard using just the ``file_id`` field, as in the
following operation:

.. code-block:: javascript

db.runCommand( { shardcollection : "test.fs.chunks" , key : { files_id : 1 } } )
db.runCommand( { shardCollection : "test.fs.chunks" , key : { files_id : 1 } } )

.. note::

Expand Down
97 changes: 96 additions & 1 deletion source/reference/config-database.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,101 @@ Collections
.. if we add a collection to the config database here, also update the
list on the sharding-internals page.

.. data:: changelog

The :data:`changelog` collection stores a document for each change to
the metadata of a sharded collection.

Each document contains the following fields:

.. data:: changeID

hostname-time-increment

.. data:: server

hostname

.. data:: clientAddr

hostname:port of client causing change

.. data:: time

time change occurred

.. data:: what

Type of change:

* dropCollection
* dropCollection.start
* dropDatabase
* dropDatabase.start
* moveChunk.start
* moveChunk.commit
* split
* multi-split

.. data:: ns

Namespace change affected.

.. data:: details

A BSON document of additional details, the contents vary
depending on the type of the change.


.. example::

The following example displays a single record of a chunk split
from a ``config.changelog`` collection:

.. code-block:: javascript

{
"_id" : "d.local-2012-12-11T14:09:21-0",
"server" : "d.local",
"clientAddr" : "127.0.0.1:63381",
"time" : ISODate("2012-12-11T14:09:21.039Z"),
"what" : "split",
"ns" : "snps.elegans",
"details" : {
"before" : {
"min" : {
"snp" : { $minKey : 1 }
},
"max" : {
"snp" : { $maxKey : 1 }
},
"lastmod" : Timestamp(1000, 0),
"lastmodEpoch" : ObjectId("000000000000000000000000")
},
"left" : {
"min" : {
"snp" : { $minKey : 1 }
},
"max" : {
"snp" : "haw54524"
},
"lastmod" : Timestamp(1000, 1),
"lastmodEpoch" : ObjectId("50c73e0bca6554d8d3b19a83")
},
"right" : {
"min" : {
"snp" : "haw54524"
},
"max" : {
"snp" : { $maxKey : 1 }
},
"lastmod" : Timestamp(1000, 2),
"lastmodEpoch" : ObjectId("50c73e0bca6554d8d3b19a83")
}
}
}


.. data:: chunks

The :data:`chunks` collection stores a document for each chunk in
Expand Down Expand Up @@ -187,7 +282,7 @@ Collections
mongos> db.getCollection("version").find()
{ "_id" : 1, "version" : 3 }

.. note::
.. note::

Like all databases in MongoDB, the ``config`` database contains a
:data:`system.indexes` collection contains metadata for all indexes
Expand Down