Compare commits

...

425 Commits
master ... v2.4

Author SHA1 Message Date
Ernie Hershey
d71410cd19 post 2.4.14 2015-04-29 19:53:06 -04:00
Ernie Hershey
05bebf9ab1 BUMP 2.4.14 2015-04-27 12:18:57 -04:00
Ernie Hershey
5ffe7efe63 post 2.4.14-rc0 2015-04-21 19:15:22 -04:00
Ramon Fernandez
9ab75c6005 BUMP 2.4.14-rc0 2015-04-20 13:38:19 -04:00
Spencer Jackson
a2249c005f SERVER-17647 Compute BinData length 2015-04-08 11:15:03 -04:00
Mark Benvenuto
22251f7783 SERVER-17252: 8.36 SCons Integration - 2.6 compatibility
(cherry picked from commit 62c7c34909)
2015-03-05 16:15:28 -05:00
Mark Benvenuto
7805c5042c SERVER-17252: PCRE 8.36 SCons Integration
(cherry picked from commit 69db0b4028)
(cherry picked from commit 525f13d490)
2015-03-05 16:15:28 -05:00
Mark Benvenuto
88f8524ed4 SERVER-17252: PCRE 8.36 SCons Integration
(cherry picked from commit b3085ab4f6)
(cherry picked from commit 4eb56a194b)
2015-03-05 16:15:28 -05:00
Mark Benvenuto
e8a768d0f4 SERVER-17252: CVE-2014-8964: Fix zero-repeat assertion condition bug.
(cherry picked from commit 558a019e51)
(cherry picked from commit 060ec05e9a)
2015-03-05 16:15:28 -05:00
Mark Benvenuto
32dbdb01ca SERVER-17252: PPCRE 8.36
(cherry picked from commit 21ab861eff)
(cherry picked from commit 551728cbb5)
2015-03-05 16:15:27 -05:00
Ernie Hershey
dd44995239 post 2.4.13 2015-02-25 15:56:17 -05:00
Ramon Fernandez
de9d77996a BUMP 2.4.13 2015-02-24 15:26:56 -05:00
Ernie Hershey
4f77548efb post 2.4.13-rc0 2015-02-19 18:09:20 -05:00
Ernie Hershey
821ee5672b BUMP 2.4.13-rc0 2015-02-18 16:43:18 -05:00
Spencer Jackson
04c33a8e1f SERVER-17278: Enforce BSON BinData length
(cherry picked from commit 8ef2743189)

Conflicts:
	src/mongo/bson/bson_validate.cpp
2015-02-17 13:42:19 -05:00
Eliot Horowitz
3a7e85ea1f SERVER-17264: improve bson validation for utf-8 strings
(cherry picked from commit 394a8569ff)

Conflicts:
	src/mongo/bson/bson_validate_test.cpp
2015-02-17 13:39:51 -05:00
Dan Pasette
656f787116 SERVER-15673 fix typo in backport 2014-10-27 23:49:33 -04:00
Dan Pasette
8b92428375 SERVER-15673 Disable SSLv3 ciphers (CVE-2014-3566 "POODLE")
(cherry picked from commit 035b5a90f5)
2014-10-27 22:45:56 -04:00
Ernie Hershey
6c0fccd460 post 2.4.12 2014-10-16 13:43:04 -04:00
Ernie Hershey
09917767b1 BUMP 2.4.12 2014-10-14 16:40:29 -04:00
Ernie Hershey
ce8b305859 post 2.4.12-rc0 2014-10-08 09:26:38 -04:00
Ernie Hershey
a2f5d8bd3c BUMP 2.4.12-rc0 2014-10-07 12:05:41 -04:00
Randolph Tan
c62f9b697a SERVER-13616 "type 7" (OID) error when acquiring distributed lock for first time
(cherry picked from commit 6254a575a9)
2014-10-06 18:28:47 -04:00
Mathias Stearn
e96f29859a SERVER-15111 Treat corruption of final journal section as an expected event
Manual backport of the following commits (combined):
8e1f5beabf
6e93b33179
2014-10-06 12:06:53 -04:00
Dan Pasette
e4a5649bb5 SERVER-15369: Clean up partially created .ns files
(cherry picked from commit 243f11cd82)
2014-09-29 11:07:12 -04:00
Dan Pasette
66bfc5b6fb SERVER-15369 Explicitly write zeros when creating ns files
Backported from commit b39f5ccc3e
2014-09-25 18:16:07 -04:00
Randolph Tan
59dc05c0b6 SERVER-15056 Sharded connection cleanup on setup error can crash mongos
Collapse empty if body
(cherry picked from commit 87fa4e16af)
2014-09-08 14:09:41 -04:00
Randolph Tan
d5a8cfd7bd SERVER-15056 Sharded connection cleanup on setup error can crash mongos
(cherry picked from commit 18dba6ed5b)
2014-09-08 14:09:24 -04:00
Kamran Khan
c344f31ae5 SERVER-14738 Use language names instead of ISO codes in FTS tests
Closes #752

Signed-off-by: Benety Goh <benety@mongodb.com>
2014-08-22 13:50:22 -04:00
Ernie Hershey
5806dba8e1 post 2.4.11 2014-08-22 11:05:43 -04:00
Ernie Hershey
fa13d1ee8d BUMP 2.4.11 2014-08-21 17:56:32 -04:00
Ernie Hershey
7305c85989 Revert "SERVER-13616 "type 7" (OID) error when acquiring distributed lock for first time"
This reverts commit 50c95dfc9d.
2014-08-21 17:55:17 -04:00
Randolph Tan
50c95dfc9d SERVER-13616 "type 7" (OID) error when acquiring distributed lock for first time
(cherry picked from commit 6254a575a9)
2014-08-20 13:56:58 -04:00
Ernie Hershey
953cd5f652 post 2.4.11-rc0 2014-08-18 16:00:20 -04:00
Ernie Hershey
5b84ff5201 BUMP 2.4.11-rc0 2014-08-15 11:45:22 -04:00
Mark Benvenuto
cefb0ef38f SERVER-14268: Backport from 2.6 to 2.4 - disable test 2014-08-14 17:33:12 -04:00
Mark Benvenuto
9105b69e1d SERVER-14268: Backport from 2.6 to 2.4 2014-08-14 16:28:12 -04:00
Jason Rassi
bd14042812 SERVER-14833 fts_index3.js build correct index, minor comment fixes 2014-08-13 19:23:55 -04:00
Eric Milkie
91e1ec1442 SERVER-12209 _id prohibitions
Prohibit _id of type Array or Undefined.
Also, if _id is an Object, recursively check the object for $fieldnames.
2014-08-12 13:23:31 -04:00
Jason Rassi
89d34fd3eb SERVER-14833 Fix issue where 98eb2f1d broke text index spec rewrite 2014-08-12 11:45:57 -04:00
Jason Rassi
98eb2f1dd5 SERVER-14833 {_id:-1} index builds should no-op if _id index exists 2014-08-11 12:47:18 -04:00
Alexis Midon
aaa8a1d71e SERVER-9252 use the correct config key for pid file
(cherry picked from commit 5b762d52cc)
Signed-off-by: Ernie Hershey <ernie.hershey@10gen.com>
2014-08-07 18:14:25 -04:00
Jason Rassi
3e570fc232 SERVER-14738 Correctly determine if update w/ text index is in-place
(backport of 1f00ffcd22)
2014-08-07 17:39:57 -04:00
Benety Goh
1fbb52159e SERVER-14254 convert _v8_function from function pointer to boolean
(cherry picked from commit e48abc5bee)
2014-07-22 16:30:21 -04:00
Randolph Tan
4ad6d96e91 SERVER-14342 Invalid access: seg fault in SplitChunkCommand::run 2014-07-16 17:25:32 -04:00
Ernie Hershey
899d16e9c6 SERVER-13724 Add --disable-warnings-as-errors scons option
This change was prompted by attempts to build 2.6.0 in SLES 10 with
its system gcc version 4.1.2. It builds fine other than a sole
warning - src/third_party/boost/boost/thread/detail/thread.hpp:316:
warning: type attributes are honored only at type definition. It
should also help in cases where compilers are too new.
(cherry picked from commit 27c128d303)

Conflicts:

	SConstruct
2014-05-08 15:43:08 -04:00
Ernie Hershey
d218cd5a78 post 2.4.10 2014-04-04 15:38:34 -04:00
Ernie Hershey
e3d78955d1 BUMP 2.4.10 2014-04-02 08:23:31 -04:00
Randolph Tan
0e1908763a SERVER-13376 Make sync7.js less sensitive to delays
(cherry picked from commit 06c40ab0bb)
2014-03-27 13:51:35 -04:00
Ernie Hershey
e8d714a747 post 2.4.10-rc0 2014-03-26 18:09:33 -04:00
Ernie Hershey
6c3b955644 BUMP 2.4.10-rc0 2014-03-25 18:07:08 -04:00
Tyler Brock
0080fdc3fe SERVER-13331 lower GridFS default chunk size to 255k
(cherry picked from commit 632ae4e7ad)
2014-03-24 19:04:25 -04:00
Randolph Tan
7e8aaa3a48 SERVER-13333 Add more info when movePrimary fails in prefix_shard_key.js 2014-03-24 16:58:59 -04:00
Eric Milkie
67aadff82d improve replset_remove_node.js
(cherry picked from commit 38ba557b50)
2014-03-21 06:17:18 -04:00
Mathias Stearn
b2c3b08b75 Remove unnecessary and broken portion of test
Fixes SERVER-10153

(cherry picked from commit 85cc36126c)
2014-03-20 12:24:05 -04:00
Greg Studer
d949d2f1c3 SERVER-12548 add indexes to distlock collections backport 2014-03-20 14:48:42 -04:00
Eric Milkie
9671206430 SERVER-13249 adjust timeout for reInitiate
Since there is a 15 second polling delay when there are no visible primary/secondary nodes,
reInitiate was coming close to timing out in many cases.
(cherry picked from commit 4a299302a7)
2014-03-19 15:31:11 -04:00
Eric Milkie
4469ab13e2 SERVER-13249 fix where we set timeout for slow builders
awaitSecondaries is already called by reInitiate()
(cherry picked from commit eabded8aa6)
2014-03-19 10:01:29 -04:00
Eric Milkie
b8ca63ffd2 SERVER-13249 double timeout for more reliability
(cherry picked from commit c2eeebe5c1)
2014-03-18 08:56:00 -04:00
Dan Pasette
be2d871df6 Revert "SERVER-13033: Fix bad static initializer"
This reverts commit c991426e46.
2014-03-17 20:15:56 -04:00
Mark Benvenuto
c991426e46 SERVER-13033: Fix bad static initializer
(cherry picked from commit f0b367f3e0)
2014-03-17 18:56:57 -04:00
Spencer T Brody
1ac617e145 Increase timeout of replSetReconfig to leave time for initial sync in two_initsync.js test
(cherry picked from commit 298470d138)
2014-03-17 17:33:26 -04:00
Spencer T Brody
c7fc38edc3 Increase benchRun time to improve reliability of bench_test3.js
(cherry picked from commit 689e23eace)
2014-03-17 17:30:06 -04:00
Matt Dannenberg
d4ef06166f update and repair replsets.slavedelay1.js 2014-03-15 15:21:28 -04:00
Eliot Horowitz
317cb98a19 SERVER-12662: fix index name creation 2014-03-14 10:53:33 -04:00
Eliot Horowitz
fce1d8d093 SERVEr-12990: interrupted index after interim succesful index kills correct index 2014-03-14 09:32:48 -04:00
Eliot Horowitz
55a6a0d284 SERVER-12956: on startup, remove half built indexes 2014-03-14 09:32:48 -04:00
Eliot Horowitz
8dd9cf06d7 SERVER-12662: Two background index builds in parallel with unique key constraint violations crashes secondary 2014-03-14 09:32:48 -04:00
Randolph Tan
1ceeb84bd0 SERVER-12515 Unable to move hashed shard key chunks created by numInitialChunks
Backport fix for commit 3a08be3bf2
2014-03-11 15:27:50 -04:00
Dan Pasette
b9fa2dac50 SERVER-12697 comment out compact.js 2014-03-10 14:06:23 -04:00
Greg Studer
14e868877c SERVER-12908 don't aggressively retry when config inconsistency detected in balancer 2014-03-09 19:28:26 -04:00
matt dannenberg
435f6118c5 SERVER-12264 prevent from tryToGoLiveAsSecondary() from waiting on global writelock during compact 2014-03-09 19:28:26 -04:00
Dan Pasette
67c47db36f SERVER-9248 Fix up try/catch block 2014-03-09 19:25:03 -04:00
Matt Dannenberg
df5a9d90eb SERVER-12170 stop calling relinquish() when replicaset nodes decide not to veto an election 2014-03-09 11:27:35 -04:00
Mathias Stearn
ac5d61ca61 SERVER-12132 Stop using stringstream in Value::coerceToString()
This speeds up the function by two changes:
1) Using StringBuilder (through str::stream) rather than stringstream.
2) Not constructing a StringBuilder or stringstream when not needed.

At least with libstdc++, constructing and destructing a stringstream is
extremely expensive.
2014-03-09 11:27:35 -04:00
Charlie Page
a7d9059a07 SERVER-12034 Fix bug with SIGXCPU causing a core dump in mongoD/mongoS.
Graceful shutdown was chosen so we can log the signal; There is no risk
of data corruption.

Signed-off-by: Matt Kangas <matt.kangas@mongodb.com>
2014-03-09 11:27:35 -04:00
Mathias Stearn
2c62563720 SERVER-11871 Fix assert in Page::Initialize.
This is a clean backport from this commit from V8:
https://code.google.com/p/v8/source/detail?r=13896
2014-03-09 11:27:35 -04:00
Shaun Verch
4c16a61826 SERVER-11560 Close file handle in shell util 2014-03-09 11:27:35 -04:00
Eric Milkie
a29de43de7 SERVER-10793 always step down when another primary is seen 2014-03-09 11:27:35 -04:00
matt dannenberg
73695a99c1 SERVER-10231 disallow creation of indexes on system.indexes
Conflicts:
	src/mongo/db/index.cpp
	src/mongo/db/namespacestring.h
2014-03-09 11:27:35 -04:00
Randolph Tan
fcabc21a3e SERVER-9259 Don't move chunks for non-empty hashed collection during shardCollection cmd 2014-03-09 11:27:35 -04:00
Dan Pasette
989ed9711e SERVER-9248 Ignore errors when checking readahead
To test, run sudo chmod o-x /sys/dev/block
Manual backport of commit 9501c1bfce
2014-03-09 11:27:35 -04:00
Kaloian Manassiev
c7436cd7fc Do not zero-fill newly allocated files on Windows
On Windows platforms code was added to zero-fill each newly allocated data file in order to work around Windows KB http://support.microsoft.com/kb/2731284. The KB only applies for Windows 7 and Windows 2008 Server installations, so there is no need to do it on each and every system.

This fix restricts the zeroing-out code to only versions, which have had the bug. It will not check whether the hot fix has been installed.
2014-03-09 11:27:35 -04:00
Dan Pasette
801d87f5c8 SERVER-8375 sync from primary on clock skew
Manual backport of git commit ebd13ab35a
2014-03-09 11:27:35 -04:00
Jason Rassi
ae451ca13f SERVER-12914 initAndListen call dbexit if invalid IndexSpec found 2014-03-07 13:20:40 -05:00
Jason Rassi
7736ee885b SERVER-12175 Reject 2dsphere idxs w/o supported 2dsphereIndexVersion
Refuse to use/build if 2dsphereIndexVersion index option is set and
has any value other than 1.
2014-02-15 14:50:12 -05:00
Eric Milkie
a003add92d Revert "SERVER-12662 do not logOp inserts that have no associated diskloc (such as index-already-exists)"
This reverts commit 2f3bd6fc8f.
The commit does not work for _id index builds and will require a more comprehensive solution.
2014-02-13 09:10:48 -05:00
Eric Milkie
2f3bd6fc8f SERVER-12662 do not logOp inserts that have no associated diskloc (such as index-already-exists) 2014-02-12 17:28:05 -05:00
Andrew Morrow
b0971060b1 Revert "SERVER-12272 Suppress new GCC 4.8 warning about unused local typedefs"
This reverts commit 7fa028e8fa.

Older GCC doesn't silently ignore attempts to disable warnings it doesn't
know about, so -Wno-unused-local-typedefs breaks the build.
2014-02-04 12:29:54 -05:00
Eric Milkie
419bc91c2c SERVER-12481 fix off-by-one error with IndexBuildsInProgress::remove 2014-02-04 08:33:05 -05:00
Andrew Morrow
7fa028e8fa SERVER-12272 Suppress new GCC 4.8 warning about unused local typedefs 2014-02-03 13:07:41 -05:00
Ernie Hershey
74698f5f56 post 2.4.9 2014-01-10 16:24:11 -05:00
Ernie Hershey
52fe0d2195 BUMP 2.4.9 2014-01-08 18:31:24 -05:00
Dan Pasette
3e3734c569 post 2.4.9-rc0 2013-12-23 13:09:41 -05:00
Dan Pasette
c05e2c52dc BUMP 2.4.9-rc0 2013-12-22 19:21:28 -05:00
Jason Rassi
0559d8970d SERVER-11494 Reduce fragility of TextIndexVersionCheck1 test
Constructing FTSSpec from invalid object doesn't (by contract) have
to throw derived UserException.  Changed test to catch DBException.
2013-12-22 17:12:36 -05:00
Jason Rassi
859858cc61 SERVER-11494 Run text index version check at time of text index use 2013-12-21 19:29:46 -05:00
Dan Pasette
a8481e8f75 SERVER-11194 fix log message 2013-12-21 18:28:41 -05:00
Dan Pasette
bd3553dff9 SERVER-12146 do not check writebacks if calling gle from wbl 2013-12-21 09:30:26 -05:00
Greg Studer
e5dd557257 SERVER-12041 improve retry logic for read preferences without slaveOk set 2013-12-20 09:41:41 -05:00
Jason Rassi
dc1e3b1a0c SERVER-12092 Fix mongorestore warning that collection options changed
Variable "obj" being shadowed by declaration in containing scope.

Conflicts:

	src/mongo/tools/restore.cpp
2013-12-19 21:21:05 -05:00
Jason Rassi
815bb1efe0 SERVER-12092 mongorestore should generate valid "create" command obj
Fixes an issue where fields in the "create" command object generated
by mongorestore could be out of order, such that an invalid command
would be run instead of "create".

Conflicts:

	src/mongo/tools/restore.cpp
2013-12-19 21:16:42 -05:00
Mathias Stearn
9ceadd4ece SERVER-9238 Don't set a timeout in shell autocomplete
In V8, timeouts are fatal so the shell would become unusable if the
timeout fired. Since the timeout didn't cause remote calls to return
early (which is the most common cause of slow autocomplete), this didn't
actually do anything useful anyway.
2013-12-19 20:37:12 -05:00
Randolph Tan
37f8eaa898 SERVER-10919 logging in ~ReplicaSetsMonitor crashes 2013-12-19 20:36:50 -05:00
matt dannenberg
294234af4e SERVER-11194 ignore non-numeric expiresAfterSeconds on TTL indexes 2013-12-19 20:35:55 -05:00
Eliot Horowitz
8bc5cef78b SERVER-11908: let rollback handle collmod 2013-12-19 20:26:20 -05:00
Shaun Verch
0e883bd5f3 SERVER-12094 Do not strip false setParameter options from config file 2013-12-17 12:19:25 -05:00
matt dannenberg
77a74780a0 SERVER-10538 SERVER-11731 change segfault to uassert on improper use of $where 2013-12-09 11:30:29 -05:00
Greg Studer
e7f4f01001 SERVER-11869 support for external gle opTime for w > 1 2013-12-08 13:36:48 -05:00
Greg Studer
9a1b20453b SERVER-11971 slaveok versioning logic should also apply to read prefs 2013-12-06 16:59:18 -05:00
Greg Studer
b113ec11a0 SERVER-7246 rename internal dbclient_rs auth helper 2013-12-04 14:11:47 -05:00
Greg Studer
3d8faaadab SERVER-7246 external user authentication should use primary preferred read pref 2013-12-04 14:10:00 -05:00
Andrew Morrow
77dc6ecf84 SERVER-11099 Partial cherry-pick from upstream v8 to fix UB related mongo shell crash
This is a backport of the portion of https://github.com/v8/v8/commit/b3775cf3
relevant to our vendored version of v8. Please see that commit for more
details on the nature of the undefined behavior and how this change fixes it.

This will repair the issue with the mongo shell crashing on shutdown
when compiled with clang-3.3 or newer.

(cherry picked from commit 670c981819)
2013-12-02 10:15:00 -05:00
Greg Studer
45662915c2 SERVER-5625 SERVER-7426 allow all connections in all states to tolerate downed shards and primaries 2013-12-01 21:29:10 -05:00
Greg Studer
38b3b8f739 SERVER-5625 don't throw on problem setting shard version on initial connect 2013-11-20 13:37:44 -05:00
Andreas Nilsson
5779b6e198 SERVER-11502 Moved OpenSSL multithreading callbacks 2013-11-06 14:22:37 -05:00
Ernie Hershey
d193e03b72 post 2.4.8 2013-11-01 15:02:33 -04:00
Dan Pasette
a350fc3892 BUMP 2.4.8 2013-10-31 10:15:50 -04:00
Dan Pasette
c87c736003 BUMP 2.4.8-rc0 2013-10-30 18:05:42 -04:00
Dan Pasette
ed7af1195c SERVER-11421: make applyOps call logOpForDbHash 2013-10-30 17:14:22 -04:00
Dan Pasette
94a9026ed0 SERVER-11478 Make admin.system.version, admin.system.roles,
admin.system.new_users and admin.system.backup_users writable
to facilitate downgrade path from 2.6
2013-10-30 16:54:23 -04:00
Ernie Hershey
6c2e2de0c3 SERVER-11006 Change enterprise package dependency from gsasl to cyrus-sasl 2013-10-22 22:50:33 -04:00
Ernie Hershey
99679e8879 Revert 2.5 changes in packaging script 2013-10-22 22:50:19 -04:00
Dan Pasette
8997835c05 post 2.4.7 2013-10-20 21:44:27 -04:00
Dan Pasette
0161738abf BUMP 2.4.7 2013-10-17 14:37:56 -04:00
Dan Pasette
93048bad21 post 2.4.7-rc0 2013-10-09 14:32:57 -04:00
Dan Pasette
078285ab6e BUMP 2.4.7-rc0 2013-10-08 13:53:24 -04:00
Mathias Stearn
caa1f8ec26 Extra debugging for jstests/dropdb.js
Failure case: SERVER-10184
2013-10-07 17:44:52 -04:00
Dan Pasette
79b6a2e256 SERVER-7692 RPM and Deb package for Subscriber Edition 2013-10-07 17:39:07 -04:00
Ian Whalen
874b42c4a7 SERVER-11021 skip dbhash2.js during sharding_passthrough 2013-10-06 18:36:10 -04:00
Scott Hernandez
c53182403a SERVER-11032: Do not veto if primary is the node trying to be elected 2013-10-04 11:58:54 -04:00
Eliot Horowitz
577fe667c6 SERVER-11021: backport to 2.4 2013-10-04 07:52:01 -04:00
Dan Pasette
92f7c00614 SERVER-10655: pass query options to the aggregation command on mongos 2013-10-03 14:44:06 -04:00
Randolph Tan
aab2a11c76 SERVER-10655 aggregation_auth : mongos_slaveok.js failing
Improve test.
2013-10-03 14:44:06 -04:00
Dan Pasette
22252fdaa6 SERVER-10594 slaveOk bit ignored for unsharded aggregate
Backport of original commit: 84ff1694c4
2013-10-03 14:44:06 -04:00
Matt Kangas
9c032a641b SERVER-10462 compensate for Windows file locking race 2013-10-02 19:47:14 -04:00
Dan Pasette
33865cba58 SERVER-10285 uassert that s2latlng is valid, print out if it's not
Backport original commit: ce6607fd28
2013-10-02 19:45:14 -04:00
matt dannenberg
bd96977507 SERVER-9109 continue rather than return on ECONNABORTED and EBADF 2013-10-02 17:44:01 -04:00
Kyle Erf
bd4653ca22 SERVER-9501: initial sync exception: 10083 Changed validation to allow explicit creation of size 0 collections. Should be backported to 2.4.X
Signed-off-by: Matt Kangas <matt.kangas@10gen.com>
2013-10-02 16:40:18 -04:00
Shaun Verch
6c0b71b384 SERVER-9993 Accept any numeric type for the maxSize field in config.shards 2013-10-02 16:37:49 -04:00
Greg Studer
7621e8ac60 SERVER-10421 buildbot use unique coll names for geo_circle2a.js and eval2.js 2013-10-02 16:36:52 -04:00
Greg Studer
8d082558e9 SERVER-9861 explicitly forget temporary collections for versioning in M/R 2013-10-02 16:06:55 -04:00
Ernie Hershey
4a34704bfa SERVER-6008 move '--' out of DAEMON_OPTS rvalue 2013-10-02 16:05:27 -04:00
Aricg
95342c1fb4 SERVER-6008 put the logic for DAEMON_OPTS= and -- into the "if which numactl"
I hope this is correct, I have signed the contributor's agreement.

Signed-off-by: Ernie Hershey <ernie.hershey@10gen.com>
2013-10-02 16:05:09 -04:00
Randolph Tan
2711fa56d8 SERVER-9907 Allow to skip initial count() in mapreduce
Do not count total documents to process if filter is given.
2013-10-02 15:15:59 -04:00
Randolph Tan
eb13f30cec SERVER-9907 Allow to skip initial count() in mapreduce
Added option to hide the total in the progress meter.

Conflicts:
	src/mongo/util/progress_meter.cpp
2013-10-02 15:14:26 -04:00
Randolph Tan
3803f6424a SERVER-9738 mongos should set the CursorNotFound bit when the cursor is not found
Lower invalid cursor log level from 6 to 3.
2013-10-02 14:58:23 -04:00
Randolph Tan
80adf5e690 SERVER-9738 mongos should set the CursorNotFound bit when the cursor is not found 2013-10-02 14:58:07 -04:00
Eric Milkie
9976d1d8e9 SERVER-10261 disable ssl session caching (affects java driver) 2013-09-26 13:19:40 -04:00
matt dannenberg
69a76cca7e SERVER-10724 better exception handling in health poll 2013-09-10 18:17:10 -04:00
Mathias Stearn
5f724c0161 SERVER-10596 Globalize formerly per-thread Pool of JS Scopes
This ensures that the limit of 10 pooled scopes is actually enforced.
With a per-thread Pool, long-lived connections could cause very high
memory usage (both real and virtual) even if they haven't used JS in a
long time.

Manually fixed backport of commit 73841f7a1e

Conflicts:
	jstests/auth/js_scope_leak.js
	src/mongo/db/auth/auth_external_state.h
	src/mongo/db/auth/auth_external_state_d.cpp
	src/mongo/db/auth/auth_external_state_d.h
	src/mongo/db/auth/auth_external_state_s.cpp
	src/mongo/db/auth/auth_external_state_s.h
	src/mongo/db/auth/authorization_session.cpp
	src/mongo/db/auth/authorization_session.h
	src/mongo/db/commands/group.cpp
	src/mongo/db/matcher/expression_where.cpp
	src/mongo/scripting/engine.cpp
2013-08-27 12:01:45 -04:00
Mathias Stearn
26f638873e Add check to prevent future memory leaks like SERVER-10554 2013-08-23 16:37:29 -04:00
Mathias Stearn
cc9361ee7e SERVER-10554 Patch memory leak in aggregation
The issue was that empty documents are represented as a NULL pointer and
Value didn't ref count NULL pointers. This is fine for all public
interactions with Value, however MutableDocument can change the pointer
in-place when updating a nested field. This caused a leak when it
transitioned a Value from holding a non-refcounted NULL pointer to
holding a real pointer since MutableDocument/MutableValue didn't set the
refCount bit.
2013-08-23 16:37:02 -04:00
Ernie Hershey
f7505b61c5 post 2.4.6 2013-08-20 16:03:58 -04:00
Dan Pasette
b9925db5ea BUMP 2.4.6 2013-08-18 14:24:57 -04:00
Ernie Hershey
b756166c99 post 2.4.6-rc1 2013-08-12 17:48:07 -04:00
Matt Kangas
5dfa2980fc BUMP 2.4.6-rc1 2013-08-10 21:48:19 -04:00
Greg Studer
4d957329dc SERVER-10458 sanity check before critical section that all cloned docs sent 2013-08-09 16:09:17 -05:00
Greg Studer
484fc23465 SERVER-10478 fix batch limit check for _cloneLocs in migration 2013-08-09 15:32:44 -05:00
Ernie Hershey
7cf37eb6d4 post 2.4.6-rc0 2013-08-09 15:26:23 -04:00
Ernie Hershey
b8c0af00dd missing semicolon 2013-08-08 13:14:38 -04:00
Ernie Hershey
52d6125af8 BUMP 2.4.6-rc0 2013-08-08 12:29:44 -04:00
Eric Milkie
72009e81f2 SERVER-10429 disable flaky test until we can fix it properly 2013-08-07 15:30:52 -04:00
Eric Milkie
75d9c31c5c SERVER-10437 remove chaining.js test
It is testing functionality that has been deprecated by the new sync source updater.
Also, tags.js covers testing chaining with network failures, so there is no further
need for this test.  chaining.js is racy with respect to the way it activates a
failpoint in the socket class, which was causing the test to fail sometimes.
2013-08-07 15:30:52 -04:00
Greg Studer
3fc69c4aaa SERVER-10120 remove2.js buildbot timeout too aggressive 2013-08-05 14:40:09 -05:00
Tad Marshall
392b933598 SERVER-8707 Sleep 10 seconds before entering ReplicaSetMonitorWatcher's loop
This restores the startup timing that was changed by commit
e3b8349ec3, while preserving the
smaller time window within the loop between checking for
termination and calling ReplicaSetMonitor::checkAll().
2013-08-04 17:48:55 -04:00
Greg Studer
268d3f6656 SERVER-10137 sort1.js can't use sh.stopBalancer without a db 2013-08-02 13:47:58 -04:00
Greg Studer
dd0be59518 SERVER-10135 sort1.js turn off balancer for manual chunk moves 2013-08-02 13:40:31 -04:00
Eric Milkie
b89e706fac SERVER-9934 remove double getmore when pulling new ops
This reduces the potential delay in ending the bgsync thread from 10 seconds
to 5 seconds.  This is important because assumingPrimaryness waits on this loop
before changing state to PRIMARY after an election.
To reduce the delay lower than 5 seconds requires further redesign of the code.
2013-08-02 11:30:07 -04:00
Greg Studer
49109a0622 SERVER-9714 buildbot auto2.js don't run connpoolsync before gle 2013-08-02 11:10:51 -04:00
Greg Studer
80f1630fc9 SERVER-9913 protect ScopedDbConn constructor in migrate critical section 2013-08-02 11:07:32 -04:00
Greg Studer
bae49ad621 SERVER-8899 read-lock while updating ShardChunkManager in trySetVersion() 2013-08-02 11:07:32 -04:00
Greg Studer
4439f7ac67 SERVER-10007 compile fail, toString() needed for str::stream() 2013-08-02 11:07:32 -04:00
Greg Studer
2c0ae78a0e SERVER-10007 better logging for dbclient_rs.cpp 2013-08-02 11:07:32 -04:00
Tad Marshall
1de7cd5518 SERVER-8707 Stop the ReplicaSetMonitorWatcher loop on process termination
Use StaticObserver to end ReplicaSetMonitorWatcher's loop when a program
using the C++ driver exits.  Move the sleep to the bottom of the loop to
reduce the window between checking for termination and the call to
ReplicaSetMonitor::checkAll().
2013-08-02 10:03:22 -04:00
Tad Marshall
d0f73fae4d SERVER-10015 Visual Studio -- add s/config_server_checker_service.{cpp,h} 2013-08-02 07:14:25 -04:00
Randolph Tan
fa40f42573 SERVER-7728 Add more details on why a shard is 'unavailable' for balancing 2013-08-01 23:53:56 -04:00
Matt Dannenberg
2c332a62c9 SERVER-9481 further rollback exception cleanup 2013-08-01 23:43:44 -04:00
Andreas Heck
e1656eda9f SERVER-9481 Fixes fluctuating between ROLLBACK and SECONDARY when ROLLBACK is impossible
Only leave ROLLBACK when successful and go to FATAL when ROLLBACK is impossible
because we are not willing to rollback so much data

Signed-off-by: Matt Dannenberg <matt.dannenberg@10gen.com>
2013-08-01 23:43:32 -04:00
Greg Studer
9a7944042c SERVER-9365 make forced halfway split work with chunks with many docs
Additional test fixes.
2013-08-01 21:04:02 -04:00
Dan Pasette
d502de0e89 SERVER-10362: call ClientCursor::staticYield to do a pthread_yield rather than sleepmicros. 2013-08-01 21:00:47 -04:00
Spencer T Brody
b699950eb4 SERVER-10211 Give stepdown.js more time for the primary to be elected after a reconfig 2013-08-01 20:42:45 -04:00
Eliot Horowitz
12ecb7dbc7 SERVER-10362: only use pthread_yield on linux, on osx use sleepmicros(1) 2013-08-01 20:41:58 -04:00
Eliot Horowitz
6d738db1f4 SERVER-10362: add option to ClientCursor::staticYield to do a pthread_yield instead of sleepmicros
this is mostly because of some platforms (like xen) where sleepmicros is too inaccurate
2013-08-01 20:39:49 -04:00
Scott Hernandez
50dace31f8 SERVER-10313: uassert number conflict fix 2013-08-01 20:39:26 -04:00
Scott Hernandez
0156435f4a SERVER-10313: uassert if null char in js field names 2013-08-01 20:39:14 -04:00
Eric Milkie
30300a9c02 SERVER-10103 avoid hitting socket exception in the shell 2013-08-01 20:38:39 -04:00
Eric Milkie
9a09884807 SERVER-10103 add debugging output 2013-08-01 20:38:29 -04:00
Randolph Tan
92fef8d6ef SERVER-10015 balancer should stop when ConfigServerCheck indicates inconsistency
Conflicts:
	src/mongo/s/server.cpp
2013-08-01 20:36:34 -04:00
Eliot Horowitz
e0ae2fd180 SERVER-9699: remove clean command
Conflicts:
	src/mongo/db/dbcommands_admin.cpp
2013-08-01 20:31:28 -04:00
Mathias Stearn
343e5c12c9 More readable SocketException::toString() 2013-08-01 19:00:40 -04:00
Andreas Nilsson
6e87ce7c6f SERVER-9808 Fix issues found in static code analysis 2013-07-31 16:57:04 -04:00
Spencer T Brody
a57449ba76 SERVER-10344 Skip repl/repl4.js because of race condition in master/slave 2013-07-31 16:47:04 -04:00
Dmitry Naumov
896ad48104 SERVER-9754 Remove FILE_FLAG_WRITE_THROUGH for journal files
Signed-off-by: Tad Marshall <tad@10gen.com>
2013-07-29 14:33:09 -04:00
Tad Marshall
47d1066c0b SERVER-8030 Add IPv6 version of jstest 2013-07-29 13:50:02 -04:00
Tad Marshall
031daa0532 SERVER-8030 Validate connection string in JavaScript connect() function
Validate that the "URL" passed to the connect() function matches one of the
accepted formats (host:port/database, host/database or database) before trying
to use it to connect to a server.  Change a uassert in HostAndPort::init() to
an massert to match the massert four lines above it.  Add jstest for connect()
validation.
2013-07-29 13:48:33 -04:00
Tad Marshall
ad46ea3318 SERVER-10359 Remove code page switching from Windows shell 2013-07-29 13:31:11 -04:00
Tad Marshall
ec902210eb SERVER-8926 Remove extra error text and 'L' line number prefix 2013-07-29 12:32:23 -04:00
Tad Marshall
551c30f006 SERVER-9636 Display version, not pointer value 2013-07-29 12:21:53 -04:00
Tad Marshall
0356d2623b SERVER-9894 Add license headers to stacktrace.{cpp,h} 2013-07-29 12:06:41 -04:00
Tad Marshall
07fd444dd6 SERVER-8891 Destroy static objects in a safer order
Change the order of some static objects and group them near the
start of the source file, along with a comment explaining what is
going on.  The crashes we've seen have been due to destructors for
ReplicaSetMonitors (triggered by the destruction of _sets) trying
to use the _seedServers map, which had been destroyed already.  By
changing the order of the object definitions, we destroy _sets
before destroying _seedServers, preventing the crash.

There may be other cases that are not solved by this fix, and there
is still a race due to the running ReplicaSetMonitorWatcher thread,
so this is unlikely to be the last word on crashes of this type.
2013-07-29 10:39:45 -04:00
Eric Milkie
7ea27bae26 SERVER-10261 end TCP sockets cleanly
This is a partial backport of SERVER-9041's commit.  In particular, this fixes an issue with
SSL and the Java driver's session caching.
2013-07-22 14:28:01 -04:00
Tad Marshall
0d74c378de SERVER-10259 Do not return pointer into temporary string
Convert the location found within the temporary string into the
equivalent (and correct) location in the source string.
2013-07-19 11:52:30 -04:00
Tad Marshall
2dcd03ab37 Visual Studio -- add new files 2013-07-18 18:05:54 -04:00
Tad Marshall
cfe110242f SERVER-8795 Revert "SERVER-8782 disable smalloplog geo_update_btree.js on Solaris"
This reverts commit cafb1081b8.

Fixing SERVER-8795 should make geo_update_btree.js not segfault.
2013-07-18 16:28:55 -04:00
Tad Marshall
636361bf46 SERVER-8795 Lock mongo files in remapPrivateView on Solaris
Prevent other threads from touching the memory of a memory-mapped file
while the file's private view is reset in remapPrivateView() on Solaris.
2013-07-18 16:27:35 -04:00
Andrew Morrow
3686654879 SERVER-7080 Add feature test for execinfo functions to repair build of client driver 2013-07-18 16:07:38 -04:00
Tad Marshall
990cb4be62 SERVER-7080 Emulate backtrace_symbols() and backtrace_symbols_fd() on Solaris 10
backtrace_symbols() returns a block of strings, each containing a
symbolic representation of a location in a stack trace; i.e. a line
of a stack trace.  backtrace_symbols() is allowed to (and must)
allocate memory and cannot be used in a signal handler.  Add code to
produce lines on Solaris 10 that are similar to those produced by
backtrace_symbols() on Solaris 11.

backtrace_symbols_fd() writes a stack trace to a specified file
descriptor.  backtrace_symbols_fd() must not allocate memory and may
be safely used in a signal handler.  Add code to produce output on
Solaris 10 that is similar to that produced by backtrace_symbols_fd()
on Solaris 11.
2013-07-18 14:54:44 -04:00
Tad Marshall
71082c54a4 SERVER-7080 Add code to emulate backtrace()
backtrace() fills a buffer provided by the caller with addresses
constituting a stack trace.  This emulation allows the display of
addresses in Solaris 10, which can be used with addr2line to see
code locations.
2013-07-18 14:45:33 -04:00
Tad Marshall
66f4a37277 SERVER-7080 Link to backtrace, backtrace_symbols and backtrace_symbols_fd at runtime
Do not make direct calls to backtrace, backtrace_symbols or backtrace_symbols_fd,
which are present in Solaris 11 but not in Solaris 10.  Instead, see if they are
available in a loaded library (which will be libc.so.1) at runtime and either
call them or call an emulation.
2013-07-18 14:29:19 -04:00
Tad Marshall
4d4790146b SERVER-7404 Link to posix_fadvise at runtime for Solaris
For the Solaris/SmartOS build, do not make direct calls to posix_fadvise,
which is present in Solaris 11 but not in Solaris 10.  Instead, see if
it is available in a loaded library (which will be libc.so.1) at runtime
and either call it or call an emulation.  The emulation is a no-op.
2013-07-18 13:33:07 -04:00
Tad Marshall
16fc6424eb SERVER-9325 Add blockCheckSupported and hostInfo support to Solaris/SmartOS
Implement a processinfo_*.cpp file for Solaris, providing support for
blockCheckSupported features and the the hostInfo command.  Rewrite the
readLineFromFile() function from processinfo_linux2.cpp and move it into
processinfo.cpp where it can be called for Solaris as well as Linux.
2013-07-18 12:10:25 -04:00
Tad Marshall
dec6751677 Visual Studio -- add MurmurHash3 to mongo shell (SpiderMonkey) 2013-07-18 05:55:29 -04:00
Tad Marshall
b1d2d93414 SERVER-9786 Visual Studio -- add strcasestr.{cpp,h} 2013-07-18 05:45:33 -04:00
Tad Marshall
09feca0ac1 SERVER-9832 Use PF_UNIX symbol instead of PF_LOCAL
PF_LOCAL is the POSIX name for the Unix domain sockets protocol family,
while PF_UNIX is the name that was used by BSD.  Solaris 10 declares
PF_UNIX but not PF_LOCAL, so use that symbol instead.
2013-07-17 15:25:41 -04:00
Tad Marshall
e1320f91ee SERVER-9786 Link to strcasestr at runtime for Solaris
For the Solaris/SmartOS build, do not make direct calls to strcasestr,
which is present in Solaris 11 but not in Solaris 10.  Instead, see if
it is available in a loaded library (which will be libc.so.1) at runtime
and either call it or call an emulation.  Use the emulated version on
Windows, which is also missing this function.
2013-07-17 14:32:55 -04:00
Tad Marshall
5a9cac28f8 SERVER-9325 Add __C99FEATURES__ CPPDEFINE for Solaris to enable isinf()
This makes the build compile on Solaris 11.1 in addition to SmartOS.
2013-07-17 12:42:06 -04:00
Tad Marshall
c0116b875e Visual Studio -- add MurmurHash3 to mongo shell 2013-07-17 11:10:20 -04:00
Spencer T Brody
df1725c542 SERVER-10128 skip killop.js in auth passthrough until auth no longer requires a read lock 2013-07-16 12:36:35 -04:00
Eric Milkie
cec25e5e77 SERVER-10085 do not hold bgsync mutex while waiting for the network 2013-07-15 15:18:52 -04:00
Eric Milkie
22df6cbb2b SERVER-10089 more room in oplog so we avoid RS102 on slower builders 2013-07-12 13:46:24 -04:00
Andreas Nilsson
d9a15614c7 SERVER-10040 Fixed SSL memory leak for failed connects and accepts 2013-07-12 13:34:51 -04:00
Greg Studer
35f6d48c1f SERVER-10039 buildbot test ChunkManagerLoadBasicTest need index to support sorting chunks in test 2013-07-12 13:32:09 -04:00
Greg Studer
d0413be9bb SERVER-10039 sorting ignored in returned query obj for differ 2013-07-12 13:31:29 -04:00
Greg Studer
cef462bf0f SERVER-10175 buildbot v2.4 index1.js failure run GLE after inserts to make sure they went through 2013-07-12 13:29:17 -04:00
Andrew Morrow
af16dc9ef4 SERVER-10110 Fix flakiness in TimeTBuilder jsobj test
- Use the same clock source for all measured time points
- Use sleep interval that necessarily exceeds integer division bounds
2013-07-11 15:54:04 -04:00
Dan Pasette
73dac6d52e SERVER-10033: fix typo in disable logic 2013-07-05 15:01:26 -04:00
Dan Pasette
65c7480458 SERVER-10033 Add parameter to disable the TTLMonitor
Conflicts:
	src/mongo/db/ttl.cpp
2013-07-05 15:01:08 -04:00
Andrew Morrow
bb7c9d3b76 SERVER-10053 Always package all processinfo files
(cherry picked from commit b975f73660)
2013-07-03 15:40:04 -04:00
Ernie Hershey
b814d9f2e0 post 2.4.5 2013-07-03 13:10:56 -04:00
Dan Pasette
a2ddc68ba7 BUMP 2.4.5 2013-07-02 15:27:08 -04:00
Dan Pasette
a6462d21ea post 2.4.5-rc0 2013-06-23 10:24:08 -04:00
Dan Pasette
13b33da1e4 BUMP 2.4.5-rc0 2013-06-21 11:24:43 -04:00
Andy Schwerin
6ad56b63d3 SERVER-9983 Test verifying that internal user privileges do not mask those of similarly named users. 2013-06-21 10:50:49 -04:00
Andy Schwerin
23344f8b75 SERVER-9983 Do not needlessly lock when looking up privileges for the __system@local user.
Uncorrected, this can cause replica set heartbeats to stall behind operations
that hold the read lock for a long time.
2013-06-21 10:50:49 -04:00
Dan Pasette
d2b8eab1cc SERVER-3531 - yield in m/r when docs do not match 2013-06-20 18:35:49 -04:00
Eric Milkie
073bfa9db6 SERVER-9853 avoid Windows test shutdown issues by stopping the test explicitly 2013-06-20 16:15:34 -04:00
Eric Milkie
5304928a8a SERVER-9694 force a stepdown no matter how far behind we think we are 2013-06-20 16:14:25 -04:00
Eliot Horowitz
3bc78e15f1 SERVER-9864: make dbhash take a list of collections to hash and mongos check should use it 2013-06-19 20:30:14 -04:00
Greg Studer
9cd0092e07 SERVER-8844 config server not in sync message is misleading 2013-06-19 20:30:02 -04:00
Eric Milkie
b82d99d5b8 SERVER-9853 retry ghostsync percolate if socket failure
Without this fix, depending on exact timing of upstream socket failure, you could lose
a chaining upstream oplog position update from a secondary.  This might then cause
a write with a certain level of write concern to time out even though enough secondaries
had applied the write.  This problem would be masked by a sufficient number of subsequent
writes, which would trigger another upstream oplog position update.

Note that this only affects chaining; nonchaining updates are already retrying when a socket
failure occurs.

Conflicts:

	src/mongo/db/repl/rs_sync.cpp
2013-06-19 20:20:34 -04:00
Greg Studer
42980b6c62 SERVER-9909 balancer reload idle sharded coll data, and don't abort round
Conflicts:

	src/mongo/s/grid.cpp
2013-06-19 19:41:13 -04:00
Eric Milkie
af0b49cbb0 SERVER-9856 check in-progress indexes for duplicates in prepareToBuildIndex() 2013-06-19 19:05:27 -04:00
Tad Marshall
9f975ab30e SERVER-9824 Add jstest 2013-06-19 19:04:43 -04:00
Tad Marshall
6ab83d2992 SERVER-9824 Whitespace -- CRLF to newline 2013-06-19 19:04:33 -04:00
Tad Marshall
df2274d2a2 SERVER-9824 Retry hash table grow operation on excessive collisions
Be defensive against excessively long hash chains in a resized table in
UnorderedFastKeyTable::_grow().  Retry growing the table up to 5 times
before declaring failure (as we do when inserting into a table).  Reduce
the maximum retry count for table insertions from 10 to 5, since growing
the table by a factor of 32 (2**5) guarantees that no hash chain can be
as long as 5% (1/20, the default _maxProbeRatio) of the new table size.
2013-06-19 19:04:24 -04:00
Randolph Tan
3b0ac30a7b SERVER-9283 lastHeartbeatRecv flaps between invalid and valid dates during replicaset initilization
Do not overwrite lastHeartbeatRecv with 0 value everytime HeartbeatInfo gets updated.
2013-06-19 19:03:13 -04:00
Eliot Horowitz
f91d6f0a74 SERVER-5442: need to resetError before doing the prepare 2013-06-19 19:01:24 -04:00
Eliot Horowitz
310645dc7b SERVER-5442: use journal commit instead of fsync command for config server writes 2013-06-19 19:01:16 -04:00
Jason Rassi
ff8827be35 SERVER-9796 FTSSpec::fixSpec() should not re-order _fts* fields 2013-06-19 18:59:47 -04:00
Eric Milkie
6e1d805e58 SERVER-9804 add numeric code to getLastError error when primary steps down 2013-06-19 18:58:41 -04:00
Mathias Stearn
7c1b35e0b2 SERVER-9878 Add type checks to V8 C++ bindings
The main focus of this ticket is tightening up input validation in
our V8 bindings. Doing this required normalizing the way we create
custom types in JS that have special C++-driven behavior. All special
types now use FunctionTemplates that are attached to the V8Scope object.
This allows us to test if an object is of the correct type before using
it.

Other related tickets partially addressed:
SERVER-8961 Differences in argument validation of custom types between v8 and Spidermonkey
SERVER-9803 Handle regular expression parse errors without seg faulting

Conflicts:

	jstests/constructors.js
	src/mongo/scripting/engine_v8.cpp
2013-06-18 12:40:48 -04:00
Tad Marshall
d3f27364cb Make "bare assert" check more selective
Do not trigger "bare assert" error when " assert(" appears in a
quoted string, as it does in src/mongo/shell/mongo.cpp for example
(as generated by the Visual Studio build).
2013-06-18 12:40:48 -04:00
Ben Becker
f6801d0782 SERVER-9597: In JavaScript, only allow Mongo() to be called as a constructor 2013-06-18 12:40:48 -04:00
Tad Marshall
41ce3764cf SERVER-9605 Use correct string length in hexToBinData()
Do not use hard-coded length of 16 to process variable length hex string.
2013-06-18 12:40:48 -04:00
Mathias Stearn
3c4ac58bfd Remove post-install dependency on murmurhash3 from client 2013-06-18 12:40:47 -04:00
Mathias Stearn
dfd3df0648 Add V8String class to avoid copying v8::Strings into std::strings
Still need to copy once into v8::Utf8Value but this saves the second copy
2013-06-18 12:40:47 -04:00
Mathias Stearn
9d9e10d86a Cache conversion of string literals to V8 Strings 2013-06-18 12:40:47 -04:00
Mathias Stearn
277b05b6e1 Attach V8Scope to v8::Isolate's Data
Frees the accessor data up for other uses
2013-06-18 12:40:47 -04:00
Mathias Stearn
b811b31296 Get rid of "args" global in V8 2013-06-18 12:40:47 -04:00
Shaun Verch
10409c3536 SERVER-8952 Add argument type checking to Timestamp constructor in Javascript shell 2013-06-18 12:40:47 -04:00
Andy Schwerin
aa2d926ae5 Add StringData::rfind(char) const method. 2013-06-18 12:23:44 -04:00
Andrew Morrow
efe5ff8332 SERVER-9942 Give shared client tests a unique name to placate buildlogger
(cherry picked from commit af07d274c2)
2013-06-18 09:51:06 -04:00
Andrew Morrow
daf69857a3 SERVER-9941 Always link client tests against client library in 'sharedclient' directory
Otherwise, we end up with a link dependency into the build dir, which makes it impossible
to run smoke.py if you don't have a build directory around anymore, for some reason
(cherry picked from commit 6e15f4f8f4)
2013-06-18 09:51:00 -04:00
Andrew Morrow
5d5116a94e SERVER-9890 Force the use of gnulink on solaris, since we always link through the compiler
(cherry picked from commit 58f82cf66d)
2013-06-14 18:46:22 -04:00
Eric Milkie
61a75bebf0 SERVER-9694 fix for slow disk'd test runners 2013-06-14 15:01:34 -04:00
Randolph Tan
264aa37448 SERVER-5351 migrations should use better slave count to determine up-to-date 2013-06-13 17:31:18 -04:00
Andrew Morrow
9c4382ecb9 SERVER-6514 Don't attempt to test shared library clients for out of tree builds
(cherry picked from commit 8e42456304)
2013-06-07 18:48:18 -04:00
Andrew Morrow
288d347dbf SERVER-6514 Only apply -zdefs and --as-needed to shared client library
(cherry picked from commit ce97dc76c6)
2013-06-07 18:48:18 -04:00
Andrew Morrow
6975c883e8 SERVER-6514 Only run global initializers from httpClientTest for in-tree SSL builds
(cherry picked from commit 3ba5acdb56)
2013-06-06 10:21:27 -04:00
Andrew Morrow
bc08f8a73a SERVER-6514 Ensure libmongclient precedes other libraries
(cherry picked from commit 8752f35766)
2013-06-06 10:21:27 -04:00
Andrew Morrow
01fa5e9442 SERVER-6514 Don't override CheckLib solution when using system boost
(cherry picked from commit cfc88a35ce)
2013-06-06 10:21:27 -04:00
Ernie Hershey
78ff2db9b0 Revert "test change in v2.4"
This reverts commit 72bc746994.
2013-06-05 14:15:33 -04:00
Ernie Hershey
72bc746994 test change in v2.4 2013-06-05 13:41:19 -04:00
Andrew Morrow
28c04eb6fe SERVER-6514 Fix accidental backport of future use of ProcessId to 2.4 branch 2013-06-05 09:14:26 -04:00
Andrew Morrow
5316bea806 SERVER-6514 Re-add support for building the C++ driver shared library
Primarily a backport of da8c0fa929, with
the following SERVER-6514 fixups patches from master rolled in as well:

680f0bf572
48f8431210
2013-06-04 16:16:08 -04:00
Andrew Morrow
3ec04acb1a SERVER-9408 Don't assume Vista aware SDK when selecting Interlocked64 implementation 2013-06-04 12:32:53 -04:00
Andreas Nilsson
d88d25240b SERVER-9808 Fix issues found in CoN static analysis 2013-06-03 19:18:45 -04:00
Dan Pasette
5c7363fd08 post 2.4.4 2013-06-03 18:50:52 -04:00
Dan Pasette
4ec1fb9670 BUMP 2.4.4 2013-06-02 16:58:06 -04:00
Eric Milkie
e43cbcd979 post 2.4.4-rc0 2013-05-28 10:57:46 -04:00
Eric Milkie
f25c410a9c BUMP 2.4.4-rc0 2013-05-23 22:43:48 -04:00
Eric Milkie
338bce1a36 SERVER-8070 fix comparision to be correct 2013-05-23 14:57:42 -04:00
Eric Milkie
4d38d2427b SERVER-9694 fix test to cover all GLE stepdown cases 2013-05-23 14:45:36 -04:00
Eric Milkie
587a48dafc print result from GLE if test fails (for debugging) 2013-05-23 14:45:33 -04:00
Eric Milkie
d01732d65d SERVER-9730 under any circumstances, do not vote yea while a primary already exists 2013-05-22 17:20:45 -04:00
Greg Studer
c34d5a987b SERVER-9661 config upgrade v0->v3 fails when dropped collection has noBalance set 2013-05-22 17:17:32 -04:00
Randolph Tan
e73f081b18 SERVER-9260 Race in hash_presplit.js
Split the each test case into different files to isolate them from each other.
2013-05-22 16:50:40 -04:00
Eric Milkie
c88286c369 SERVER-8070 more reliable test (failpoint was not in the right place) 2013-05-22 16:49:02 -04:00
Greg Studer
a82ff7c744 SERVER-9718 authCommands.js wait 5 minutes for migrations on very slow test systems 2013-05-22 16:44:45 -04:00
Greg Studer
69f84b2997 SERVER-9719 sharding_multiple_ns_rs.js wait for mongos to detect primary failover 2013-05-22 16:44:09 -04:00
Greg Studer
20528eed94 SERVER-9720 return_partial_shards_down.js turn off balancer before manual chunk moves 2013-05-22 16:43:46 -04:00
Eric Milkie
c781250a89 SERVER-9695 fix racy test 2013-05-22 16:39:20 -04:00
Eric Milkie
80096f6d29 SERVER-9721 do not use sleepmicros on Windows for yielding 2013-05-22 16:39:10 -04:00
Eric Milkie
6f73c167a1 SERVER-9702 do not use line comments in one-liners 2013-05-22 16:39:01 -04:00
Hari Khalsa
d1d2e9c89f SERVER-9484 don't ignore geometries w/>1 covers if one of them isn't in the search annulus
Conflicts:

	src/mongo/db/geo/s2nearcursor.cpp
2013-05-20 10:53:32 -04:00
Alberto Lerner
4da577ffc1 SERVER-9621 Fix case for 32-bit windows test. 2013-05-19 09:10:34 -07:00
Tad Marshall
33e52874df SERVER-9621 Disable jstests/dur/closeall.js on 32-bit Windows
This test fails frequently on 32-bit Windows due to remapPrivateView
being unable to remap a file when another thread allocate memory
while a file is unmapped.

Disable the test in 32-bit Windows since this can't really be fixed
without changes to the storage layer (and 32-bit does not benefit
from stress testing).
2013-05-19 09:10:23 -07:00
Tad Marshall
756d0a1181 SERVER-9621 Add getBuildInfo() function to shell 2013-05-19 09:10:09 -07:00
Greg Studer
0762a6a2fb SERVER-8741 make sure we contact from-shard at least once after commit 2013-05-19 09:04:18 -07:00
Shaun Verch
7d43e2ded4 SERVER-8066 (2/2) Skip undefined fields in mongorestore 2013-05-17 16:24:32 -07:00
Shaun Verch
67fc55fbf9 SERVER-8066 (1/2) Removed redundant if statement 2013-05-17 16:24:25 -07:00
Shaun Verch
c741fd006c SERVER-6947 Do not create undefined fields in db.createCollection 2013-05-17 16:24:08 -07:00
Eric Milkie
cf139b7cb6 SERVER-9502 fix assert code in unit test 2013-05-17 10:13:58 -04:00
Eric Milkie
664284634b SERVER-9502 fix assert code 2013-05-17 10:13:58 -04:00
Eric Milkie
cb25ea3bb5 SERVER-9502 prohibit _id as RegEx
Otherwise, this breaks when replication attempts to do a query with the regular expression as _id.
2013-05-17 10:13:58 -04:00
Tad Marshall
c8db9c81f2 SERVER-9638 Handle case of previous moveChunk not finished yet
Depending on the speeds of operations in the shards, it is possible that
the "to" shard has not finished a migration when we try the next one.  Use
assert.soon() to wait a little and retry when this happens.
2013-05-17 10:13:58 -04:00
Tad Marshall
582288be1c SERVER-9658 Reduce frequency of debug message 2013-05-17 10:13:58 -04:00
Greg Studer
8db5640d6c SERVER-9647 don't transform 2dsphere-indexed desc fields into asc 2013-05-15 11:16:32 -04:00
Eric Milkie
36541662e1 SERVER-9683 propegate timeout into ReplSetTest.initiate() and make replsetprio1.js wait longer 2013-05-14 14:56:36 -04:00
Tad Marshall
c9cc631ac9 SERVER-9542 Change comparison operator to correct type
Do not use "<" to execute a "<=" comparison.
2013-05-13 07:30:17 -04:00
Eric Milkie
e948303411 SERVER-9333 wait long enough for slow builders like Windows Debug 2013-05-13 01:30:52 -04:00
Eric Milkie
4dc1cd907a SERVER-9333 correct reference counting of GhostSlave members
The _ghostCache contains shared pointers to GhostSlave members.
When we clear this cache, we decrement all the reference counts to these objects.
Because we were not keeping a shared_ptr to a GhostSlave object in percolate(),
but instead were using a bare pointer, this caused the bare pointer to be deleted
out from under us when we cleared the cache.  This in turn caused the internal
objects like the OplogReader to be deleted, which caused segfaults in percolate()
when we attempted to advance the oplogreader cursor.
2013-05-13 01:30:42 -04:00
Eric Milkie
bd9e9d04bc SERVER-9333 clear ghostcache at reconfig time 2013-05-13 01:30:30 -04:00
Mathias Stearn
d6093148fc SERVER-9538 Only update BufBuilder's len if successfully grew
Otherwise BSONObj destructor will try to grow again to add EOO byte,
causing a double exception and terminate() call.
2013-05-13 01:29:19 -04:00
Spencer T Brody
834f226a11 SERVER-9315 Make sure local.slaves collection can be maintained in a system with security enabled 2013-05-13 01:21:38 -04:00
Ben Becker
928e0a6aca SERVER-9448: make map and reduce argument and receiver objects mutable 2013-05-13 01:20:24 -04:00
Hari Khalsa
b5c4e7ac53 SERVER-9401 remove duplicate points in lines because S2 doesn't like them 2013-05-13 01:19:28 -04:00
Tad Marshall
47c04a148e SERVER-9542 Fix incorrect unit test
Unit test was passing due to the bug fixed in SERVER-9542.  We
SHOULD get an error when trying to cloneMinus to the same version.
Changed the test to use a higher major version so that no error
message will be returned.
2013-05-13 00:56:58 -04:00
Johan Hedin
d05cbf2871 Fixes SERVER-9491
Upper chunk key was not written properly to the log in some places.
2013-05-13 00:56:09 -04:00
Tad Marshall
db625382d0 SERVER-7588 Improve logic for seconds and milliseconds in ISODate constructor
Do not use floating point for seconds, only for milliseconds.  Adjust other
date components when milliseconds round up to 1000.
2013-05-13 00:51:31 -04:00
Tad Marshall
63f4bc287d SERVER-7424 Use simpler regex to produce single line output in tojson()
When displaying small objects, convert only tabs, carriage returns and
newlines to single spaces, leaving other whitespace alone.
2013-05-13 00:50:55 -04:00
Spencer T Brody
f4ddf51ef4 SERVER-9649 Make writeBacksQueued be granted by clusterAdmin 2013-05-10 13:58:57 -04:00
Eric Milkie
5e43429c98 SERVER-9417 fix unit test to run correctly with auth 2013-05-08 15:40:06 -04:00
Eric Milkie
e3f23c5112 SERVER-9417 assert if we stepDown while waiting to satisfy GLE 2013-05-08 15:40:06 -04:00
Eliot Horowitz
779cdd6a8b SERVER-9417 opReplicatedEnough should assert on step down 2013-05-08 15:40:05 -04:00
Eric Milkie
84d9196c88 SERVER-9578 install mongos signal handler for SIGUSR1 before spawning any threads 2013-05-06 14:35:48 -04:00
Eric Milkie
98acad100e SERVER-9528 need a larger oplog for some builders to avoid RS102 2013-05-02 08:23:57 -04:00
Eric Milkie
16a08039c4 SERVER-9528 retry network failures during document copy at initial sync time 2013-05-01 15:33:08 -04:00
Andy Schwerin
08e4b8ceba SERVER-8813 Switch C++ client and shell code for SASL authentication to use the Cyrus SASL library.
Replaces gsasl implementation in clients.

Rolls up the following patches on the master branch:

2d8e983197
8324f6c887
16aba22e19
f58d431f45
89ca7f9d6f
2013-05-01 13:05:23 -04:00
Eric Milkie
c6a32dc49c SERVER-9339 do not query a node that is not in PRIMARY or SECONDARY state 2013-05-01 10:44:56 -04:00
Eric Milkie
6987dd1dd3 SERVER-9339 ensure all rollback update/delete paths are recorded
Conflicts:
	src/mongo/db/ops/update.cpp
2013-04-30 11:32:54 -04:00
Tad Marshall
0ca298d847 SERVER-9242 Do not show warnings for mongod --help
Remove the call to show_warnings() from show_help_text().

Showing startup warnings in response to a request for information on
available command line options seems wrong, but it also crashes now
because the check for blockCheckSupported() hasn't been set up yet
when command line options are parsed.
2013-04-30 11:13:23 -04:00
Tad Marshall
c557a1a66f SERVER-9242 Change expected test results for unnamed OS (e.g. Solaris)
Until SERVER-9325 is fixed, we don't get good values back from
Solaris/SmartOS, so treat any platform with a blank name (as returned
by db.hostInfo().os.name) as equivalent to Windows XP; test for
the "not supported" set of results.
2013-04-30 11:13:13 -04:00
Tad Marshall
db4d82a844 SERVER-9242 Do not run block_check_supported.js against mongos 2013-04-30 11:13:00 -04:00
Tad Marshall
e33f50c949 SERVER-9242 Whitespace (CRLF) 2013-04-30 11:12:52 -04:00
Tad Marshall
0610711458 SERVER-9242 Add jstest for blockCheckSupported() features
Add test to make sure that db.serverStatus() returns workingSet and
indexCounters values as expected on all platforms.  Windows XP is
expected to give different ("not supported") return values, make
sure that they are as expected.
2013-04-30 11:12:36 -04:00
Tad Marshall
2c1c529f66 SERVER-9242 Use MONGO_INITIALIZERs to cache blockCheckSupported
Only cache values for blockCheckSupported() after the value has been
determined (for platforms, i.e. Windows, where this is a runtime test).
2013-04-30 11:12:23 -04:00
Tad Marshall
dc3b3a8fd7 SERVER-7892 Do not strip indentation in JavaScript source code
V8 displays source code "as-is", so if we remove indentation then it
won't be there when users display "built-in" shell helper source code.
2013-04-30 10:53:26 -04:00
Dan Pasette
ddb73290a4 post 2.4.3 2013-04-23 08:55:09 -04:00
Dan Pasette
fe1743177a BUMP 2.4.3 2013-04-22 10:48:39 -04:00
Dan Pasette
139e40b500 post 2.4.3-rc0 2013-04-19 10:09:25 -04:00
Dan Pasette
7d75e95bc0 BUMP 2.4.3-rc0 2013-04-18 19:15:44 -04:00
Mathias Stearn
716d31016d SERVER-9089 Check for NULL BSONHolder 2013-04-18 19:02:58 -04:00
Mathias Stearn
022affc651 SERVER-9385 Make sure _id fields are extracted from modified lazy V8 objects 2013-04-18 19:02:42 -04:00
Alberto Lerner
0b48ec01cb SERVER-9399 Create the right index of config.lockpings. 2013-04-18 17:45:30 -04:00
Eric Milkie
52c1e65d6f SERVER-9093 remove unit test in 2.4 branch (needs SERVER-8420) 2013-04-18 13:55:26 -04:00
Eric Milkie
0239789a5b SERVER-8420 add a tailcheck to detect cursor deadness 2013-04-18 12:11:38 -04:00
Spencer T Brody
e01102d1df SERVER-9093 Make copydb command work on mongos with auth
Conflicts:
	src/mongo/s/commands_public.cpp
2013-04-18 11:46:48 -04:00
Jason Rassi
036337a5c0 SERVER-9214 Change tolowerString argument type to StringData 2013-04-18 11:29:07 -04:00
Eric Milkie
be1e22fea5 SERVER-9214 initialize variable to placate compiler 2013-04-18 11:13:55 -04:00
Jason Rassi
37f2062420 SERVER-9214 Extract phrases from text searches as exact substrings 2013-04-18 11:13:43 -04:00
Eric Milkie
757fe510df SERVER-4739 compile mongos on Windows 2013-04-18 10:55:33 -04:00
Eric Milkie
9d5de58e4f SERVER-4739 use a thread for logRotate signal instead of a signal handler
Conflicts:
	src/mongo/db/db.cpp
	src/mongo/s/server.cpp
2013-04-18 10:24:54 -04:00
Eric Milkie
6397087303 SERVER-9307 initialize session id context to support session caching on the server
You must set the context in order for session caching to work.
This would normally fail silently without setting the context, but when you turn on
certificate validation and attempt to reuse a session, the attempt will actively fail and
return an error on the server.
The Java driver does make use of restartable sessions and is affected by this issue.
2013-04-18 10:19:59 -04:00
Eric Milkie
ccaf58fccf post 2.4.2 2013-04-18 10:18:34 -04:00
Dan Pasette
3e52c1a73c BUMP 2.4.2 2013-04-16 15:21:23 -04:00
Eric Milkie
0ec9eca507 post 2.4.2-rc0 2013-04-11 09:14:52 -04:00
Dan Pasette
72acf70c11 BUMP 2.4.2-rc0 2013-04-10 15:37:09 -04:00
Greg Studer
c6ec08e021 SERVER-9312 buildbot sharding_migrateBigObject.js longer timeout for slower machines migrating 2013-04-10 15:30:58 -04:00
Alberto Lerner
ab76660a75 SERVER-7271 Improve error reporting when migrate commit fails. 2013-04-09 16:02:19 -04:00
Alberto Lerner
6edf4a7f08 SERVER-9125 Prevent cursor time out in the case of very slow config servers 2013-04-09 12:51:21 -04:00
Alberto Lerner
9f073b6cae SERVER-9125 Fixed batch size computation if first doc is large. 2013-04-09 12:51:20 -04:00
Eric Milkie
cde1ad8f45 SERVER-9286 lowering nested depth
This avoids a stack overflow on OS X; full fix in SERVER-9286
2013-04-09 09:45:41 -04:00
Alberto Lerner
a3dae84ade SERVER-9125 Fix memory ownership during large collection copy 2013-04-08 19:38:14 -04:00
Mathias Stearn
1a62390256 SERVER-9267 Make readonly v8 objects use same getters as regular lazy objects
Also fixes SERVER-9251
2013-04-05 22:23:47 -04:00
Mathias Stearn
219986d5ca Speed up conversion of v8::Arrays to BSON
Two major improvements:
* Use BSONObjBuilder::numStr() to convert index to string (has global
     cache of strings for 0-99)
* Use indexed rather than named iteration over the v8::Array
2013-04-05 22:23:39 -04:00
Mathias Stearn
aefcffa124 Use indexed rather than named Set() when converting to v8::Array
The meat of this change is in the Array case of mongoToV8Element.
mongoToV8() was removed since this was the only caller.

Conflicts:
	src/mongo/scripting/engine_v8.cpp
2013-04-05 22:21:47 -04:00
Mathias Stearn
ee21ceb8d4 SERVER-9230: fix issue causing persistent v8 objects not to be tracked 2013-04-03 21:55:46 -04:00
Hari Khalsa
9a846d8688 SERVER-9228 don't return dups when s2cursor yields, delegate to underlying btreecursor 2013-04-03 21:52:53 -04:00
Eric Milkie
04707f7b39 SERVER-9229 wait for async deletes to finish before balancer stops, to avoid test failure 2013-04-03 15:15:38 -04:00
Dan Pasette
81212176da SERVER-7271 - Fix compile error with ScopedDbConnection 2013-04-02 13:20:05 -04:00
Ben Becker
822840b180 SERVER-9213: remove v8 ResourceConstraints 2013-04-02 10:19:03 -07:00
Spencer T Brody
64ccdfa2f6 SERVER-9054 Update db.help() message for addUser 2013-04-02 11:31:49 -04:00
Alberto Lerner
3bc9328524 SERVER-9125 Copy collections faster in the config upgrade procedure 2013-04-02 10:25:32 -04:00
Alberto Lerner
4a472d8df3 SERVER-7271 Do not exit if a transient config server error aborts a migration.
Conflicts:

	src/mongo/client/distlock.cpp
2013-04-02 10:25:07 -04:00
Randolph Tan
0502e6aada SERVER-9174 Race condition on read_pref_rs_client.js after reconfig
Replaced js test with cpp unit test that does not rely on reconfig.
2013-04-01 19:17:36 -04:00
Ben Becker
f1017ee044 SERVER-9066: avoid duplicate JS field names 2013-04-01 14:43:56 -07:00
Ben Becker
9e05b382ca Reverting SERVER-9186 due to test failures
Revert "SERVER-9186: avoid storing properties on js objects in the getter interceptor"

This reverts commit 337b300277.
2013-03-30 07:41:53 -07:00
Ben Becker
f00104e92f SERVER-9124: Avoid raw pointers for SM's nativeHelper 2013-03-29 17:23:18 -07:00
Ben Becker
e4890bf85c SERVER-9185: add v8 GC epligoue stats 2013-03-29 16:06:30 -07:00
Ben Becker
337b300277 SERVER-9186: avoid storing properties on js objects in the getter interceptor 2013-03-29 16:06:15 -07:00
Jason Rassi
3bf409d4e5 SERVER-9182 Allow restores of dumps containing edited .metadata.json files 2013-03-29 18:48:39 -04:00
Scott Hernandez
198c577fe4 SERVER-9053: ttl: don't delete on non-primaries 2013-03-29 17:32:42 -04:00
Andrew Morrow
85fc27444f SERVER-9047 Don't limit line length when reading numa_maps 2013-03-29 14:49:17 -04:00
Shaun Verch
9ba71622c9 SERVER-9082 Accept any valid value in id field of dbref 2013-03-29 11:38:07 -04:00
Shaun Verch
ffe9de8df3 SERVER-8819 Framework for testing round trip and test roundtrip of DBRef and DBPointer 2013-03-29 11:37:59 -04:00
Shaun Verch
2e87ed15f0 SERVER-8819 Add to falsy values test and do some cleanup in jstests.cpp 2013-03-29 11:37:48 -04:00
Greg Studer
6d7ac05ea2 SERVER-9139 test cursor cleanup in mongos 2013-03-29 10:34:21 -04:00
Greg Studer
bca711f26f SERVER-9139 clean up unsharded cursors in CursorCache 2013-03-29 10:33:56 -04:00
Dan Pasette
9412afa6f3 SERVER-9003 - Display replica set chaining topology in rs.status()
Include syncingTo in heartbeat response and display this info for each
replica set member in the replSetGetStatus command.
2013-03-28 19:35:01 -04:00
Andy Schwerin
7f45f0fe14 SERVER-8983 Include AuthenticationFailed error code in failed MONGODB-CR authentications. 2013-03-28 19:11:38 -04:00
Eric Milkie
4f26c3137e SERVER-9085 fix units in tsToSeconds calculation 2013-03-28 19:11:06 -04:00
Andy Schwerin
6f677a8150 SERVER-9111 Do not try to find user documents in $CLUSTER or $SERVER pseudodatabases. 2013-03-28 19:10:31 -04:00
Jason Rassi
719d6d8207 SERVER-8999 Read "indexPrefix" correctly in FTSCommand::_run() 2013-03-28 19:09:39 -04:00
Andy Schwerin
fde9ff094d SERVER-9014 Synchronize access to CmdGetNonce::_random. 2013-03-28 19:08:19 -04:00
Scott Hernandez
27b3840145 SERVER-9027: allow dbref shard keys 2013-03-28 18:42:05 -04:00
Hari Khalsa
033f58e7d5 SERVER-9062 don't rely on drem to normalize longitude -- explicitly reject OOB values 2013-03-28 18:41:26 -04:00
Ben Becker
f9289144fc SERVER-9088: ensure printjson() doesn't attempt to access DB global 2013-03-28 18:39:34 -04:00
Ben Becker
7ec1528ae3 SERVER-8799: handle symbol BSON type as string in v8 2013-03-28 18:36:12 -04:00
Randolph Tan
182955c65b SERVER-8720 Memory leak in DBClientReplicaSet::slaveConn 2013-03-27 17:18:39 -04:00
Spencer T Brody
d54170cb2b SERVER-9029 Add more informative log message when building unique index on system.users fails 2013-03-25 18:00:39 -04:00
Scott Hernandez
ab32409b04 SERVER-8984: gle c++ client helper should check for command failure 2013-03-25 17:38:07 -04:00
Eliot Horowitz
a16001b741 prep 2.4.2-pre- 2013-03-22 15:56:32 -04:00
Eliot Horowitz
8301275677 SERVER-9087: fix initial sync ignoring updates during index creation 2013-03-22 15:56:28 -04:00
Spencer T Brody
4ffa043511 SERVER-9061 Fix mongostat segfault when using auth with multiple hosts 2013-03-21 18:02:02 -04:00
Spencer T Brody
656008683a SERVER-9050 GLE with w:1 on config servers shouldn't report "norepl" error 2013-03-21 18:01:42 -04:00
Greg Studer
1b8a702436 SERVER-6991 allow releasing sharded conn back to pool after read operation 2013-03-19 16:40:59 -04:00
Greg Studer
1dc86f438b SERVER-6991 better stats for sharded connections and sharded conn pool 2013-03-19 16:40:52 -04:00
Dan Pasette
b74d1bb85d post 2.4.0 2013-03-18 10:29:02 -04:00
Ernie Hershey
bafb7708c6 update logic for including new man pages to >=2.4.0, not >2.4.0 2013-03-17 23:32:26 +00:00
Dan Pasette
ce2d666c04 BUMP 2.4.0 2013-03-15 14:59:55 -04:00
Ernie Hershey
eace82e939 SERVER-5307 fixing file mode to match other man page files 2013-03-14 20:04:40 -04:00
Ernie Hershey
a8fd67b31a SERVER-5307 Only include new man pages in rpm if version > 2.4.0 2013-03-14 20:04:40 -04:00
Ernie Hershey
f89c7424fc SERVER-5307 Include new man pages in rpm 2013-03-14 20:04:40 -04:00
Ernie Hershey
b894cc7211 SERVER-5307 New man pages generated from docs by samk@10gen.com 2013-03-14 20:04:40 -04:00
Dan Pasette
5345b970c3 post 2.4.0-rc3 2013-03-13 14:44:12 -04:00
Dan Pasette
8d3cd285f3 BUMP 2.4.0-rc3 2013-03-13 00:30:52 -04:00
Dan Pasette
3bcf74b73f SERVER-8920 - fix test to not use the test db 2013-03-12 16:43:28 -04:00
Jason Rassi
36e04f7bb6 SERVER-8920 Disable stats.js in sharding passthrough 2013-03-12 13:52:51 -04:00
Eliot Horowitz
d92e629454 SERVER-8920: Add new fields to dbStats command for pdfile version 2013-03-12 11:12:39 -04:00
Jason Rassi
bb2313f420 SERVER-8921 Change error condition for invalid text index spec 2013-03-12 10:48:04 -04:00
Jason Rassi
edb5f4efef SERVER-8873 Correctly decide if a term in a text field is a stopword 2013-03-12 10:35:53 -04:00
Jason Rassi
1b84109f9c SERVER-8921 Improve error message for invalid text index spec 2013-03-12 10:35:46 -04:00
Scott Hernandez
3018a05958 SERVER-8914: rename document.scanned metric 2013-03-08 18:14:49 -05:00
502 changed files with 143382 additions and 4250 deletions

1
.gitignore vendored
View File

@ -99,6 +99,7 @@ scratch
/libmongoclient.*
/libmongotestfiles.*
/libmongoshellfiles.*
/sharedclient
/emr.jar
*.class

View File

@ -68,16 +68,22 @@ def addSmokeSuite( name, suitefile, needMongod=False ):
addSmoketest( "smoke", [ add_exe( "test" ), add_exe( "mongod" ), add_exe( "mongo" ) ] )
addSmoketest( "smokePerf", [ add_exe("perftest") ] )
addSmoketest( "smokeClient", [
add_exe('firstExample'),
add_exe('rsExample'),
add_exe('secondExample'),
add_exe('whereExample'),
add_exe('authTest'),
add_exe('httpClientTest'),
add_exe('bsondemo'),
add_exe('clientTest'),
] )
smokeClientDeps = [
add_exe('firstExample'),
add_exe('rsExample'),
add_exe('secondExample'),
add_exe('whereExample'),
add_exe('authTest'),
add_exe('httpClientTest'),
add_exe('clientTest'),
]
if has_option("sharedclient"):
smokeClientDeps += [ "sharedclient/" + name for name in smokeClientDeps ]
smokeClientDeps += [add_exe('bsondemo')]
smokeClientDeps += [add_exe('mongod'), add_exe('mongo')]
smokeClient = addSmoketest( "smokeClient", smokeClientDeps )
addSmoketest( "mongosTest", [ add_exe( 'mongos' ) ])
addSmokeSuite( "smokeCppUnittests", "$UNITTEST_LIST" )
addSmokeSuite( "smokeModuleTests", "$MODULETEST_LIST" )

View File

@ -231,6 +231,8 @@ add_option("mongod-concurrency-level", "Concurrency level, \"global\" or \"db\""
add_option('client-dist-basename', "Name of the client source archive.", 1, False,
default='mongo-cxx-driver')
add_option('disable-warnings-as-errors', "Don't add -Werror to compiler command line", 0, False)
# don't run configure if user calls --help
if GetOption('help'):
Return()
@ -306,17 +308,35 @@ env = Environment( BUILD_DIR=variantDir,
UNITTEST_LIST='#build/unittests.txt',
PYSYSPLATFORM=os.sys.platform,
PCRE_VERSION='8.30',
PCRE_VERSION='8.36',
CONFIGUREDIR = '#' + scons_data_dir + '/sconf_temp',
CONFIGURELOG = '#' + scons_data_dir + '/config.log'
)
# This could be 'if solaris', but unfortuantely that variable hasn't been set yet.
if "sunos5" == os.sys.platform:
# SERVER-9890: On Solaris, SCons preferentially loads the sun linker tool 'sunlink' when
# using the 'default' tools as we do above. The sunlink tool sets -G as the flag for
# creating a shared library. But we don't want that, since we always drive our link step
# through CC or CXX. Instead, we want to let the compiler map GCC's '-shared' flag to the
# appropriate linker specs that it has compiled in. We could (and should in the future)
# select an empty set of tools above and then enable them as appropriate on a per platform
# basis. Until then the simplest solution, as discussed on the scons-users mailing list,
# appears to be to simply explicitly run the 'gnulink' tool to overwrite the Environment
# changes made by 'sunlink'. See the following thread for more detail:
# http://four.pairlist.net/pipermail/scons-users/2013-June/001486.html
env.Tool('gnulink')
env['_LIBDEPS'] = '$_LIBDEPS_OBJS'
if has_option('mute'):
env.Append( CCCOMSTR = "Compiling $TARGET" )
env.Append( CXXCOMSTR = env["CCCOMSTR"] )
env.Append( SHCCCOMSTR = "Compiling $TARGET" )
env.Append( SHCXXCOMSTR = env["SHCCCOMSTR"] )
env.Append( LINKCOMSTR = "Linking $TARGET" )
env.Append( SHLINKCOMSTR = env["LINKCOMSTR"] )
env.Append( ARCOMSTR = "Generating library $TARGET" )
if has_option('mongod-concurrency-level'):
@ -379,6 +399,7 @@ if has_option( "cpppath" ):
env.Prepend( CPPDEFINES=[ "_SCONS" ,
"MONGO_EXPOSE_MACROS" ,
"PCRE_STATIC", # for pcre on Windows
"SUPPORT_UTF8" ], # for pcre
@ -692,7 +713,9 @@ if nix:
"-Winvalid-pch"] )
# env.Append( " -Wconversion" ) TODO: this doesn't really work yet
if linux:
env.Append( CCFLAGS=["-Werror", "-pipe"] )
env.Append( CCFLAGS=["-pipe"] )
if not has_option("disable-warnings-as-errors"):
env.Append( CCFLAGS=["-Werror"] )
if not has_option('clang'):
env.Append( CCFLAGS=["-fno-builtin-memcmp"] ) # glibc's memcmp is faster than gcc's
@ -708,9 +731,6 @@ if nix:
except KeyError:
pass
if linux and has_option( "sharedclient" ):
env.Append( LINKFLAGS=" -Wl,--as-needed -Wl,-zdefs " )
if linux and has_option( "gcov" ):
env.Append( CXXFLAGS=" -fprofile-arcs -ftest-coverage " )
env.Append( LINKFLAGS=" -fprofile-arcs -ftest-coverage " )
@ -824,7 +844,8 @@ def doConfigure(myenv):
if (conf.CheckCXXHeader( "execinfo.h" ) and
conf.CheckDeclaration('backtrace', includes='#include <execinfo.h>') and
conf.CheckDeclaration('backtrace_symbols', includes='#include <execinfo.h>')):
conf.CheckDeclaration('backtrace_symbols', includes='#include <execinfo.h>') and
conf.CheckDeclaration('backtrace_symbols_fd', includes='#include <execinfo.h>')):
myenv.Append( CPPDEFINES=[ "MONGO_HAVE_EXECINFO_BACKTRACE" ] )
@ -841,9 +862,9 @@ def doConfigure(myenv):
if not conf.CheckLib( v8_lib_choices ):
Exit(1)
env['MONGO_BUILD_SASL_CLIENT'] = bool(has_option("use-sasl-client"))
if env['MONGO_BUILD_SASL_CLIENT'] and not conf.CheckLibWithHeader(
"gsasl", "gsasl.h", "C", "gsasl_check_version(GSASL_VERSION);", autoadd=False):
conf.env['MONGO_BUILD_SASL_CLIENT'] = bool(has_option("use-sasl-client"))
if conf.env['MONGO_BUILD_SASL_CLIENT'] and not conf.CheckLibWithHeader(
"sasl2", "sasl/sasl.h", "C", "sasl_version_info(0, 0, 0, 0, 0, 0);", autoadd=False):
Exit(1)
@ -1104,13 +1125,6 @@ if len(COMMAND_LINE_TARGETS) > 0 and 'uninstall' in COMMAND_LINE_TARGETS:
BUILD_TARGETS.remove("uninstall")
BUILD_TARGETS.append("install")
clientEnv = env.Clone()
clientEnv['CPPDEFINES'].remove('MONGO_EXPOSE_MACROS')
if not use_system_version_of_library("boost"):
clientEnv.Append(LIBS=['boost_thread', 'boost_filesystem', 'boost_system'])
clientEnv.Prepend(LIBPATH=['$BUILD_DIR/third_party/boost/'])
module_sconscripts = moduleconfig.get_module_sconscripts(mongo_modules)
# The following symbols are exported for use in subordinate SConscript files.
@ -1122,7 +1136,6 @@ module_sconscripts = moduleconfig.get_module_sconscripts(mongo_modules)
# conditional decision making that hasn't been moved up to this SConstruct file,
# and they are exported here, as well.
Export("env")
Export("clientEnv")
Export("shellEnv")
Export("testEnv")
Export("has_option use_system_version_of_library")

View File

@ -3,6 +3,7 @@ import sys
import os, os.path
import utils
import time
import exceptions
from optparse import OptionParser
# set cwd to the root mongo dir, one level up from this
@ -14,7 +15,6 @@ if os.path.basename(cwd) == 'buildscripts':
print( "cwd [" + cwd + "]" )
def shouldKill( c ):
if "smoke.py" in c:
return False
@ -36,7 +36,6 @@ def shouldKill( c ):
return False
def killprocs( signal="" ):
killed = 0
if sys.platform == 'win32':
@ -55,7 +54,7 @@ def killprocs( signal="" ):
x = x.lstrip()
if not shouldKill( x ):
continue
pid = x.split( " " )[0]
print( "killing: " + x )
utils.execsys( "/bin/kill " + signal + " " + pid )
@ -65,7 +64,6 @@ def killprocs( signal="" ):
def cleanup( root , nokill ):
if nokill:
print "nokill requested, not killing anybody"
else:
@ -76,11 +74,18 @@ def cleanup( root , nokill ):
# delete all regular files, directories can stay
# NOTE: if we delete directories later, we can't delete diskfulltest
for ( dirpath , dirnames , filenames ) in os.walk( root , topdown=False ):
for x in filenames:
for x in filenames:
foo = dirpath + "/" + x
print( "removing: " + foo )
os.remove( foo )
try:
os.remove(foo)
except exceptions.OSError, e:
# SERVER-10462 compensate for Windows file locking race
# We want to catch WindowsError but can't use that name on other platforms
print(repr(e))
print("os.remove(%s) failed, retrying once." % foo)
time.sleep(1)
os.remove(foo)
if __name__ == "__main__":
parser = OptionParser(usage="read the script")
@ -90,5 +95,5 @@ if __name__ == "__main__":
root = "/data/db/"
if len(args) > 0:
root = args[0]
cleanup( root , options.nokill )

View File

@ -40,7 +40,7 @@ def readErrorCodes( callback, replaceZero = False ):
re.compile( "((fassertFailed)()) *\(( *)(\d+)" )
]
bad = [ re.compile( "\sassert *\(" ) ]
bad = [ re.compile( "^\s*assert *\(" ) ]
for x in utils.getAllSourceFiles():

View File

@ -0,0 +1,997 @@
#!/usr/bin/python
# This program makes Debian and RPM repositories for MongoDB, by
# downloading our tarballs of statically linked executables and
# insinuating them into Linux packages. It must be run on a
# Debianoid, since Debian provides tools to make RPMs, but RPM-based
# systems don't provide debian packaging crud.
# Notes:
#
# * Almost anything that you want to be able to influence about how a
# package construction must be embedded in some file that the
# packaging tool uses for input (e.g., debian/rules, debian/control,
# debian/changelog; or the RPM specfile), and the precise details are
# arbitrary and silly. So this program generates all the relevant
# inputs to the packaging tools.
#
# * Once a .deb or .rpm package is made, there's a separate layer of
# tools that makes a "repository" for use by the apt/yum layers of
# package tools. The layouts of these repositories are arbitrary and
# silly, too.
#
# * Before you run the program on a new host, these are the
# prerequisites:
#
# apt-get install dpkg-dev rpm debhelper fakeroot ia32-libs createrepo git-core libsnmp15
# echo "Now put the dist gnupg signing keys in ~root/.gnupg"
import errno
import getopt
from packager import httpget
import os
import re
import stat
import subprocess
import sys
import tempfile
import time
import urlparse
# For the moment, this program runs on the host that also serves our
# repositories to the world, so the last thing the program does is
# move the repositories into place. Make this be the path where the
# web server will look for repositories.
REPOPATH="/var/www/repo"
# The 10gen names for the architectures we support.
ARCHES=["x86_64"]
# Made up names for the flavors of distribution we package for.
DISTROS=["debian-sysvinit", "ubuntu-upstart", "redhat"]
# When we're preparing a directory containing packaging tool inputs
# and our binaries, use this relative subdirectory for placing the
# binaries.
BINARYDIR="BINARIES"
sys.stderr.write("BINARYDIR: %s, REPOPATH: %s\n" % (BINARYDIR, REPOPATH))
class Spec(object):
def __init__(self, specstr):
tup = specstr.split(":")
self.ver = tup[0]
# Hack: the second item in the tuple is treated as a suffix if
# it lacks an equals sign; otherwise it's the start of named
# parameters.
self.suf = None
if len(tup) > 1 and tup[1].find("=") == -1:
self.suf = tup[1]
# Catch-all for any other parameters to the packaging.
i = 2 if self.suf else 1
self.params = dict([s.split("=") for s in tup[i:]])
for key in self.params.keys():
assert(key in ["suffix", "revision"])
def version(self):
return self.ver
def version_better_than(self, version_string):
# FIXME: this is wrong, but I'm in a hurry.
# e.g., "1.8.2" < "1.8.10", "1.8.2" < "1.8.2-rc1"
return self.ver > version_string
def suffix(self):
# suffix is what we tack on after pkgbase.
if self.suf:
return self.suf
elif "suffix" in self.params:
return self.params["suffix"]
else:
return "-10gen-enterprise" if int(self.ver.split(".")[1])%2==0 else "-10gen-unstable"
def pversion(self, distro):
# Note: Debian packages have funny rules about dashes in
# version numbers, and RPM simply forbids dashes. pversion
# will be the package's version number (but we need to know
# our upstream version too).
if re.search("^(debian|ubuntu)", distro.name()):
return re.sub("-", "~", self.ver)
elif re.search("(redhat|fedora|centos)", distro.name()):
return re.sub("\\d+-", "", self.ver)
else:
raise Exception("BUG: unsupported platform?")
def param(self, param):
if param in self.params:
return self.params[param]
return None
class Distro(object):
def __init__(self, string):
self.n=string
def name(self):
return self.n
def pkgbase(self):
# pkgbase is the first part of the package's name on
# this distro.
return "mongo" if re.search("(redhat|fedora|centos)", self.n) else "mongodb"
def archname(self, arch):
if re.search("^(debian|ubuntu)", self.n):
return "i386" if arch.endswith("86") else "amd64"
elif re.search("^(centos|redhat|fedora)", self.n):
return "i686" if arch.endswith("86") else "x86_64"
else:
raise Exception("BUG: unsupported platform?")
def repodir(self, arch):
"""Return the directory where we'll place the package files for
(distro, distro_version) in that distro's preferred repository
layout (as distinct from where that distro's packaging building
tools place the package files)."""
if re.search("^(debian|ubuntu)", self.n):
return "repo/%s/dists/dist/10gen/binary-%s/" % (self.n, self.archname(arch))
elif re.search("(redhat|fedora|centos)", self.n):
return "repo/%s/os/%s/RPMS/" % (self.n, self.archname(arch))
else:
raise Exception("BUG: unsupported platform?")
def make_pkg(self, arch, spec, srcdir):
if re.search("^(debian|ubuntu)", self.n):
return make_deb(self, arch, spec, srcdir)
elif re.search("^(centos|redhat|fedora)", self.n):
return make_rpm(self, arch, spec, srcdir)
else:
raise Exception("BUG: unsupported platform?")
def build_os(self):
"""Return the build os label in the binary package to download ("rhel62"
for redhat, "ubuntu1204" for Ubuntu and Debian)"""
if re.search("^(debian|ubuntu)", self.n):
return "ubuntu1204"
elif re.search("(redhat|fedora|centos)", self.n):
return "rhel62"
else:
raise Exception("BUG: unsupported platform?")
def main(argv):
(flags, specs) = parse_args(argv[1:])
distros=[Distro(distro) for distro in DISTROS]
oldcwd=os.getcwd()
srcdir=oldcwd+"/../"
# We do all our work in a randomly-created directory. You can set
# TEMPDIR to influence where this program will do stuff.
prefix=tempfile.mkdtemp()
print "Working in directory %s" % prefix
# This will be a list of directories where we put packages in
# "repository layout".
repos=[]
os.chdir(prefix)
try:
# Download the binaries.
urlfmt="http://downloads.10gen.com/linux/mongodb-linux-%s-subscription-%s-%s.tgz"
# Build a pacakge for each distro/spec/arch tuple, and
# accumulate the repository-layout directories.
for (distro, spec, arch) in crossproduct(distros, specs, ARCHES):
httpget(urlfmt % (arch, distro.build_os(), spec.version()), ensure_dir(tarfile(distro, arch, spec)))
repos.append(make_package(distro, arch, spec, srcdir))
# Build the repos' metadatas.
for repo in set(repos):
print repo
make_repo(repo)
finally:
os.chdir(oldcwd)
if "-n" not in flags:
move_repos_into_place(prefix+"/repo", REPOPATH)
# FIXME: try shutil.rmtree some day.
sysassert(["rm", "-rv", prefix])
def parse_args(args):
if len(args) == 0:
print """Usage: packager.py [OPTS] SPEC1 SPEC2 ... SPECn
Options:
-n: Just build the packages, don't publish them as a repo
or clean out the working directory
Each SPEC is a mongodb version string optionally followed by a colon
and some parameters, of the form <paramname>=<value>. Supported
parameters:
suffix -- suffix to append to the package's base name. (If
unsupplied, suffixes default based on the parity of the
middle number in the version.)
revision -- least-order version number to packaging systems
"""
sys.exit(0)
try:
(flags, args) = getopt.getopt(args, "n")
except getopt.GetoptError, err:
print str(err)
sys.exit(2)
flags=dict(flags)
specs=[Spec(arg) for arg in args]
return (flags, specs)
def crossproduct(*seqs):
"""A generator for iterating all the tuples consisting of elements
of seqs."""
l = len(seqs)
if l == 0:
pass
elif l == 1:
for i in seqs[0]:
yield [i]
else:
for lst in crossproduct(*seqs[:-1]):
for i in seqs[-1]:
lst2=list(lst)
lst2.append(i)
yield lst2
def sysassert(argv):
"""Run argv and assert that it exited with status 0."""
print "In %s, running %s" % (os.getcwd(), " ".join(argv))
sys.stdout.flush()
sys.stderr.flush()
assert(subprocess.Popen(argv).wait()==0)
def backtick(argv):
"""Run argv and return its output string."""
print "In %s, running %s" % (os.getcwd(), " ".join(argv))
sys.stdout.flush()
sys.stderr.flush()
return subprocess.Popen(argv, stdout=subprocess.PIPE).communicate()[0]
def ensure_dir(filename):
"""Make sure that the directory that's the dirname part of
filename exists, and return filename."""
dirpart = os.path.dirname(filename)
try:
os.makedirs(dirpart)
except OSError: # as exc: # Python >2.5
exc=sys.exc_value
if exc.errno == errno.EEXIST:
pass
else:
raise exc
return filename
def tarfile(distro, arch, spec):
"""Return the location where we store the downloaded tarball for
(arch, spec)"""
return "dl/mongodb-linux-%s-subscription-%s-%s.tar.gz" % (spec.version(), distro.build_os(), arch)
def setupdir(distro, arch, spec):
# The setupdir will be a directory containing all inputs to the
# distro's packaging tools (e.g., package metadata files, init
# scripts, etc), along with the already-built binaries). In case
# the following format string is unclear, an example setupdir
# would be dst/x86_64/debian-sysvinit/mongodb-10gen-unstable/
return "dst/%s/%s/%s%s-%s/" % (arch, distro.name(), distro.pkgbase(), spec.suffix(), spec.pversion(distro))
def unpack_binaries_into(distro, arch, spec, where):
"""Unpack the tarfile for (distro, arch, spec) into directory where."""
rootdir=os.getcwd()
ensure_dir(where)
# Note: POSIX tar doesn't require support for gtar's "-C" option,
# and Python's tarfile module prior to Python 2.7 doesn't have the
# features to make this detail easy. So we'll just do the dumb
# thing and chdir into where and run tar there.
os.chdir(where)
try:
sysassert(["tar", "xvzf", rootdir+"/"+tarfile(distro, arch, spec), "mongodb-linux-%s-subscription-%s-%s/bin" % (arch, distro.build_os(), spec.version())])
os.rename("mongodb-linux-%s-subscription-%s-%s/bin" % (arch, distro.build_os(), spec.version()), "bin")
os.rmdir("mongodb-linux-%s-subscription-%s-%s" % (arch, distro.build_os(), spec.version()))
except Exception:
exc=sys.exc_value
os.chdir(rootdir)
raise exc
os.chdir(rootdir)
def make_package(distro, arch, spec, srcdir):
"""Construct the package for (arch, distro, spec), getting
packaging files from srcdir and any user-specified suffix from
suffixes"""
sdir=setupdir(distro, arch, spec)
ensure_dir(sdir)
# Note that the RPM packages get their man pages from the debian
# directory, so the debian directory is needed in all cases (and
# innocuous in the debianoids' sdirs).
for pkgdir in ["debian", "rpm"]:
print "Copying packaging files from %s to %s" % ("%s/%s" % (srcdir, pkgdir), sdir)
# FIXME: sh-dash-cee is bad. See if tarfile can do this.
sysassert(["sh", "-c", "(cd \"%s\" && git archive r%s %s/ ) | (cd \"%s\" && tar xvf -)" % (srcdir, spec.version(), pkgdir, sdir)])
# Splat the binaries under sdir. The "build" stages of the
# packaging infrastructure will move the binaries to wherever they
# need to go.
unpack_binaries_into(distro, arch, spec, sdir+("%s/usr/"%BINARYDIR))
# Remove the mongosniff binary due to libpcap dynamic
# linkage. FIXME: this removal should go away
# eventually.
if os.path.exists(sdir+("%s/usr/bin/mongosniff"%BINARYDIR)):
os.unlink(sdir+("%s/usr/bin/mongosniff"%BINARYDIR))
return distro.make_pkg(arch, spec, srcdir)
def make_repo(repodir):
if re.search("(debian|ubuntu)", repodir):
make_deb_repo(repodir)
elif re.search("(centos|redhat|fedora)", repodir):
make_rpm_repo(repodir)
else:
raise Exception("BUG: unsupported platform?")
def make_deb(distro, arch, spec, srcdir):
# I can't remember the details anymore, but the initscript/upstart
# job files' names must match the package name in some way; and
# see also the --name flag to dh_installinit in the generated
# debian/rules file.
suffix=spec.suffix()
sdir=setupdir(distro, arch, spec)
if re.search("sysvinit", distro.name()):
os.link(sdir+"debian/init.d", sdir+"debian/%s%s.mongodb.init" % (distro.pkgbase(), suffix))
os.unlink(sdir+"debian/mongodb.upstart")
elif re.search("upstart", distro.name()):
os.link(sdir+"debian/mongodb.upstart", sdir+"debian/%s%s.upstart" % (distro.pkgbase(), suffix))
os.unlink(sdir+"debian/init.d")
else:
raise Exception("unknown debianoid flavor: not sysvinit or upstart?")
# Rewrite the control and rules files
write_debian_control_file(sdir+"debian/control", spec)
write_debian_rules_file(sdir+"debian/rules", spec)
write_debian_changelog(sdir+"debian/changelog", spec, srcdir)
distro_arch=distro.archname(arch)
# Do the packaging.
oldcwd=os.getcwd()
try:
os.chdir(sdir)
sysassert(["dpkg-buildpackage", "-a"+distro_arch, "-k Richard Kreuter <richard@10gen.com>"])
finally:
os.chdir(oldcwd)
r=distro.repodir(arch)
ensure_dir(r)
# FIXME: see if shutil.copyfile or something can do this without
# much pain.
sysassert(["cp", "-v", sdir+"../%s%s_%s%s_%s.deb"%(distro.pkgbase(), suffix, spec.pversion(distro), "-"+spec.param("revision") if spec.param("revision") else"", distro_arch), r])
return r
def make_deb_repo(repo):
# Note: the Debian repository Packages files must be generated
# very carefully in order to be usable.
oldpwd=os.getcwd()
os.chdir(repo+"../../../../")
try:
dirs=set([os.path.dirname(deb)[2:] for deb in backtick(["find", ".", "-name", "*.deb"]).split()])
for d in dirs:
s=backtick(["dpkg-scanpackages", d, "/dev/null"])
f=open(d+"/Packages", "w")
try:
f.write(s)
finally:
f.close()
b=backtick(["gzip", "-9c", d+"/Packages"])
f=open(d+"/Packages.gz", "wb")
try:
f.write(b)
finally:
f.close()
finally:
os.chdir(oldpwd)
# Notes: the Release{,.gpg} files must live in a special place,
# and must be created after all the Packages.gz files have been
# done.
s="""
Origin: 10gen
Label: 10gen
Suite: 10gen
Codename: %s
Version: %s
Architectures: i386 amd64
Components: 10gen
Description: 10gen packages
""" % ("dist", "dist")
if os.path.exists(repo+"../../Release"):
os.unlink(repo+"../../Release")
if os.path.exists(repo+"../../Release.gpg"):
os.unlink(repo+"../../Release.gpg")
oldpwd=os.getcwd()
os.chdir(repo+"../../")
s2=backtick(["apt-ftparchive", "release", "."])
try:
f=open("Release", 'w')
try:
f.write(s)
f.write(s2)
finally:
f.close()
arg=None
for line in backtick(["gpg", "--list-keys"]).split("\n"):
tokens=line.split()
if len(tokens)>0 and tokens[0] == "uid":
arg=tokens[-1]
break
# Note: for some reason, I think --no-tty might be needed
# here, but maybe not.
sysassert(["gpg", "-r", arg, "--no-secmem-warning", "-abs", "--output", "Release.gpg", "Release"])
finally:
os.chdir(oldpwd)
def move_repos_into_place(src, dst):
# Find all the stuff in src/*, move it to a freshly-created
# directory beside dst, then play some games with symlinks so that
# dst is a name the new stuff and dst+".old" names the previous
# one. This feels like a lot of hooey for something so trivial.
# First, make a crispy fresh new directory to put the stuff in.
i=0
while True:
date_suffix=time.strftime("%Y-%m-%d")
dname=dst+".%s.%d" % (date_suffix, i)
try:
os.mkdir(dname)
break
except OSError:
exc=sys.exc_value
if exc.errno == errno.EEXIST:
pass
else:
raise exc
i=i+1
# Put the stuff in our new directory.
for r in os.listdir(src):
sysassert(["cp", "-rv", src + "/" + r, dname])
# Make a symlink to the new directory; the symlink will be renamed
# to dst shortly.
i=0
while True:
tmpnam=dst+".TMP.%d" % i
try:
os.symlink(dname, tmpnam)
break
except OSError: # as exc: # Python >2.5
exc=sys.exc_value
if exc.errno == errno.EEXIST:
pass
else:
raise exc
i=i+1
# Make a symlink to the old directory; this symlink will be
# renamed shortly, too.
oldnam=None
if os.path.exists(dst):
i=0
while True:
oldnam=dst+".old.%d" % i
try:
os.symlink(os.readlink(dst), oldnam)
break
except OSError: # as exc: # Python >2.5
exc=sys.exc_value
if exc.errno == errno.EEXIST:
pass
else:
raise exc
os.rename(tmpnam, dst)
if oldnam:
os.rename(oldnam, dst+".old")
def write_debian_changelog(path, spec, srcdir):
oldcwd=os.getcwd()
os.chdir(srcdir)
preamble=""
if spec.param("revision"):
preamble="""mongodb%s (%s-%s) unstable; urgency=low
* Bump revision number
-- Richard Kreuter <richard@10gen.com> %s
""" % (spec.suffix(), spec.pversion(Distro("debian")), spec.param("revision"), time.strftime("%a, %d %b %Y %H:%m:%S %z"))
try:
s=preamble+backtick(["sh", "-c", "git archive r%s debian/changelog | tar xOf -" % spec.version()])
finally:
os.chdir(oldcwd)
f=open(path, 'w')
lines=s.split("\n")
# If the first line starts with "mongodb", it's not a revision
# preamble, and so frob the version number.
lines[0]=re.sub("^mongodb \\(.*\\)", "mongodb (%s)" % (spec.pversion(Distro("debian"))), lines[0])
# Rewrite every changelog entry starting in mongodb<space>
lines=[re.sub("^mongodb ", "mongodb%s " % (spec.suffix()), l) for l in lines]
lines=[re.sub("^ --", " --", l) for l in lines]
s="\n".join(lines)
try:
f.write(s)
finally:
f.close()
def write_debian_control_file(path, spec):
s="""Source: @@PACKAGE_BASENAME@@
Section: devel
Priority: optional
Maintainer: Richard Kreuter <richard@10gen.com>
Build-Depends:
Standards-Version: 3.8.0
Homepage: http://www.mongodb.org
Package: @@PACKAGE_BASENAME@@
Conflicts: @@PACKAGE_CONFLICTS@@
Architecture: any
Depends: libc6 (>= 2.3.2), libgcc1 (>= 1:4.1.1), libstdc++6 (>= 4.1.1), libsnmp15, libsasl2-2, libssl1.0.0
Description: An object/document-oriented database
MongoDB is a high-performance, open source, schema-free
document-oriented data store that's easy to deploy, manage
and use. It's network accessible, written in C++ and offers
the following features :
.
* Collection oriented storage - easy storage of object-
style data
* Full index support, including on inner objects
* Query profiling
* Replication and fail-over support
* Efficient storage of binary data including large
objects (e.g. videos)
* Auto-sharding for cloud-level scalability (Q209)
.
High performance, scalability, and reasonable depth of
functionality are the goals for the project.
"""
s=re.sub("@@PACKAGE_BASENAME@@", "mongodb%s" % spec.suffix(), s)
conflict_suffixes=["", "-stable", "-unstable", "-nightly", "-10gen", "-10gen-unstable", "-10gen-enterprise"]
conflict_suffixes = [suff for suff in conflict_suffixes if suff != spec.suffix()]
s=re.sub("@@PACKAGE_CONFLICTS@@", ", ".join(["mongodb"+suffix for suffix in conflict_suffixes] + [ "mongodb18"+suffix for suffix in conflict_suffixes] + ["mongodb20"+suffix for suffix in conflict_suffixes]), s)
f=open(path, 'w')
try:
f.write(s)
finally:
f.close()
def write_debian_rules_file(path, spec):
# Note debian/rules is a makefile, so for visual disambiguation we
# make all tabs here \t.
s="""#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
configure: configure-stamp
configure-stamp:
\tdh_testdir
# Add here commands to configure the package.
\ttouch configure-stamp
build: build-stamp
build-stamp: configure-stamp
\tdh_testdir
# Add here commands to compile the package.
# THE FOLLOWING LINE IS INTENTIONALLY COMMENTED.
\t# scons
#docbook-to-man debian/mongodb.sgml > mongodb.1
\tls debian/*.1 > debian/@@PACKAGE_NAME@@.manpages
\ttouch $@
clean:
\tdh_testdir
\tdh_testroot
\trm -f build-stamp configure-stamp
\t# FIXME: scons freaks out at the presence of target files
\t# under debian/mongodb.
\t#scons -c
\trm -rf $(CURDIR)/debian/@@PACKAGE_NAME@@
\trm -f config.log
\trm -f mongo
\trm -f mongod
\trm -f mongoimportjson
\trm -f mongoexport
\trm -f mongorestore
\trm -f mongodump
\trm -f mongofiles
\trm -f .sconsign.dblite
\trm -f libmongoclient.a
\trm -rf client/*.o
\trm -rf tools/*.o
\trm -rf shell/*.o
\trm -rf .sconf_temp
\trm -f buildscripts/*.pyc
\trm -f *.pyc
\trm -f buildinfo.cpp
\tdh_clean debian/files
install: build
\tdh_testdir
\tdh_testroot
\tdh_prep
\tdh_installdirs
# THE FOLLOWING LINE IS INTENTIONALLY COMMENTED.
\t# scons --prefix=$(CURDIR)/debian/mongodb/usr install
\tcp -v $(CURDIR)/@@BINARYDIR@@/usr/bin/* $(CURDIR)/debian/@@PACKAGE_NAME@@/usr/bin
\tmkdir -p $(CURDIR)/debian/@@PACKAGE_NAME@@/etc
\tcp $(CURDIR)/debian/mongodb.conf $(CURDIR)/debian/@@PACKAGE_NAME@@/etc/mongodb.conf
\tmkdir -p $(CURDIR)/debian/@@PACKAGE_NAME@@/usr/share/lintian/overrides/
\tinstall -m 644 $(CURDIR)/debian/lintian-overrides \
\t\t$(CURDIR)/debian/@@PACKAGE_NAME@@/usr/share/lintian/overrides/@@PACKAGE_NAME@@
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
\tdh_testdir
\tdh_testroot
\tdh_installchangelogs
\tdh_installdocs
\tdh_installexamples
#\tdh_install
#\tdh_installmenu
#\tdh_installdebconf\t
#\tdh_installlogrotate
#\tdh_installemacsen
#\tdh_installpam
#\tdh_installmime
\tdh_installinit --name=@@PACKAGE_BASENAME@@
#\tdh_installinfo
\tdh_installman
\tdh_link
# Appears to be broken on Ubuntu 11.10...?
#\tdh_strip
\tdh_compress
\tdh_fixperms
\tdh_installdeb
\tdh_shlibdeps
\tdh_gencontrol
\tdh_md5sums
\tdh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
"""
s=re.sub("@@PACKAGE_NAME@@", "mongodb%s" % spec.suffix(), s)
s=re.sub("@@PACKAGE_BASENAME@@", "mongodb", s)
s=re.sub("@@BINARYDIR@@", BINARYDIR, s)
f=open(path, 'w')
try:
f.write(s)
finally:
f.close()
# FIXME: some versions of debianoids seem to
# need the rules file to be 755?
os.chmod(path, stat.S_IXUSR|stat.S_IWUSR|stat.S_IRUSR|stat.S_IXGRP|stat.S_IRGRP|stat.S_IXOTH|stat.S_IWOTH)
def make_rpm(distro, arch, spec, srcdir):
# Create the specfile.
suffix=spec.suffix()
sdir=setupdir(distro, arch, spec)
specfile=sdir+"rpm/mongo%s.spec" % suffix
write_rpm_spec_file(specfile, spec)
topdir=ensure_dir(os.getcwd()+'/rpmbuild/')
for subdir in ["BUILD", "RPMS", "SOURCES", "SPECS", "SRPMS"]:
ensure_dir("%s/%s/" % (topdir, subdir))
distro_arch=distro.archname(arch)
# RPM tools take these macro files that define variables in
# RPMland. Unfortunately, there's no way to tell RPM tools to use
# a given file *in addition* to the files that it would already
# load, so we have to figure out what it would normally load,
# augment that list, and tell RPM to use the augmented list. To
# figure out what macrofiles ordinarily get loaded, older RPM
# versions had a parameter called "macrofiles" that could be
# extracted from "rpm --showrc". But newer RPM versions don't
# have this. To tell RPM what macros to use, older versions of
# RPM have a --macros option that doesn't work; on these versions,
# you can put a "macrofiles" parameter into an rpmrc file. But
# that "macrofiles" setting doesn't do anything for newer RPM
# versions, where you have to use the --macros flag instead. And
# all of this is to let us do our work with some guarantee that
# we're not clobbering anything that doesn't belong to us. Why is
# RPM so braindamaged?
macrofiles=[l for l in backtick(["rpm", "--showrc"]).split("\n") if l.startswith("macrofiles")]
flags=[]
macropath=os.getcwd()+"/macros"
write_rpm_macros_file(macropath, topdir)
if len(macrofiles)>0:
macrofiles=macrofiles[0]+":"+macropath
rcfile=os.getcwd()+"/rpmrc"
write_rpmrc_file(rcfile, macrofiles)
flags=["--rpmrc", rcfile]
else:
# This hard-coded hooey came from some box running RPM
# 4.4.2.3. It may not work over time, but RPM isn't sanely
# configurable.
flags=["--macros", "/usr/lib/rpm/macros:/usr/lib/rpm/%s-linux/macros:/etc/rpm/macros.*:/etc/rpm/macros:/etc/rpm/%s-linux/macros:~/.rpmmacros:%s" % (distro_arch, distro_arch, macropath)]
# Put the specfile and the tar'd up binaries and stuff in
# place. FIXME: see if shutil.copyfile can do this without too
# much hassle.
sysassert(["cp", "-v", specfile, topdir+"SPECS/"])
oldcwd=os.getcwd()
os.chdir(sdir+"/../")
try:
sysassert(["tar", "-cpzf", topdir+"SOURCES/mongo%s-%s.tar.gz" % (suffix, spec.pversion(distro)), os.path.basename(os.path.dirname(sdir))])
finally:
os.chdir(oldcwd)
# Do the build.
sysassert(["rpmbuild", "-ba", "--target", distro_arch] + flags + ["%s/SPECS/mongo%s.spec" % (topdir, suffix)])
r=distro.repodir(arch)
ensure_dir(r)
# FIXME: see if some combination of shutil.copy<hoohah> and glob
# can do this without shelling out.
sysassert(["sh", "-c", "cp -v \"%s/RPMS/%s/\"*.rpm \"%s\""%(topdir, distro_arch, r)])
return r
def make_rpm_repo(repo):
oldpwd=os.getcwd()
os.chdir(repo+"../")
try:
sysassert(["createrepo", "."])
finally:
os.chdir(oldpwd)
def write_rpmrc_file(path, string):
f=open(path, 'w')
try:
f.write(string)
finally:
f.close()
def write_rpm_macros_file(path, topdir):
f=open(path, 'w')
try:
f.write("%%_topdir %s" % topdir)
finally:
f.close()
def write_rpm_spec_file(path, spec):
s="""Name: @@PACKAGE_BASENAME@@
Conflicts: @@PACKAGE_CONFLICTS@@
Obsoletes: @@PACKAGE_OBSOLETES@@
Version: @@PACKAGE_VERSION@@
Release: mongodb_@@PACKAGE_REVISION@@%{?dist}
Summary: mongo client shell and tools
License: AGPL 3.0
URL: http://www.mongodb.org
Group: Applications/Databases
Requires: cyrus-sasl, net-snmp-libs
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
%description
Mongo (from "huMONGOus") is a schema-free document-oriented database.
It features dynamic profileable queries, full indexing, replication
and fail-over support, efficient storage of large binary data objects,
and auto-sharding.
This package provides the mongo shell, import/export tools, and other
client utilities.
%package server
Summary: mongo server, sharding server, and support scripts
Group: Applications/Databases
Requires: @@PACKAGE_BASENAME@@
%description server
Mongo (from "huMONGOus") is a schema-free document-oriented database.
This package provides the mongo server software, mongo sharding server
softwware, default configuration files, and init.d scripts.
%package devel
Summary: Headers and libraries for mongo development.
Group: Applications/Databases
%description devel
Mongo (from "huMONGOus") is a schema-free document-oriented database.
This package provides the mongo static library and header files needed
to develop mongo client software.
%prep
%setup
%build
#scons --prefix=$RPM_BUILD_ROOT/usr all
# XXX really should have shared library here
%install
#scons --prefix=$RPM_BUILD_ROOT/usr install
mkdir -p $RPM_BUILD_ROOT/usr
cp -rv @@BINARYDIR@@/usr/bin $RPM_BUILD_ROOT/usr
mkdir -p $RPM_BUILD_ROOT/usr/share/man/man1
cp debian/*.1 $RPM_BUILD_ROOT/usr/share/man/man1/
# FIXME: remove this rm when mongosniff is back in the package
rm -v $RPM_BUILD_ROOT/usr/share/man/man1/mongosniff.1*
mkdir -p $RPM_BUILD_ROOT/etc/rc.d/init.d
cp -v rpm/init.d-mongod $RPM_BUILD_ROOT/etc/rc.d/init.d/mongod
chmod a+x $RPM_BUILD_ROOT/etc/rc.d/init.d/mongod
mkdir -p $RPM_BUILD_ROOT/etc
cp -v rpm/mongod.conf $RPM_BUILD_ROOT/etc/mongod.conf
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
cp -v rpm/mongod.sysconfig $RPM_BUILD_ROOT/etc/sysconfig/mongod
mkdir -p $RPM_BUILD_ROOT/var/lib/mongo
mkdir -p $RPM_BUILD_ROOT/var/log/mongo
touch $RPM_BUILD_ROOT/var/log/mongo/mongod.log
%clean
#scons -c
rm -rf $RPM_BUILD_ROOT
%pre server
if ! /usr/bin/id -g mongod &>/dev/null; then
/usr/sbin/groupadd -r mongod
fi
if ! /usr/bin/id mongod &>/dev/null; then
/usr/sbin/useradd -M -r -g mongod -d /var/lib/mongo -s /bin/false \
-c mongod mongod > /dev/null 2>&1
fi
%post server
if test $1 = 1
then
/sbin/chkconfig --add mongod
fi
%preun server
if test $1 = 0
then
/sbin/chkconfig --del mongod
fi
%postun server
if test $1 -ge 1
then
/sbin/service mongod condrestart >/dev/null 2>&1 || :
fi
%files
%defattr(-,root,root,-)
#%doc README GNU-AGPL-3.0.txt
%{_bindir}/bsondump
%{_bindir}/mongo
%{_bindir}/mongodump
%{_bindir}/mongoexport
#@@VERSION!=2.1.0@@%{_bindir}/mongofiles
%{_bindir}/mongoimport
#@@VERSION>=2.1.0@@%{_bindir}/mongooplog
#@@VERSION>=2.1.0@@%{_bindir}/mongoperf
%{_bindir}/mongorestore
#@@VERSION>1.9@@%{_bindir}/mongotop
%{_bindir}/mongostat
# FIXME: uncomment when mongosniff is back in the package
#%{_bindir}/mongosniff
# FIXME: uncomment this when there's a stable release whose source
# tree contains a bsondump man page.
#@@VERSION>1.9@@%{_mandir}/man1/bsondump.1*
%{_mandir}/man1/mongo.1*
%{_mandir}/man1/mongodump.1*
%{_mandir}/man1/mongoexport.1*
%{_mandir}/man1/mongofiles.1*
%{_mandir}/man1/mongoimport.1*
%{_mandir}/man1/mongorestore.1*
%{_mandir}/man1/mongostat.1*
# FIXME: uncomment when mongosniff is back in the package
#%{_mandir}/man1/mongosniff.1*
#@@VERSION>=2.4.0@@%{_mandir}/man1/mongotop.1*
#@@VERSION>=2.4.0@@%{_mandir}/man1/mongoperf.1*
#@@VERSION>=2.4.0@@%{_mandir}/man1/mongooplog.1*
%files server
%defattr(-,root,root,-)
%config(noreplace) /etc/mongod.conf
%{_bindir}/mongod
%{_bindir}/mongos
%{_mandir}/man1/mongod.1*
%{_mandir}/man1/mongos.1*
/etc/rc.d/init.d/mongod
/etc/sysconfig/mongod
#/etc/rc.d/init.d/mongos
%attr(0755,mongod,mongod) %dir /var/lib/mongo
%attr(0755,mongod,mongod) %dir /var/log/mongo
%attr(0640,mongod,mongod) %config(noreplace) %verify(not md5 size mtime) /var/log/mongo/mongod.log
%changelog
* Thu Jan 28 2010 Richard M Kreuter <richard@10gen.com>
- Minor fixes.
* Sat Oct 24 2009 Joe Miklojcik <jmiklojcik@shopwiki.com> -
- Wrote mongo.spec.
"""
suffix=spec.suffix()
s=re.sub("@@PACKAGE_BASENAME@@", "mongo%s" % suffix, s)
s=re.sub("@@PACKAGE_VERSION@@", spec.pversion(Distro("redhat")), s)
# FIXME, maybe: the RPM guide says that Release numbers ought to
# be integers starting at 1, but we use "mongodb_1{%dist}",
# whatever the hell that means.
s=re.sub("@@PACKAGE_REVISION@@", str(int(spec.param("revision"))+1) if spec.param("revision") else "1", s)
s=re.sub("@@BINARYDIR@@", BINARYDIR, s)
conflict_suffixes=["", "-10gen", "-10gen-unstable", "-10gen-enterprise"]
conflict_suffixes = [suff for suff in conflict_suffixes if suff != spec.suffix()]
s=re.sub("@@PACKAGE_CONFLICTS@@", ", ".join(["mongo"+suffix for suffix in conflict_suffixes] + [ "mongo18"+suffix for suffix in conflict_suffixes] + ["mongo20"+suffix for suffix in conflict_suffixes]), s)
if suffix.endswith("-10gen"):
s=re.sub("@@PACKAGE_PROVIDES@@", "mongo-stable", s)
s=re.sub("@@PACKAGE_OBSOLETES@@", "mongo-stable", s)
elif suffix == "-10gen-unstable":
s=re.sub("@@PACKAGE_PROVIDES@@", "mongo-unstable", s)
s=re.sub("@@PACKAGE_OBSOLETES@@", "mongo-unstable", s)
elif suffix == "-10gen-enterprise":
s=re.sub("@@PACKAGE_PROVIDES@@", "mongo-enterprise", s)
s=re.sub("@@PACKAGE_OBSOLETES@@", "mongo-enterprise", s)
else:
raise Exception("BUG: unknown suffix %s" % suffix)
lines=[]
for line in s.split("\n"):
m = re.search("@@VERSION(>|>=|!=)(\d.*)@@(.*)", line)
if m:
op = m.group(1)
ver = m.group(2)
fn = m.group(3)
if op == '>':
if spec.version_better_than(ver):
lines.append(fn)
elif op == '>=':
if spec.version() == ver or spec.version_better_than(ver):
lines.append(fn)
elif op == '!=':
if spec.version() != ver:
lines.append(fn)
else:
# Since we're inventing our own template system for RPM
# specfiles here, we oughtn't use template syntax we don't
# support.
raise Exception("BUG: probable bug in packager script: %s, %s, %s" % (m.group(1), m.group(2), m.group(3)))
else:
lines.append(line)
s="\n".join(lines)
f=open(path, 'w')
try:
f.write(s)
finally:
f.close()
if __name__ == "__main__":
main(sys.argv)

View File

@ -924,6 +924,9 @@ fi
%{_mandir}/man1/mongostat.1*
# FIXME: uncomment when mongosniff is back in the package
#%{_mandir}/man1/mongosniff.1*
#@@VERSION>=2.4.0@@%{_mandir}/man1/mongotop.1*
#@@VERSION>=2.4.0@@%{_mandir}/man1/mongoperf.1*
#@@VERSION>=2.4.0@@%{_mandir}/man1/mongooplog.1*
%files server
%defattr(-,root,root,-)

View File

@ -359,9 +359,6 @@ def skipTest(path):
if small_oplog: # For tests running in parallel
if basename in ["cursor8.js", "indexh.js", "dropdb.js", "connections_opened.js", "opcounters.js"]:
return True
if os.sys.platform == "sunos5":
if basename == "geo_update_btree.js":
return True
if auth or keyFile: # For tests running with auth
# Skip any tests that run with auth explicitly
if parentDir == "auth" or "auth" in basename:
@ -386,7 +383,8 @@ def skipTest(path):
("jstests", "bench_test1.js"),
("jstests", "bench_test2.js"),
("jstests", "bench_test3.js"),
("jstests", "drop2.js") # SERVER-8589
("jstests", "drop2.js"), # SERVER-8589
("jstests", "killop.js") # SERVER-10128
]
if os.path.join(parentDir,basename) in [ os.path.join(*test) for test in authTestsToSkip ]:
@ -447,11 +445,14 @@ def runTest(test):
else:
keyFileData = None
mongo_test_filename = os.path.basename(path)
if 'sharedclient' in path:
mongo_test_filename += "-sharedclient"
# sys.stdout.write() is more atomic than print, so using it prevents
# lines being interrupted by, e.g., child processes
sys.stdout.write(" *******************************************\n")
sys.stdout.write(" Test : %s ...\n" % os.path.basename(path))
sys.stdout.write(" Test : %s ...\n" % mongo_test_filename)
sys.stdout.flush()
# FIXME: we don't handle the case where the subprocess
@ -485,7 +486,7 @@ def runTest(test):
sys.stdout.write(" Date : %s\n" % datetime.now().ctime())
sys.stdout.flush()
os.environ['MONGO_TEST_FILENAME'] = os.path.basename(path)
os.environ['MONGO_TEST_FILENAME'] = mongo_test_filename
t1 = time.time()
r = call(buildlogger(argv), cwd=test_path)
t2 = time.time()
@ -690,6 +691,14 @@ def expand_suites(suites,expandUseDB=True):
paths = ["firstExample", "secondExample", "whereExample", "authTest", "clientTest", "httpClientTest"]
if os.sys.platform == "win32":
paths = [path + '.exe' for path in paths]
if not test_path:
# If we are testing 'in-tree', then add any files of the same name from the
# sharedclient directory. The out of tree client build doesn't have shared clients.
scpaths = ["sharedclient/" + path for path in paths]
scfiles = glob.glob("sharedclient/*")
paths += [scfile for scfile in scfiles if scfile in scpaths]
# hack
tests += [(test_path and path or os.path.join(mongo_repo, path), False) for path in paths]
elif suite == 'mongosTest':

142
debian/bsondump.1 vendored
View File

@ -1,30 +1,128 @@
.TH BSONDUMP "1" "March 2011" "10gen" "MongoDB Database"
.TH "BSONDUMP" "1" "March 14, 2013" "2.2.3" "mongodb-manual"
.SH NAME
bsondump \- print BSON documents as JSON
.SH DESCRIPTION
usage: bsondump [options] <bson filename>
options:
bsondump \- MongoDB BSON utility
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
The \fI\%bsondump\fP converts \fIBSON\fP files into human\-readable
formats, including \fIJSON\fP. For example, \fI\%bsondump\fP is useful
for reading the output files generated by \fBmongodump\fP.
.SH OPTIONS
.INDENT 0.0
.TP
\fB\-\-help\fR
produce help message
.B bsondump
.UNINDENT
.INDENT 0.0
.TP
.B \-\-help
Returns a basic help and usage text.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-verbose, \-v
Increases the amount of internal reporting returned on the command
line. Increase the verbosity with the \fB\-v\fP form by including
the option multiple times, (e.g. \fB\-vvvvv\fP.)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-version
show version information
Returns the version of the \fI\%bsondump\fP utility.
.UNINDENT
.INDENT 0.0
.TP
\fB\-v\fR [ \fB\-\-verbose\fR ]
be more verbose (include multiple times for more
verbosity e.g. \fB\-vvvvv\fR)
.B \-\-objcheck
Validates each \fIBSON\fP object before outputting it in
\fIJSON\fP format. By default, \fI\%bsondump\fP enables
\fI\%--objcheck\fP by default. For objects with a high degree of
sub\-document nesting, \fI\%--objcheck\fP can have a small impact
on performance. You can set \fI\%--noobjcheck\fP to disable
object checking.
.sp
Changed in version 2.4: MongoDB enables \fI\%--objcheck\fP by default, to prevent any
client from inserting malformed or invalid BSON into a MongoDB
database.
.UNINDENT
.INDENT 0.0
.TP
\fB\-\-objcheck\fR
validate object before inserting
.B \-\-noobjcheck
New in version 2.4.
.sp
Disables the default document validation that \fI\%bsondump\fP
performs on all BSON documents.
.UNINDENT
.INDENT 0.0
.TP
\fB\-\-filter\fR arg
filter to apply before inserting
.B \-\-filter \(aq<JSON>\(aq
Limits the documents that \fI\%bsondump\fP exports to only those
documents that match the \fIJSON document\fP specified as
\fB\(aq<JSON>\(aq\fP. Be sure to include the document in single quotes to
avoid interaction with your system\(aqs shell environment.
.UNINDENT
.INDENT 0.0
.TP
\fB\-\-type\fR arg (=json)
type of output: json,debug
.SH "COPYRIGHT"
.PP
Copyright 2011 10gen
.SH "SEE ALSO"
For more information, please refer to the bsondump page in the MongoDB manual, available at http://dochub.mongodb.org/core/bsondumpmanpage
.B \-\-type <=json|=debug>
Changes the operation of \fI\%bsondump\fP from outputting "\fIJSON\fP" (the
default) to a debugging format.
.UNINDENT
.INDENT 0.0
.TP
.B <bsonfilename>
The final argument to \fI\%bsondump\fP is a document containing
\fIBSON\fP. This data is typically generated by
\fBmongodump\fP or by MongoDB in a \fIrollback\fP operation.
.UNINDENT
.SH USAGE
.sp
By default, \fI\%bsondump\fP outputs data to standard output. To
create corresponding \fIJSON\fP files, you will need to use the
shell redirect. See the following command:
.sp
.nf
.ft C
bsondump collection.bson > collection.json
.ft P
.fi
.sp
Use the following command (at the system shell) to produce debugging
output for a \fIBSON\fP file:
.sp
.nf
.ft C
bsondump \-\-type=debug collection.bson
.ft P
.fi
.SH AUTHOR
MongoDB Documentation Project
.SH COPYRIGHT
2011-2013, 10gen, Inc.
.\" Generated by docutils manpage writer.
.

12
debian/changelog vendored
View File

@ -1,3 +1,15 @@
mongodb (2.4.0) unstable; urgency=low
* see http://docs.mongodb.org/manual/release-notes/2.4/
-- Richard Kreuter <richard@10gen.com> Fri, 15 Mar 2013 16:56:28 -0500
mongodb (2.2.0) unstable; urgency=low
* see http://docs.mongodb.org/manual/release-notes/2.2/
-- Richard Kreuter <richard@10gen.com> Wed, 29 Aug 2012 16:56:28 -0500
mongodb (2.1.2) unstable; urgency=low
* see http://jira.mongodb.org/browse/SERVER/fixforversion/10894

7
debian/init.d vendored
View File

@ -68,9 +68,11 @@ fi
NUMACTL_ARGS="--interleave=all"
if which numactl >/dev/null 2>/dev/null && numactl $NUMACTL_ARGS ls / >/dev/null 2>/dev/null
then
NUMACTL="numactl $NUMACTL_ARGS"
NUMACTL="`which numactl` -- $NUMACTL_ARGS"
DAEMON_OPTS=${DAEMON_OPTS:-"--config $CONF"}
else
NUMACTL=""
DAEMON_OPTS="-- "${DAEMON_OPTS:-"--config $CONF"}
fi
if test ! -x $DAEMON; then
@ -91,7 +93,6 @@ DIETIME=10 # Time to wait for the server to die, in seconds
# 'restart' will not work
DAEMONUSER=${DAEMONUSER:-mongodb}
DAEMON_OPTS=${DAEMON_OPTS:-"--config $CONF"}
set -e
@ -122,7 +123,7 @@ start_server() {
# Start the process using the wrapper
start-stop-daemon --background --start --quiet --pidfile $PIDFILE \
--make-pidfile --chuid $DAEMONUSER \
--exec $NUMACTL $DAEMON -- $DAEMON_OPTS
--exec $NUMACTL $DAEMON $DAEMON_OPTS
errcode=$?
return $errcode
}

727
debian/mongo.1 vendored
View File

@ -1,76 +1,681 @@
.TH MONGO "1" "June 2009" "10gen" "Mongo Database"
.SH "NAME"
mongo \- the Mongo command\-line tool
.SH "SYNOPSIS"
\fBmongo [\fIOPTIONS\fR] [\fIDB_ADDRESS\fR] [\fIFILE+\fR]\fR
.SH "DESCRIPTION"
.PP
\fBmongo\fR
is a JavaScript shell (with GNU
readline
capabilities). It supports interactive and non\-interactive use. When used interactively, JavaScript can be used to query the database or perform any other function normally available with SpiderMonkey. Database output is displayed in JSON format.
.PP
If JavaScript files are specified on the command line, the shell will run non\-interactively, running each one in sequence and then exiting.
.SH "EXAMPLES"
.TH "MONGO" "1" "March 14, 2013" "2.2.3" "mongodb-manual"
.SH NAME
mongo \- MongoDB Shell
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.\" Man page generated from reStructuredText.
.
.SH DESCRIPTION
.sp
\fI\%mongo\fP is an interactive JavaScript shell interface to
MongoDB, which provides a powerful interface for systems
administrators as well as a way for developers to test queries and
operations directly with the database. \fI\%mongo\fP also provides
a fully functional JavaScript environment for use with a MongoDB. This
document addresses the basic invocation of the \fI\%mongo\fP shell
and an overview of its usage.
.SH SYNOPSIS
.INDENT 0.0
.TP
.B mongo
start the shell, connecting to the server at localhost:27017 and using the test database
.TP
.B mongo foo
start the shell using the foo database at localhost:27017
.TP
.B mongo 192.169.0.5/foo
start the shell using the foo database at 192.169.0.5:27017
.TP
.B mongo 192.169.0.5:9999/foo
start the shell using the foo database at 192.169.0.5:9999
.TP
.B mongo script1.js script2.js script3.js
run three scripts and exit
.SH "OPTIONS"
.B mongo [\-\-shell] [\-\-nodb] [\-\-norc] [\-\-quiet] [\-\-port <port>] [\-\-host <host>] [\-\-eval <JavaScript>] [\-u <username>] [\-\-username <username>] [\-p <password>] [\-\-password <password>] [\-\-help] [\-h] [\-\-version] [\-\-verbose] [\-\-ipv6] [database] [file.js]
.UNINDENT
.SH INTERFACE
.SS Options
.INDENT 0.0
.TP
.B \-\-shell
run the shell after executing files
Enables the shell interface after evaluating a \fIJavaScript\fP file.
If you invoke the \fI\%mongo\fP command and specify a JavaScript
file as an argument, or use \fI\%--eval\fP to specify
JavaScript on the command line, the \fI\%--shell\fP option
provides the user with a shell prompt after the file finishes
executing.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-help
show usage information
.B \-\-nodb
Prevents the shell from connecting to any database instances. Later,
to connect to a database within the shell, see
\fImongo\-shell\-new\-connections\fP.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-host HOST
server to connect to (default HOST=localhost)
.TP
.B \-\-port PORT
port to connect to (default PORT=27017)
.TP
.B \-\-nodb
do not connect to mongod
.TP
.B \-\-eval SCRIPT
evaluate JavaScript
.TP
.B \-\-shell
run the shell after executing files
.B \-\-norc
Prevents the shell from sourcing and evaluating
\fB~/.mongorc.js\fP on start up.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-quiet
be less chatty
Silences output from the shell during the connection process.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-port <port>
Specifies the port where the \fBmongod\fP or \fBmongos\fP
instance is listening. Unless specified \fI\%mongo\fP connects
to \fBmongod\fP instances on port \fB27017\fP, which is the default
\fBmongod\fP port.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-host <hostname>
specifies the host where the \fBmongod\fP or \fBmongos\fP is running to
connect to as \fB<hostname>\fP. By default \fI\%mongo\fP will attempt
to connect to a MongoDB process running on the localhost.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-eval <javascript>
Evaluates a JavaScript expression specified as an argument to this
option. \fI\%mongo\fP does not load its own environment when evaluating
code: as a result many options of the shell environment are not
available.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-username <username>, \-u <username>
Specifies a username to authenticate to the MongoDB instance.
Use in conjunction with the
\fI\%--password\fP option to supply a password.
If you specify a username and password but the default database
or the specified database do not require authentication,
\fI\%mongo\fP will exit with an exception.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-password <password>, \-p <password>
Specifies a password to authenticate to the MongoDB instance.
Use in conjunction with the
\fI\%--username\fP option to supply a username. If you
specify a \fI\%--username\fP without the
\fI\%--password\fP option, \fI\%mongo\fP will prompt for a
password interactively, if the \fBmongod\fP or
\fBmongos\fP requires authentication.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-authenticationDatabase <dbname>
New in version 2.4.
.sp
Specifies the database that holds the user\(aqs (e.g
\fI\%--username\fP) credentials.
.sp
By default, \fI\%mongo\fP assumes that the database name specified
in the \fI\%db address\fP holds the user\(aqs
credentials, unless you specify \fI\%--authenticationDatabase\fP.
.sp
See \fBuserSource\fP,
\fB/reference/privilege\-documents\fP and
\fB/reference/user\-privileges\fP for more information about
delegated authentication in MongoDB.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-authenticationMechanism <name>
New in version 2.4.
.sp
Specifies the authentication mechanism. By default, the
authentication mechanism is \fBMONGODB\-CR\fP, which is the MongoDB
challenge/response authentication mechanism. In the MongoDB Subscriber Edition,
\fI\%mongo\fP also includes support for \fBGSSAPI\fP to handle
Kerberos authentication.
.sp
See \fB/tutorial/control\-access\-to\-mongodb\-with\-kerberos\-authentication\fP
for more information about Kerberos authentication.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-ssl
Enable connection to a \fBmongod\fP or
\fBmongos\fP that has SSL encryption.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-sslPEMKeyFile <filename>
New in version 2.4.
.IP Note
The \fI\%default distribution of MongoDB\fP does \fBnot\fP contain support
for SSL. To use SSL you can either compile MongoDB with SSL
support or use the MongoDB Subscriber Edition. See \fB/administration/ssl\fP for
more information about SSL and MongoDB.
.RE
.sp
Specifies the \fB.pem\fP file that contains both the SSL
certificate and key. Specify the file name of the \fB.pem\fP
file using relative or absolute paths
.sp
Required when using the \fI\%--ssl\fP option if the
\fBmongod\fP or \fBmongos\fP has \fBsslCAFile\fP
enabled \fIwithout\fP \fBsslWeakCertificateValidation\fP.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-sslPEMKeyPassword <value>
New in version 2.4.
.IP Note
The \fI\%default distribution of MongoDB\fP does \fBnot\fP contain support
for SSL. To use SSL you can either compile MongoDB with SSL
support or use the MongoDB Subscriber Edition. See \fB/administration/ssl\fP for
more information about SSL and MongoDB.
.RE
.sp
Specifies the password to decrypt the root certificate chain
specified by \fI\%--sslPEMKeyFile\fP.
.sp
Only required if the certificate\-key file is encrypted.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-sslCAFile <filename>
New in version 2.4.
.IP Note
The \fI\%default distribution of MongoDB\fP does \fBnot\fP contain support
for SSL. To use SSL you can either compile MongoDB with SSL
support or use the MongoDB Subscriber Edition. See \fB/administration/ssl\fP for
more information about SSL and MongoDB.
.RE
.sp
Specifies the \fB.pem\fP file that contains the certificate from
the Certificate Authority. Specify the file name of the \fB.pem\fP
file using relative or absolute paths
.UNINDENT
.INDENT 0.0
.TP
.B \-\-help, \-h
Returns a basic help and usage text.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-version
show version information
Returns the version of the shell.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-verbose
increase verbosity
Increases the verbosity of the output of the shell during the
connection process.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-ipv6
enable IPv6 support (disabled by default)
Enables IPv6 support that allows \fI\%mongo\fP to connect
to the MongoDB instance using an IPv6 network. All MongoDB programs
and processes, including \fI\%mongo\fP, disable IPv6
support by default.
.UNINDENT
.INDENT 0.0
.TP
.B \-u|\-\-username USERNAME
specify user to log in as
.B <db address>
Specifies the "database address" of the database to connect to. For
example:
.sp
.nf
.ft C
mongo admin
.ft P
.fi
.sp
The above command will connect the \fI\%mongo\fP shell to the
\fIadmin database\fP on the local machine. You may specify a
remote database instance, with the resolvable hostname or IP
address. Separate the database name from the hostname using a
\fB/\fP character. See the following examples:
.sp
.nf
.ft C
mongo mongodb1.example.net
mongo mongodb1/admin
mongo 10.8.8.10/test
.ft P
.fi
.UNINDENT
.INDENT 0.0
.TP
.B \-p|\-\-password PASSWORD
specify password of user
.SH "COPYRIGHT"
.PP
Copyright 2007\-2011 10gen
.SH "SEE ALSO"
For more information, please refer to the mongo page in the MongoDB manual, available at http://dochub.mongodb.org/core/mongomanpage
.SH "AUTHOR"
Kristina Chodorow
.B <file.js>
Specifies a JavaScript file to run and then exit.
Must be the last option specified.
Use the
\fI\%--shell\fP option to return to a shell after the file
finishes running.
.UNINDENT
.SS Files
.sp
\fB~/.dbshell\fP
.INDENT 0.0
.INDENT 3.5
\fI\%mongo\fP maintains a history of commands in the \fB.dbshell\fP
file.
.IP Note
\fI\%mongo\fP does not recorded interaction related to
authentication in the history file, including
\fBauthenticate\fP and \fBdb.addUser()\fP.
.RE
.IP Warning
Versions of Windows \fBmongo.exe\fP earlier than 2.2.0 will
save the \fI.dbshell\fP file in the \fBmongo.exe\fP working
directory.
.RE
.UNINDENT
.UNINDENT
.sp
\fB~/.mongorc.js\fP
.INDENT 0.0
.INDENT 3.5
\fI\%mongo\fP will read the \fB.mongorc.js\fP file from the home
directory of the user invoking \fI\%mongo\fP. In the file, users
can define variables, customize the \fI\%mongo\fP shell prompt,
or update information that they would like updated every time they
launch a shell. If you use the shell to evaluate a JavaScript file
or expression either on the command line with \fI\%--eval\fP or
by specifying \fI\%a .js file to mongo\fP,
\fI\%mongo\fP will read the \fB.mongorc.js\fP file \fIafter\fP the
JavaScript has finished processing.
.sp
Specify the \fI\%--norc\fP option to disable
reading \fB.mongorc.js\fP.
.UNINDENT
.UNINDENT
.sp
\fB/tmp/mongo_edit\fI<time_t>\fP.js\fP
.INDENT 0.0
.INDENT 3.5
Created by \fI\%mongo\fP when editing a file. If the file
exists \fI\%mongo\fP will append an integer from \fB1\fP to \fB10\fP to the
time value to attempt to create a unique file.
.UNINDENT
.UNINDENT
.sp
\fB%TEMP%mongo_edit\fI<time_t>\fP.js\fP
.INDENT 0.0
.INDENT 3.5
Created by \fBmongo.exe\fP on Windows when editing a file.
If the file
exists \fI\%mongo\fP will append an integer from \fB1\fP to \fB10\fP to
the time value to attempt to create a unique file.
.UNINDENT
.UNINDENT
.SS Environment
.INDENT 0.0
.TP
.B EDITOR
Specifies the path to an editor to use with the \fBedit\fP shell
command. A JavaScript variable \fBEDITOR\fP will override the value of
\fI\%EDITOR\fP.
.UNINDENT
.INDENT 0.0
.TP
.B HOME
Specifies the path to the home directory where \fI\%mongo\fP will
read the \fB.mongorc.js\fP file and write the \fB.dbshell\fP
file.
.UNINDENT
.INDENT 0.0
.TP
.B HOMEDRIVE
On Windows systems, \fI\%HOMEDRIVE\fP specifies the path the
directory where \fI\%mongo\fP will read the \fB.mongorc.js\fP
file and write the \fB.dbshell\fP file.
.UNINDENT
.INDENT 0.0
.TP
.B HOMEPATH
Specifies the Windows path to the home directory where
\fI\%mongo\fP will read the \fB.mongorc.js\fP file and write
the \fB.dbshell\fP file.
.UNINDENT
.SH KEYBOARD SHORTCUTS
.sp
The \fI\%mongo\fP shell supports the following keyboard shortcuts:
[1]
.TS
center;
|l|l|.
_
T{
\fBKeybinding\fP
T} T{
\fBFunction\fP
T}
_
T{
Up arrow
T} T{
Retrieve previous command from history
T}
_
T{
Down\-arrow
T} T{
Retrieve next command from history
T}
_
T{
Home
T} T{
Go to beginning of the line
T}
_
T{
End
T} T{
Go to end of the line
T}
_
T{
Tab
T} T{
Autocomplete method/command
T}
_
T{
Left\-arrow
T} T{
Go backward one character
T}
_
T{
Right\-arrow
T} T{
Go forward one character
T}
_
T{
Ctrl\-left\-arrow
T} T{
Go backward one word
T}
_
T{
Ctrl\-right\-arrow
T} T{
Go forward one word
T}
_
T{
Meta\-left\-arrow
T} T{
Go backward one word
T}
_
T{
Meta\-right\-arrow
T} T{
Go forward one word
T}
_
T{
Ctrl\-A
T} T{
Go to the beginning of the line
T}
_
T{
Ctrl\-B
T} T{
Go backward one character
T}
_
T{
Ctrl\-C
T} T{
Exit the \fI\%mongo\fP shell
T}
_
T{
Ctrl\-D
T} T{
Delete a char (or exit the \fI\%mongo\fP shell)
T}
_
T{
Ctrl\-E
T} T{
Go to the end of the line
T}
_
T{
Ctrl\-F
T} T{
Go forward one character
T}
_
T{
Ctrl\-G
T} T{
Abort
T}
_
T{
Ctrl\-J
T} T{
Accept/evaluate the line
T}
_
T{
Ctrl\-K
T} T{
Kill/erase the line
T}
_
T{
Ctrl\-L or type \fBcls\fP
T} T{
Clear the screen
T}
_
T{
Ctrl\-M
T} T{
Accept/evaluate the line
T}
_
T{
Ctrl\-N
T} T{
Retrieve next command from history
T}
_
T{
Ctrl\-P
T} T{
Retrieve previous command from history
T}
_
T{
Ctrl\-R
T} T{
Reverse\-search command history
T}
_
T{
Ctrl\-S
T} T{
Forward\-search command history
T}
_
T{
Ctrl\-T
T} T{
Transpose characters
T}
_
T{
Ctrl\-U
T} T{
Perform Unix line\-discard
T}
_
T{
Ctrl\-W
T} T{
Perform Unix word\-rubout
T}
_
T{
Ctrl\-Y
T} T{
Yank
T}
_
T{
Ctrl\-Z
T} T{
Suspend (job control works in linux)
T}
_
T{
Ctrl\-H
T} T{
Backward\-delete a character
T}
_
T{
Ctrl\-I
T} T{
Complete, same as Tab
T}
_
T{
Meta\-B
T} T{
Go backward one word
T}
_
T{
Meta\-C
T} T{
Capitalize word
T}
_
T{
Meta\-D
T} T{
Kill word
T}
_
T{
Meta\-F
T} T{
Go forward one word
T}
_
T{
Meta\-L
T} T{
Change word to lowercase
T}
_
T{
Meta\-U
T} T{
Change word to uppercase
T}
_
T{
Meta\-Y
T} T{
Yank\-pop
T}
_
T{
Meta\-Backspace
T} T{
Backward\-kill word
T}
_
T{
Meta\-<
T} T{
Retrieve the first command in command history
T}
_
T{
Meta\->
T} T{
Retrieve the last command in command history
T}
_
.TE
.IP [1] 5
MongoDB accommodates multiple keybinding,
Since 2.0, \fI\%mongo\fP includes support for basic emacs
keybindings.
.SH USE
.sp
Typically users invoke the shell with the \fI\%mongo\fP command at
the system prompt. Consider the following examples for other
scenarios.
.sp
To connect to a database on a remote host using authentication and a
non\-standard port, use the following form:
.sp
.nf
.ft C
mongo \-\-username <user> \-\-password <pass> \-\-hostname <host> \-\-port 28015
.ft P
.fi
.sp
Alternatively, consider the following short form:
.sp
.nf
.ft C
mongo \-u <user> \-p <pass> \-\-host <host> \-\-port 28015
.ft P
.fi
.sp
Replace \fB<user>\fP, \fB<pass>\fP, and \fB<host>\fP with the appropriate
values for your situation and substitute or omit the \fI\%--port\fP
as needed.
.sp
To execute a JavaScript file without evaluating the \fB~/.mongorc.js\fP
file before starting a shell session, use the following form:
.sp
.nf
.ft C
mongo \-\-shell \-\-norc alternate\-environment.js
.ft P
.fi
.sp
To print return a query as \fIJSON\fP, from the system prompt using
the \fI\%--eval\fP option, use the following form:
.sp
.nf
.ft C
mongo \-\-eval \(aqdb.collection.find().forEach(printjson)\(aq
.ft P
.fi
.sp
Use single quotes (e.g. \fB\(aq\fP) to enclose the JavaScript, as well as
the additional JavaScript required to generate this output.
.SH AUTHOR
MongoDB Documentation Project
.SH COPYRIGHT
2011-2013, 10gen, Inc.
.\" Generated by docutils manpage writer.
.

983
debian/mongod.1 vendored
View File

@ -1,16 +1,967 @@
.\" Documentation for the MongoDB shell
.TH MONGOD "1" "June 2009" "10gen" "Mongo Database"
.SH "NAME"
mongod \- the Mongo Daemon
.SH "SYNOPSIS"
.SH "DESCRIPTION"
.PP
\fBmongod\fR
is a core MongoDB daemon. You are not supposed to call it directly, please refer to the manual if necessary.
.SH "COPYRIGHT"
.PP
Copyright 2007\-2009 10gen
.SH "SEE ALSO"
For more information, please refer to the mongod page in the MongoDB manual, available at http://dochub.mongodb.org/core/mongodmanpage
.SH "AUTHOR"
Antonin Kral
.TH "MONGOD" "1" "March 14, 2013" "2.2.3" "mongodb-manual"
.SH NAME
mongod \- MongoDB Server
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
\fI\%mongod\fP is the primary daemon process for the MongoDB
system. It handles data requests, manages data format, and performs
background management operations.
.sp
This document provides a complete overview of all command line options
for \fI\%mongod\fP. These options are primarily useful for testing
purposes. In common operation, use the \fBconfiguration file
options\fP to control the behavior of
your database, which is fully capable of all operations described
below.
.SH OPTIONS
.INDENT 0.0
.TP
.B mongod
.UNINDENT
.INDENT 0.0
.TP
.B \-\-help, \-h
Returns a basic help and usage text.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-version
Returns the version of the \fI\%mongod\fP daemon.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-config <filename>, \-f <filename>
Specifies a configuration file, that you can use to specify
runtime\-configurations. While the options are equivalent and
accessible via the other command line arguments, the configuration
file is the preferred method for runtime configuration of
mongod. See the "\fB/reference/configuration\-options\fP" document
for more information about these options.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-verbose, \-v
Increases the amount of internal reporting returned on standard
output or in the log file specified by \fI\%--logpath\fP. Use the
\fB\-v\fP form to control the level of verbosity by including the
option multiple times, (e.g. \fB\-vvvvv\fP.)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-quiet
Runs the \fI\%mongod\fP instance in a quiet mode that attempts to limit
the amount of output. This option suppresses:
.INDENT 7.0
.IP \(bu 2
output from \fIdatabase commands\fP,
including \fBdrop\fP, \fBdropIndexes\fP,
\fBdiagLogging\fP, \fBvalidate\fP, and
\fBclean\fP.
.IP \(bu 2
replication activity.
.IP \(bu 2
connection accepted events.
.IP \(bu 2
connection closed events.
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B \-\-port <port>
Specifies a TCP port for the \fI\%mongod\fP to listen for client
connections. By default \fI\%mongod\fP listens for connections on
port 27017.
.sp
UNIX\-like systems require root privileges to use ports with numbers
lower than 1024.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-bind_ip <ip address>
The IP address that the \fI\%mongod\fP process will bind to and
listen for connections. By default \fI\%mongod\fP listens for
connections on the localhost (i.e. \fB127.0.0.1\fP address.) You may
attach \fI\%mongod\fP to any interface; however, if you attach
\fI\%mongod\fP to a publicly accessible interface ensure that
you have implemented proper authentication and/or firewall
restrictions to protect the integrity of your database.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-maxConns <number>
Specifies the maximum number of simultaneous connections that
\fI\%mongod\fP will accept. This setting will have no effect if
it is higher than your operating system\(aqs configured maximum
connection tracking threshold.
.IP Note
You cannot set \fBmaxConns\fP to a value higher
than \fI20000\fP.
.RE
.UNINDENT
.INDENT 0.0
.TP
.B \-\-objcheck
Forces the \fI\%mongod\fP to validate all requests from clients
upon receipt to ensure that clients never insert invalid documents
into the database. For objects with a high degree of sub\-document
nesting, \fI\%--objcheck\fP can have a small impact on
performance. You can set \fI\%--noobjcheck\fP to disable object
checking at run\-time.
.sp
Changed in version 2.4: MongoDB enables \fI\%--objcheck\fP by default, to prevent any
client from inserting malformed or invalid BSON into a MongoDB
database.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-noobjcheck
New in version 2.4.
.sp
Disables the default document validation that MongoDB performs on all
incoming BSON documents.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-logpath <path>
Specify a path for the log file that will hold all diagnostic
logging information.
.sp
Unless specified, \fI\%mongod\fP will output all log information
to the standard output. Additionally, unless you also specify
\fI\%--logappend\fP, the logfile will be overwritten when the
process restarts.
.IP Note
The behavior of the logging system may change in the near
future in response to the \fI\%SERVER-4499\fP case.
.RE
.UNINDENT
.INDENT 0.0
.TP
.B \-\-logappend
When specified, this option ensures that \fI\%mongod\fP appends
new entries to the end of the logfile rather than overwriting the
content of the log when the process restarts.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-syslog
New in version 2.1.0.
.sp
Sends all logging output to the host\(aqs \fIsyslog\fP system rather
than to standard output or a log file as with \fI\%--logpath\fP.
.IP Warning
You cannot use \fI\%--syslog\fP with \fI\%--logpath\fP.
.RE
.UNINDENT
.INDENT 0.0
.TP
.B \-\-pidfilepath <path>
Specify a file location to hold the "\fIPID\fP" or process ID of
the \fI\%mongod\fP process. Useful for tracking the
\fI\%mongod\fP process in combination with the \fI\%mongod --fork\fP
option.
.sp
Without a specified \fI\%--pidfilepath\fP option,
\fBmongos\fP creates no PID file.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-keyFile <file>
Specify the path to a key file to store authentication
information. This option is only useful for the connection between
replica set members.
.IP "See also"
.sp
"\fIReplica Set Security\fP"
and "\fB/administration/replica\-sets\fP."
.RE
.UNINDENT
.INDENT 0.0
.TP
.B \-\-nounixsocket
Disables listening on the UNIX socket. Unless set to false,
\fI\%mongod\fP and \fBmongos\fP provide a UNIX\-socket.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-unixSocketPrefix <path>
Specifies a path for the UNIX socket. Unless this option has a
value, \fI\%mongod\fP and \fBmongos\fP, create a socket
with the \fB/tmp\fP as a prefix.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-fork
Enables a \fIdaemon\fP mode for \fI\%mongod\fP that runs the
process to the background. This is the normal mode of operation, in
production and production\-like environments, but may \fInot\fP be
desirable for testing.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-auth
Enables database authentication for users connecting from remote
hosts. configure users via the \fBmongo shell shell\fP. If no users exist, the localhost interface
will continue to have access to the database until the you create
the first user.
.sp
See the \fBSecurity and Authentication\fP
page for more information regarding this functionality.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-cpu
Forces \fI\%mongod\fP to report the percentage of CPU time in
write lock. \fI\%mongod\fP generates output every four
seconds. MongoDB writes this data to standard output or the logfile
if using the \fBlogpath\fP option.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-dbpath <path>
Specify a directory for the \fI\%mongod\fP instance to store its
data. Typical locations include: \fB/srv/mongodb\fP,
\fB/var/lib/mongodb\fP or \fB/opt/mongodb\fP
.sp
Unless specified, \fI\%mongod\fP will look for data files in the
default \fB/data/db\fP directory. (Windows systems use the
\fB\edata\edb\fP directory.) If you installed using a package
management system. Check the \fB/etc/mongodb.conf\fP file provided by
your packages to see the configuration of the \fBdbpath\fP.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-diaglog <value>
Creates a very verbose, \fIdiagnostic log\fP for troubleshooting
and recording various errors. MongoDB writes these log files in the
\fBdbpath\fP directory in a series of files that begin with
the string \fBdiaglog\fP and end with the initiation time of the
logging as a hex string.
.sp
The specified value configures the level of verbosity. Possible
values, and their impact are as follows.
.TS
center;
|l|l|.
_
T{
\fBValue\fP
T} T{
\fBSetting\fP
T}
_
T{
0
T} T{
off. No logging.
T}
_
T{
1
T} T{
Log write operations.
T}
_
T{
2
T} T{
Log read operations.
T}
_
T{
3
T} T{
Log both read and write operations.
T}
_
T{
7
T} T{
Log write and some read operations.
T}
_
.TE
.sp
You can use the \fBmongosniff\fP tool to replay this output
for investigation. Given a typical diaglog file, located at
\fB/data/db/diaglog.4f76a58c\fP, you might use a command in the
following form to read these files:
.sp
.nf
.ft C
mongosniff \-\-source DIAGLOG /data/db/diaglog.4f76a58c
.ft P
.fi
.sp
\fI\%--diaglog\fP is for internal use and not intended for most
users.
.IP Warning
Setting the diagnostic level to \fB0\fP will cause \fI\%mongod\fP
to stop writing data to the \fIdiagnostic log\fP file. However,
the \fI\%mongod\fP instance will continue to keep the file open,
even if it is no longer writing data to the file. If you want to
rename, move, or delete the diagnostic log you must cleanly shut
down the \fI\%mongod\fP instance before doing so.
.RE
.UNINDENT
.INDENT 0.0
.TP
.B \-\-directoryperdb
Alters the storage pattern of the data directory to store each
database\(aqs files in a distinct folder. This option will create
directories within the \fI\%--dbpath\fP named for each directory.
.sp
Use this option in conjunction with your file system and device
configuration so that MongoDB will store data on a number of
distinct disk devices to increase write throughput or disk
capacity.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-journal
Enables operation journaling to ensure write durability and data
consistency. \fI\%mongod\fP enables journaling by default on
64\-bit builds of versions after 2.0.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-journalOptions <arguments>
Provides functionality for testing. Not for general use, and may
affect database integrity.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-journalCommitInterval <value>
Specifies the maximum amount of time for \fI\%mongod\fP to allow
between journal operations. The default value is 100 milliseconds,
while possible values range from 2 to 300 milliseconds. Lower
values increase the durability of the journal, at the expense of
disk performance.
.sp
To force \fI\%mongod\fP to commit to the journal more frequently,
you can specify \fBj:true\fP. When a write operation with \fBj:true\fP
pending, \fI\%mongod\fP will reduce
\fBjournalCommitInterval\fP to a third of the set value.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-ipv6
Specify this option to enable IPv6 support. This will allow clients
to connect to \fI\%mongod\fP using IPv6
networks. \fI\%mongod\fP disables IPv6 support by default in
\fI\%mongod\fP and all utilities.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-jsonp
Permits \fIJSONP\fP access via an HTTP interface. Consider the
security implications of allowing this activity before enabling
this option.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-noauth
Disable authentication. Currently the default. Exists for future
compatibility and clarity.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-nohttpinterface
Disables the HTTP interface.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-nojournal
Disables the durability journaling. By default, \fI\%mongod\fP
enables journaling in 64\-bit versions after v2.0.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-noprealloc
Disables the preallocation of data files. This will shorten the
start up time in some cases, but can cause significant performance
penalties during normal operations.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-noscripting
Disables the scripting engine.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-notablescan
Forbids operations that require a table scan.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-nssize <value>
Specifies the default size for namespace files (i.e \fB.ns\fP). This
option has no impact on the size of existing namespace files. The
maximum size is 2047 megabytes.
.sp
The default value is 16 megabytes; this provides for approximately
24,000 namespaces. Each collection, as well as each index, counts as
a namespace.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-profile <level>
Changes the level of database profiling, which inserts information
about operation performance into output of \fI\%mongod\fP or the log
file. The following levels are available:
.TS
center;
|l|l|.
_
T{
\fBLevel\fP
T} T{
\fBSetting\fP
T}
_
T{
0
T} T{
Off. No profiling.
T}
_
T{
1
T} T{
On. Only includes slow operations.
T}
_
T{
2
T} T{
On. Includes all operations.
T}
_
.TE
.sp
Profiling is off by default. Database profiling can impact database
performance. Enable this option only after careful consideration.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-quota
Enables a maximum limit for the number data files each database can
have. When running with \fI\%--quota\fP, there are a maximum of
8 data files per database. Adjust the quota with the
\fI\%--quotaFiles\fP option.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-quotaFiles <number>
Modify limit on the number of data files per database. This option
requires the \fI\%--quota\fP setting. The default value for
\fI\%--quotaFiles\fP is 8.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-rest
Enables the simple \fIREST\fP API.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-repair
Runs a repair routine on all databases. This is equivalent
to shutting down and running the \fBrepairDatabase\fP database
command on all databases.
.IP Warning
In general, if you have an intact copy of your data, such as
would exist on a very recent backup or an intact member of a
\fIreplica set\fP, \fBdo not\fP use \fBrepairDatabase\fP
or related options like \fBdb.repairDatabase()\fP in the
\fBmongo\fP shell or \fI\%mongod --repair\fP. Restore
from an intact copy of your data.
.RE
.IP Note
When using \fIjournaling\fP, there is almost never
any need to run \fBrepairDatabase\fP. In the event of an
unclean shutdown, the server will be able restore the data files
to a pristine state automatically.
.RE
.sp
Changed in version 2.1.2.
.sp
If you run the repair option \fIand\fP have data in a journal file,
\fI\%mongod\fP will refuse to start. In these cases you should
start \fI\%mongod\fP without the \fI\%--repair\fP option to
allow \fI\%mongod\fP to recover data from the journal. This will
complete more quickly and will result in a more consistent and
complete data set.
.sp
To continue the repair operation despite the journal files, shut down
\fI\%mongod\fP cleanly and restart with the \fI\%--repair\fP
option.
.IP Note
\fI\%--repair\fP copies data from the source data files into
new data files in the \fBrepairpath\fP, and then replaces
the original data files with the repaired data files. \fIIf\fP
\fBrepairpath\fP is on the same device as
\fBdbpath\fP, you \fImay\fP interrupt a \fI\%mongod\fP
running \fI\%--repair\fP without affecting the integrity of
the data set.
.RE
.UNINDENT
.INDENT 0.0
.TP
.B \-\-repairpath <path>
Specifies the root directory containing MongoDB data files, to use
for the \fI\%--repair\fP operation. Defaults to a \fB_tmp\fP
directory within the \fBdbpath\fP.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-setParameter <options>
New in version 2.4.
.sp
Specifies an option to configure on startup. Specify multiple
options with multiple \fI\%--setParameter\fP options. See
\fB/reference/parameters\fP for full documentation of these
parameters. The \fBsetParameter\fP database command provides
access to many of these parameters. \fI\%--setParameter\fP supports the
following options:
.INDENT 7.0
.IP \(bu 2
\fBenableLocalhostAuthBypass\fP
.IP \(bu 2
\fBenableTestCommands\fP
.IP \(bu 2
\fBjournalCommitInterval\fP
.IP \(bu 2
\fBlogLevel\fP
.IP \(bu 2
\fBlogUserIds\fP
.IP \(bu 2
\fBnotablescan\fP
.IP \(bu 2
\fBquiet\fP
.IP \(bu 2
\fBreplApplyBatchSize\fP
.IP \(bu 2
\fBreplIndexPrefetch\fP
.IP \(bu 2
\fBsupportCompatibilityFormPrivilegeDocuments\fP
.IP \(bu 2
\fBsyncdelay\fP
.IP \(bu 2
\fBtraceExceptions\fP
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B \-\-slowms <value>
Defines the value of "slow," for the \fI\%--profile\fP
option. The database logs all slow queries to the log, even when
the profiler is not turned on. When the database profiler is on,
\fI\%mongod\fP the profiler writes to the \fBsystem.profile\fP
collection. See the \fBprofile\fP command for more information on the
database profiler.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-smallfiles
Enables a mode where MongoDB uses a smaller default file
size. Specifically, \fI\%--smallfiles\fP reduces the initial
size for data files and limits them to 512
megabytes. \fI\%--smallfiles\fP also reduces the size of each
\fIjournal\fP files from 1 gigabyte to 128 megabytes.
.sp
Use \fI\%--smallfiles\fP if you have a large number of databases
that each holds a small quantity of data. \fI\%--smallfiles\fP can
lead your \fI\%mongod\fP to create a large number of files,
which may affect performance for larger databases.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-shutdown
Used in \fIcontrol scripts\fP, the
\fI\%--shutdown\fP will cleanly and safely terminate the
\fI\%mongod\fP process. When invoking \fI\%mongod\fP with this
option you must set the \fI\%--dbpath\fP option either directly
or by way of the \fBconfiguration file\fP and the \fI\%--config\fP
option.
.sp
\fI\%--shutdown\fP is only available on Linux systems.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-syncdelay <value>
\fI\%mongod\fP writes data very quickly to the journal, and
lazily to the data files. \fI\%--syncdelay\fP controls how much
time can pass before MongoDB flushes data to the \fIdatabase files\fP
via an \fIfsync\fP operation. The default setting is 60 seconds.
In almost every situation you should not set this value and use the
default setting.
.sp
The \fBserverStatus\fP command reports the background flush
thread\(aqs status via the \fBbackgroundFlushing\fP
field.
.sp
\fBsyncdelay\fP has no effect on the \fBjournal\fP
files or \fBjournaling\fP.
.IP Warning
If you set \fI\%--syncdelay\fP to \fB0\fP, MongoDB will not
sync the memory mapped files to disk. Do not set this value on
production systems.
.RE
.UNINDENT
.INDENT 0.0
.TP
.B \-\-sysinfo
Returns diagnostic system information and then exits. The
information provides the page size, the number of physical pages,
and the number of available physical pages.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-upgrade
Upgrades the on\-disk data format of the files specified by the
\fI\%--dbpath\fP to the latest version, if needed.
.sp
This option only affects the operation of \fI\%mongod\fP if the
data files are in an old format.
.IP Note
In most cases you should \fBnot\fP set this value, so you can
exercise the most control over your upgrade process. See the MongoDB
\fI\%release notes\fP (on the
download page) for more information about the upgrade process.
.RE
.UNINDENT
.INDENT 0.0
.TP
.B \-\-traceExceptions
For internal diagnostic use only.
.UNINDENT
.SS Replication Options
.INDENT 0.0
.TP
.B \-\-replSet <setname>
Use this option to configure replication with replica sets. Specify
a setname as an argument to this set. All hosts must have the same
set name.
.IP "See also"
.sp
"\fB/replication\fP,"
"\fB/administration/replica\-sets\fP," and
"\fB/reference/replica\-configuration\fP"
.RE
.UNINDENT
.INDENT 0.0
.TP
.B \-\-oplogSize <value>
Specifies a maximum size in megabytes for the replication operation
log (e.g. \fIoplog\fP.) By \fI\%mongod\fP creates an
\fIoplog\fP based on the maximum amount of space available. For
64\-bit systems, the op log is typically 5% of available disk space.
.sp
Once the \fI\%mongod\fP has created the oplog for the first
time, changing \fI\%--oplogSize\fP will not affect the size of
the oplog.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-fastsync
In the context of \fIreplica set\fP replication, set this option
if you have seeded this member with a snapshot of the
\fIdbpath\fP of another member of the set. Otherwise the
\fI\%mongod\fP will attempt to perform an initial sync,
as though the member were a new member.
.IP Warning
If the data is not perfectly synchronized \fIand\fP
\fI\%mongod\fP starts with \fBfastsync\fP, then the
secondary or slave will be permanently out of sync with the
primary, which may cause significant consistency problems.
.RE
.UNINDENT
.INDENT 0.0
.TP
.B \-\-replIndexPrefetch
New in version 2.2.
.sp
You must use \fI\%--replIndexPrefetch\fP in conjunction with
\fBreplSet\fP. The default value is \fBall\fP and available
options are:
.INDENT 7.0
.IP \(bu 2
\fBnone\fP
.IP \(bu 2
\fBall\fP
.IP \(bu 2
\fB_id_only\fP
.UNINDENT
.sp
By default \fIsecondary\fP members of a \fIreplica set\fP will
load all indexes related to an operation into memory before
applying operations from the oplog. You can modify this behavior so
that the secondaries will only load the \fB_id\fP index. Specify
\fB_id_only\fP or \fBnone\fP to prevent the \fI\%mongod\fP from
loading \fIany\fP index into memory.
.UNINDENT
.SS Master\-Slave Replication
.sp
These options provide access to conventional master\-slave database
replication. While this functionality remains accessible in MongoDB,
replica sets are the preferred configuration for database replication.
.INDENT 0.0
.TP
.B \-\-master
Configures \fI\%mongod\fP to run as a replication
\fImaster\fP.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-slave
Configures \fI\%mongod\fP to run as a replication
\fIslave\fP.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-source <host><:port>
For use with the \fI\%--slave\fP option, the \fB\-\-source\fP option
designates the server that this instance will replicate.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-only <arg>
For use with the \fI\%--slave\fP option, the \fB\-\-only\fP option
specifies only a single \fIdatabase\fP to replicate.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-slavedelay <value>
For use with the \fI\%--slave\fP option, the \fB\-\-slavedelay\fP
option configures a "delay" in seconds, for this slave to wait to
apply operations from the \fImaster\fP node.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-autoresync
For use with the \fI\%--slave\fP option, the
\fI\%--autoresync\fP option allows this slave to automatically
resync if the local data is more than 10 seconds behind the
master. This option may be problematic if the \fIoplog\fP is too
small (controlled by the \fI\%--oplogSize\fP option.) If the
\fIoplog\fP not large enough to store the difference in changes
between the master\(aqs current state and the state of the slave, this
node will forcibly resync itself unnecessarily. When you set the If
the \fI\%--autoresync\fP option the slave will not attempt an
automatic resync more than once in a ten minute period.
.UNINDENT
.SS Sharding Cluster Options
.INDENT 0.0
.TP
.B \-\-configsvr
Declares that this \fI\%mongod\fP instance serves as the
\fIconfig database\fP of a sharded cluster. When running with
this option, clients will not be able to write data to any database
other than \fBconfig\fP and \fBadmin\fP. The default port for
\fI\%mongod\fP with this option is \fB27019\fP and
\fI\%mongod\fP writes all data files to the \fB/configdb\fP
sub\-directory of the \fI\%--dbpath\fP directory.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-shardsvr
Configures this \fI\%mongod\fP instance as a shard in a
partitioned cluster. The default port for these instances is
\fB27018\fP. The only effect of \fI\%--shardsvr\fP is to change
the port number.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-noMoveParanoia
Disables a "paranoid mode" for data writes for chunk migration
operation. See the
\fIchunk migration\fP
and \fBmoveChunk\fP command documentation for more information.
.sp
By default \fI\%mongod\fP will save copies of migrated chunks on
the "from" server during migrations as "paranoid mode." Setting
this option disables this paranoia.
.UNINDENT
.SS SSL Options
.IP "See"
.sp
\fB/administration/ssl\fP for full documentation of
MongoDB\(aqs support.
.RE
.INDENT 0.0
.TP
.B \-\-sslOnNormalPorts
New in version 2.2.
.IP Note
The \fI\%default distribution of MongoDB\fP does \fBnot\fP contain support
for SSL. To use SSL you can either compile MongoDB with SSL
support or use the MongoDB Subscriber Edition. See \fB/administration/ssl\fP for
more information about SSL and MongoDB.
.RE
.sp
Enables SSL for \fI\%mongod\fP. With \fI\%--sslOnNormalPorts\fP,
a \fI\%mongod\fP requires SSL encryption for all connections on the
default MongoDB port, or the port specified by \fI\%--port\fP. By
default, \fI\%--sslOnNormalPorts\fP is disabled.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-sslPEMKeyFile <filename>
New in version 2.2.
.IP Note
The \fI\%default distribution of MongoDB\fP does \fBnot\fP contain support
for SSL. To use SSL you can either compile MongoDB with SSL
support or use the MongoDB Subscriber Edition. See \fB/administration/ssl\fP for
more information about SSL and MongoDB.
.RE
.sp
Specifies the \fB.pem\fP file that contains both the SSL
certificate and key. Specify the file name of the \fB.pem\fP
file using relative or absolute paths
.sp
When using \fI\%--sslOnNormalPorts\fP, you must specify
\fI\%--sslPEMKeyFile\fP.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-sslPEMKeyPassword <value>
New in version 2.2.
.IP Note
The \fI\%default distribution of MongoDB\fP does \fBnot\fP contain support
for SSL. To use SSL you can either compile MongoDB with SSL
support or use the MongoDB Subscriber Edition. See \fB/administration/ssl\fP for
more information about SSL and MongoDB.
.RE
.sp
Specifies the password to de\-crypt the certificate\-key file
(i.e. \fI\%--sslPEMKeyFile\fP). Only use
\fI\%--sslPEMKeyPassword\fP if the certificate\-key file is
encrypted. In all cases, \fI\%mongod\fP will redact the password from
all logging and reporting output.
.sp
Changed in version 2.4: \fI\%--sslPEMKeyPassword\fP is only needed when the private
key is encrypted. In earlier versions \fI\%mongod\fP would require
\fI\%--sslPEMKeyPassword\fP whenever using
\fI\%--sslOnNormalPorts\fP, even when the private key was not
encrypted.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-sslCAFile <filename>
New in version 2.4.
.IP Note
The \fI\%default distribution of MongoDB\fP does \fBnot\fP contain support
for SSL. To use SSL you can either compile MongoDB with SSL
support or use the MongoDB Subscriber Edition. See \fB/administration/ssl\fP for
more information about SSL and MongoDB.
.RE
.sp
Specifies the \fB.pem\fP file that contains the root certificate
chain from the Certificate Authority. Specify the file name of the \fB.pem\fP
file using relative or absolute paths
.UNINDENT
.INDENT 0.0
.TP
.B \-\-sslCRLFile <filename>
New in version 2.4.
.IP Note
The \fI\%default distribution of MongoDB\fP does \fBnot\fP contain support
for SSL. To use SSL you can either compile MongoDB with SSL
support or use the MongoDB Subscriber Edition. See \fB/administration/ssl\fP for
more information about SSL and MongoDB.
.RE
.sp
Specifies the \fB.pem\fP file that contains the Certificate
Revocation List. Specify the file name of the \fB.pem\fP
file using relative or absolute paths
.UNINDENT
.INDENT 0.0
.TP
.B \-\-sslWeakCertificateValidation
New in version 2.4.
.IP Note
The \fI\%default distribution of MongoDB\fP does \fBnot\fP contain support
for SSL. To use SSL you can either compile MongoDB with SSL
support or use the MongoDB Subscriber Edition. See \fB/administration/ssl\fP for
more information about SSL and MongoDB.
.RE
.sp
Disables the requirement for SSL certificate validation, that
\fI\%--sslCAFile\fP enables. With
\fI\%--sslWeakCertificateValidation\fP, \fI\%mongod\fP will accept
connections if the client does not present a certificate when
establishing the connection.
.sp
If the client presents a certificate and \fI\%mongod\fP has
\fI\%--sslWeakCertificateValidation\fP enabled, \fI\%mongod\fP
will validate the certificate using the root certificate chain
specified by \fI\%--sslCAFile\fP, and reject clients with invalid
certificates.
.sp
Use \fI\%--sslWeakCertificateValidation\fP if you have a mixed
deployment that includes clients that do not or cannot present
certificates to \fI\%mongod\fP.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-sslFIPSMode
New in version 2.4.
.IP Note
The \fI\%default distribution of MongoDB\fP does \fBnot\fP contain support
for SSL. To use SSL you can either compile MongoDB with SSL
support or use the MongoDB Subscriber Edition. See \fB/administration/ssl\fP for
more information about SSL and MongoDB.
.RE
.sp
When specified, \fI\%mongod\fP will use the FIPS mode of the
installed OpenSSL library. Your system must have a FIPS compliant
OpenSSL library to use \fI\%--sslFIPSMode\fP.
.UNINDENT
.SH USAGE
.sp
In common usage, the invocation of \fI\%mongod\fP will resemble the
following in the context of an initialization or control script:
.sp
.nf
.ft C
mongod \-\-config /etc/mongodb.conf
.ft P
.fi
.sp
See the "\fB/reference/configuration\-options\fP" for more information
on how to configure \fI\%mongod\fP using the configuration file.
.SH AUTHOR
MongoDB Documentation Project
.SH COPYRIGHT
2011-2013, 10gen, Inc.
.\" Generated by docutils manpage writer.
.

375
debian/mongodump.1 vendored
View File

@ -1,62 +1,355 @@
.TH MONGODUMP "1" "June 2009" "10gen" "Mongo Database"
.SH "NAME"
mongodump \- the Mongo dump tool
.SH "SYNOPSIS"
\fBmongodump [\fIOPTIONS\fR]\fR
.SH "DESCRIPTION"
.PP
\fBmongodump\fR
is a tool to output a binary representation of a database. It is mostly used for doing hot backups of a database.
.SH "OPTIONS"
.TH "MONGODUMP" "1" "March 14, 2013" "2.2.3" "mongodb-manual"
.SH NAME
mongodump \- MongoDB
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
\fI\%mongodump\fP is a utility for creating a binary export of the
contents of a database. Consider using this utility as part an
effective \fBbackup strategy\fP. Use in
conjunction with \fBmongorestore\fP to provide restore
functionality.
.IP Note
The format of data created by \fI\%mongodump\fP tool from the
2.2 distribution or later is different and incompatible with
earlier versions of \fBmongod\fP.
.RE
.IP "See also"
.sp
"\fBmongorestore\fP" and "\fB/administration/backups\fP".
.RE
.SH OPTIONS
.INDENT 0.0
.TP
.B mongodump
.UNINDENT
.INDENT 0.0
.TP
.B \-\-help
show usage information
Returns a basic help and usage text.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-verbose, \-v
Increases the amount of internal reporting returned on the command
line. Increase the verbosity with the \fB\-v\fP form by including the
option multiple times, (e.g. \fB\-vvvvv\fP.)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-version
show version information
Returns the version of the \fI\%mongodump\fP utility and exits.
.UNINDENT
.INDENT 0.0
.TP
.B \-h, \-\-host HOST
server to connect to (default HOST=localhost)
.B \-\-host <hostname><:port>
Specifies a resolvable hostname for the \fBmongod\fP that you wish to
use to create the database dump. By default \fI\%mongodump\fP will
attempt to connect to a MongoDB process ruining on the localhost
port number \fB27017\fP.
.sp
Optionally, specify a port number to connect a MongoDB instance
running on a port other than \fB27017\fP.
.sp
To connect to a replica set, use the \fI\%--host\fP
argument with a setname, followed by a slash and a comma\-separated
list of host names and port numbers. The \fI\%mongodump\fP
utility will, given the seed of at least one connected set member,
connect to the primary member of that set. This option would resemble:
.sp
.nf
.ft C
mongodump \-\-host repl0/mongo0.example.net,mongo0.example.net:27018,mongo1.example.net,mongo2.example.net
.ft P
.fi
.sp
You can always connect directly to a single MongoDB instance by
specifying the host and port number directly.
.UNINDENT
.INDENT 0.0
.TP
.B\-\-port arg
server port. Can also use \-\-host hostname:port
.B \-\-port <port>
Specifies the port number, if the MongoDB instance is not running
on the standard port. (i.e. \fB27017\fP) You may also specify a port
number using the \fI\%--host\fP option.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-ipv6
enable IPv6 support (disabled by default)
Enables IPv6 support that allows \fI\%mongodump\fP to connect to
the MongoDB instance using an IPv6 network. All MongoDB programs
and processes, including \fI\%mongodump\fP, disable IPv6 support
by default.
.UNINDENT
.INDENT 0.0
.TP
.B \-u|\-\-username USERNAME
specify user to log in as
.B \-\-ssl
New in version 2.4: MongoDB added support for SSL connections to \fBmongod\fP
instances in mongodump.
.IP Note
SSL support in mongodump is not compiled into the default
distribution of MongoDB. See \fB/administration/ssl\fP for more
information on SSL and MongoDB.
.sp
Additionally, mongodump does not support connections to
\fBmongod\fP instances that require client certificate
validation.
.RE
.sp
Allows \fI\%mongodump\fP to connect to \fBmongod\fP
instance over an SSL connection.
.UNINDENT
.INDENT 0.0
.TP
.B \-p|\-\-password PASSWORD
specify password of user (notice there is no space)
.B \-\-username <username>, \-u <username>
Specifies a username to authenticate to the MongoDB instance, if
your database requires authentication. Use in conjunction with the
\fI\%--password\fP option to supply a
password.
.UNINDENT
.INDENT 0.0
.TP
.B \-d, \-\-db DATABASE
database to use
.B \-\-password <password>, \-p <password>
Specifies a password to authenticate to the MongoDB instance. Use
in conjunction with the \fI\%--username\fP
option to supply a username.
.sp
If you specify a \fI\%--username\fP
without the \fI\%--password\fP option, \fI\%mongodump\fP will
prompt for a password interactively.
.UNINDENT
.INDENT 0.0
.TP
.B \-c, \-\-c COLLECTION
collection to use
.B \-\-authenticationDatabase <dbname>
New in version 2.4.
.sp
Specifies the database that holds the user\(aqs (e.g
\fI\%--username\fP) credentials.
.sp
By default, \fI\%mongodump\fP assumes that the database specified to the
\fI\%--db\fP argument holds the user\(aqs credentials, unless you
specify \fI\%--authenticationDatabase\fP.
.sp
See \fBuserSource\fP,
\fB/reference/privilege\-documents\fP and
\fB/reference/user\-privileges\fP for more information about
delegated authentication in MongoDB.
.UNINDENT
.INDENT 0.0
.TP
.B \-o, \-\-out DIRECTORY
output directory or - for stdout.
.B \-\-authenticationMechanism <name>
New in version 2.4.
.sp
Specifies the authentication mechanism. By default, the
authentication mechanism is \fBMONGODB\-CR\fP, which is the MongoDB
challenge/response authentication mechanism. In the MongoDB Subscriber Edition,
\fI\%mongodump\fP also includes support for \fBGSSAPI\fP to handle
Kerberos authentication.
.sp
See \fB/tutorial/control\-access\-to\-mongodb\-with\-kerberos\-authentication\fP
for more information about Kerberos authentication.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-dbpath PATH
directly access mongod data files in this path, instead of connecting to a mongod instance
.B \-\-dbpath <path>
Specifies the directory of the MongoDB data files. If used, the
\fI\%--dbpath\fP option enables \fI\%mongodump\fP to attach
directly to local data files and copy the data without the
\fBmongod\fP. To run with \fI\%--dbpath\fP,
\fI\%mongodump\fP needs to restrict access to the data
directory: as a result, no \fBmongod\fP can access the same
path while the process runs.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-directoryperdb
if dbpath specified, each db is in a separate directory
Use the \fI\%--directoryperdb\fP in conjunction with the
corresponding option to \fBmongod\fP. This option allows
\fI\%mongodump\fP to read data files organized with each
database located in a distinct directory. This option is only
relevant when specifying the \fI\%--dbpath\fP option.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-query
JSON query filter
.B \-\-journal
Allows \fI\%mongodump\fP operations to use the durability
\fIjournal\fP to ensure that the export is in a
consistent state. This option is only relevant when specifying the
\fI\%--dbpath\fP option.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-db <db>, \-d <db>
Use the \fI\%--db\fP option to specify a database for
\fI\%mongodump\fP to backup. If you do not specify a DB,
\fI\%mongodump\fP copies all databases in this instance into the
dump files. Use this option to backup or copy a smaller subset of
your data.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-collection <collection>, \-c <collection>
Use the \fI\%--collection\fP option to specify a collection for
\fI\%mongodump\fP to backup. If you do not specify a collection,
this option copies all collections in the specified database or
instance to the dump files. Use this option to backup or copy a
smaller subset of your data.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-out <path>, \-o <path>
Specifies a path where \fI\%mongodump\fP and store the output
the database dump. To output the database dump to standard output,
specify a \fB\-\fP rather than a path.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-query <json>, \-q <json>
Provides a query to limit (optionally) the documents included in
the output of \fI\%mongodump\fP.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-oplog
Use oplog for point-in-time snapshotting
Use this option to ensure that \fI\%mongodump\fP creates a dump
of the database that includes an \fIoplog\fP, to create a
point\-in\-time snapshot of the state of a \fBmongod\fP instance. To
restore to a specific point\-in\-time backup, use the output created
with this option in conjunction with \fImongorestore \-\-oplogReplay\fP.
.sp
Without \fI\%--oplog\fP, if there are write operations during the
dump operation, the dump will not reflect a single moment in
time. Changes made to the database during the update process can
affect the output of the backup.
.sp
\fI\%--oplog\fP has no effect when running \fI\%mongodump\fP
against a \fBmongos\fP instance to dump the entire contents of
a sharded cluster. However, you can use \fI\%--oplog\fP to dump
individual shards.
.IP Note
\fI\%--oplog\fP only works against nodes that maintain a
\fIoplog\fP. This includes all members of a replica set, as
well as \fImaster\fP nodes in master/slave replication
deployments.
.RE
.UNINDENT
.INDENT 0.0
.TP
.B \-\-repair
try to recover a crashed database (needs \-\-dbpath)
.SH "COPYRIGHT"
.PP
Copyright 2007\-2011 10gen
.SH "SEE ALSO"
For more information, please refer to the mongodump page in the MongoDB manual, available at http://dochub.mongodb.org/core/mongodumpmanpage
.SH "AUTHOR"
Kristina Chodorow
Use this option to run a repair option in addition to dumping the
database. The repair option attempts to repair a database that may
be in an inconsistent state as a result of an improper shutdown or
\fBmongod\fP crash.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-forceTableScan
Forces \fI\%mongodump\fP to scan the data store directly:
typically, \fI\%mongodump\fP saves entries as they appear in the
index of the \fB_id\fP field. Use \fI\%--forceTableScan\fP to skip
the index and scan the data directly. Typically there are two cases
where this behavior is preferable to the default:
.INDENT 7.0
.IP 1. 3
If you have key sizes over 800 bytes that would not be present
in the \fB_id\fP index.
.IP 2. 3
Your database uses a custom \fB_id\fP field.
.UNINDENT
.sp
When you run with \fI\%--forceTableScan\fP, \fI\%mongodump\fP
does not use \fB$snapshot\fP. As a result, the dump produced
by \fI\%mongodump\fP can reflect the state of the database at
many different points in time.
.IP Warning
Use \fI\%--forceTableScan\fP with extreme caution
and consideration.
.RE
.IP Warning
Changed in version 2.2: When used in combination with \fBfsync\fP or
\fBdb.fsyncLock()\fP, \fBmongod\fP may block some
reads, including those from \fI\%mongodump\fP, when
queued write operation waits behind the \fBfsync\fP
lock.
.RE
.UNINDENT
.SH BEHAVIOR
.sp
When running \fI\%mongodump\fP against a \fBmongos\fP instance
where the \fIsharded cluster\fP consists of \fIreplica sets\fP, the \fIread preference\fP of the operation will prefer reads
from \fIsecondary\fP members of the set.
.SH USAGE
.sp
See the \fB/tutorial/backup\-databases\-with\-binary\-database\-dumps\fP
for a larger overview of \fI\%mongodump\fP usage. Also see the
"\fBmongorestore\fP" document for an overview of the
\fBmongorestore\fP, which provides the related inverse
functionality.
.sp
The following command, creates a dump file that contains only the
collection named \fBcollection\fP in the database named \fBtest\fP. In
this case the database is running on the local interface on port
\fB27017\fP:
.sp
.nf
.ft C
mongodump \-\-collection collection \-\-db test
.ft P
.fi
.sp
In the next example, \fI\%mongodump\fP creates a backup of the
database instance stored in the \fB/srv/mongodb\fP directory on the
local machine. This requires that no \fBmongod\fP instance is
using the \fB/srv/mongodb\fP directory.
.sp
.nf
.ft C
mongodump \-\-dbpath /srv/mongodb
.ft P
.fi
.sp
In the final example, \fI\%mongodump\fP creates a database dump
located at \fB/opt/backup/mongodump\-2011\-10\-24\fP, from a database
running on port \fB37017\fP on the host \fBmongodb1.example.net\fP and
authenticating using the username \fBuser\fP and the password
\fBpass\fP, as follows:
.sp
.nf
.ft C
mongodump \-\-host mongodb1.example.net \-\-port 37017 \-\-username user \-\-password pass /opt/backup/mongodump\-2011\-10\-24
.ft P
.fi
.SH AUTHOR
MongoDB Documentation Project
.SH COPYRIGHT
2011-2013, 10gen, Inc.
.\" Generated by docutils manpage writer.
.

382
debian/mongoexport.1 vendored
View File

@ -1,75 +1,351 @@
.TH MONGOEXPORT "1" "June 2009" "10gen" "Mongo Database"
.SH "NAME"
mongoexport \- the Mongo export tool
.SH "SYNOPSIS"
\fBmongoexport [\fIOPTIONS\fR]\fR
.SH "DESCRIPTION"
.PP
\fBmongoexport\fR
is a tool to export a MongoDB collection to either JSON or CSV. The query can be filtered or a list of fields to output can be given.
.PP
If the output is CSV, the fields must be specified in order.
.SH "EXAMPLES"
.TH "MONGOEXPORT" "1" "March 14, 2013" "2.2.3" "mongodb-manual"
.SH NAME
mongoexport \- MongoDB
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
\fI\%mongoexport\fP is a utility that produces a JSON or CSV export
of data stored in a MongoDB instance. See the
"\fB/administration/import\-export\fP" document for a more in depth
usage overview, and the "\fBmongoimport\fP" document for more
information regarding the \fBmongoimport\fP utility, which
provides the inverse "importing" capability.
.IP Note
Do not use \fBmongoimport\fP and \fI\%mongoexport\fP for
full\-scale backups because they may not reliably capture data type
information. Use \fBmongodump\fP and \fBmongorestore\fP as
described in "\fB/administration/backups\fP" for this kind of
functionality.
.RE
.SH OPTIONS
.INDENT 0.0
.TP
.B mongoexport -d test -c test1 --csv -f "name,num"
export documents from test.test1 in CSV format
.SH "OPTIONS"
.B mongoexport
.UNINDENT
.INDENT 0.0
.TP
.B \-\-help
show usage information
Returns a basic help and usage text.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-verbose, \-v
Increases the amount of internal reporting returned on the command
line. Increase the verbosity with the \fB\-v\fP form by including
the option multiple times, (e.g. \fB\-vvvvv\fP.)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-version
show version information
Returns the version of the \fI\%mongoexport\fP utility.
.UNINDENT
.INDENT 0.0
.TP
.B \-v, \-\-verbose
be more verbose (include multiple times for more verbosity
e.g. \-vvvvv)
.B \-\-host <hostname><:port>
Specifies a resolvable hostname for the \fBmongod\fP from which you
want to export data. By default \fI\%mongoexport\fP attempts to
connect to a MongoDB process ruining on the localhost port number
\fB27017\fP.
.sp
Optionally, specify a port number to connect a MongoDB instance
running on a port other than \fB27017\fP.
.sp
To connect to a replica set, you can specify the replica set seed
name, and a seed list of set members, in the following format:
.sp
.nf
.ft C
<replica_set_name>/<hostname1><:port>,<hostname2:<port>,...
.ft P
.fi
.UNINDENT
.INDENT 0.0
.TP
.B \-h, \-\-host HOST
server to connect to (default HOST=localhost)
.TP
.B\-\-port arg
server port. Can also use \-\-host hostname:port
.B \-\-port <port>
Specifies the port number, if the MongoDB instance is not running on
the standard port. (i.e. \fB27017\fP) You may also specify a port
number using the \fI\%mongoexport --host\fP command.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-ipv6
enable IPv6 support (disabled by default)
Enables IPv6 support that allows \fI\%mongoexport\fP to connect
to the MongoDB instance using an IPv6 network. All MongoDB programs
and processes, including \fI\%mongoexport\fP, disable IPv6
support by default.
.UNINDENT
.INDENT 0.0
.TP
.B \-u|\-\-username USERNAME
specify user to log in as
.B \-\-ssl
New in version 2.4: MongoDB added support for SSL connections to \fBmongod\fP
instances in mongoexport.
.IP Note
SSL support in mongoexport is not compiled into the default
distribution of MongoDB. See \fB/administration/ssl\fP for more
information on SSL and MongoDB.
.sp
Additionally, mongoexport does not support connections to
\fBmongod\fP instances that require client certificate
validation.
.RE
.sp
Allows \fI\%mongoexport\fP to connect to \fBmongod\fP
instance over an SSL connection.
.UNINDENT
.INDENT 0.0
.TP
.B \-p|\-\-password PASSWORD
specify password of user
.B \-\-username <username>, \-u <username>
Specifies a username to authenticate to the MongoDB instance, if your
database requires authentication. Use in conjunction with the
\fI\%mongoexport --password\fP option to supply a password.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-dbpath PATH
directly access mongod data files in this path, instead of connecting to a mongod instance
.B \-\-password <password>, \-p <password>
Specifies a password to authenticate to the MongoDB instance. Use
in conjunction with the \fI\%--username\fP
option to supply a username.
.sp
If you specify a \fI\%--username\fP
without the \fI\%--password\fP option, \fI\%mongoexport\fP
will prompt for a password interactively.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-authenticationDatabase <dbname>
New in version 2.4.
.sp
Specifies the database that holds the user\(aqs (e.g
\fI\%--username\fP) credentials.
.sp
By default, \fI\%mongoexport\fP assumes that the database specified to the
\fI\%--db\fP argument holds the user\(aqs credentials, unless you
specify \fI\%--authenticationDatabase\fP.
.sp
See \fBuserSource\fP,
\fB/reference/privilege\-documents\fP and
\fB/reference/user\-privileges\fP for more information about
delegated authentication in MongoDB.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-authenticationMechanism <name>
New in version 2.4.
.sp
Specifies the authentication mechanism. By default, the
authentication mechanism is \fBMONGODB\-CR\fP, which is the MongoDB
challenge/response authentication mechanism. In the MongoDB Subscriber Edition,
\fI\%mongoexport\fP also includes support for \fBGSSAPI\fP to handle
Kerberos authentication.
.sp
See \fB/tutorial/control\-access\-to\-mongodb\-with\-kerberos\-authentication\fP
for more information about Kerberos authentication.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-dbpath <path>
Specifies the directory of the MongoDB data files. If used, the
\fB\-\-dbpath\fP option enables \fI\%mongoexport\fP to attach
directly to local data files and insert the data without the
\fBmongod\fP. To run with \fB\-\-dbpath\fP, \fI\%mongoexport\fP
needs to lock access to the data directory: as a result, no
\fBmongod\fP can access the same path while the process runs.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-directoryperdb
if dbpath specified, each db is in a separate directory
Use the \fI\%--directoryperdb\fP in conjunction with the
corresponding option to \fBmongod\fP, which allows
\fI\%mongoexport\fP to export data into MongoDB instances that
have every database\(aqs files saved in discrete directories on the
disk. This option is only relevant when specifying the
\fI\%--dbpath\fP option.
.UNINDENT
.INDENT 0.0
.TP
.B \-d, \-\-db DATABASE
database to use
.B \-\-journal
Allows \fI\%mongoexport\fP operations to access the durability
\fIjournal\fP to ensure that the export is in a
consistent state. This option is only relevant when specifying the
\fI\%--dbpath\fP option.
.UNINDENT
.INDENT 0.0
.TP
.B \-c, \-\-c COLLECTION
collection to use
.B \-\-db <db>, \-d <db>
Use the \fI\%--db\fP option to specify the name of the database
that contains the collection you want to export.
.UNINDENT
.INDENT 0.0
.TP
.B \-f, \-\-fields FIELDS
comma\-separated list of field names
.B \-\-collection <collection>, \-c <collection>
Use the \fI\%--collection\fP option to specify the collection
that you want \fI\%mongoexport\fP to export.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-fieldFile FILE
file with fields names \- 1 per line
.B \-\-fields <field1[,field2]>, \-f <field1[,field2]>
Specify a field or number fields to \fIinclude\fP in the export. All
other fields will be \fIexcluded\fP from the export. Comma separate a
list of fields to limit the fields exported.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-query
JSON query filter
.B \-\-fieldFile <file>
As an alternative to "\fI\%--fields\fP"
the \fI\%--fieldFile\fP option allows you to specify a file
(e.g. \fB<file>\(ga\fP) to hold a list of field names to specify a list
of fields to \fIinclude\fP in the export. All other fields will be
\fIexcluded\fP from the export. Place one field per line.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-query <JSON>
Provides a \fIJSON document\fP as a query that optionally limits
the documents returned in the export.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-csv
export to CSV instead of JSON
Changes the export format to a comma separated values (CSV)
format. By default \fI\%mongoexport\fP writes data using one
\fIJSON\fP document for every MongoDB document.
.UNINDENT
.INDENT 0.0
.TP
.B \-o, \-\-out FILE
output file, if not specified, stdout is used
.SH "COPYRIGHT"
.PP
Copyright 2007\-2011 10gen
.SH "SEE ALSO"
For more information, please refer to the mongoexport page in the MongoDB manual, available at http://dochub.mongodb.org/core/mongoexportmanpage
.SH "AUTHOR"
Kristina Chodorow
.B \-\-jsonArray
Modifies the output of \fI\%mongoexport\fP to write the
entire contents of the export as a single \fIJSON\fP array. By
default \fI\%mongoexport\fP writes data using one JSON document
for every MongoDB document.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-slaveOk, \-k
Allows \fI\%mongoexport\fP to read data from secondary or slave
nodes when using \fI\%mongoexport\fP with a replica set. This
option is only available if connected to a \fBmongod\fP or
\fBmongos\fP and is not available when used with the
"\fI\%mongoexport --dbpath\fP" option.
.sp
This is the default behavior.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-out <file>, \-o <file>
Specify a file to write the export to. If you do not specify a file
name, the \fI\%mongoexport\fP writes data to standard output
(e.g. \fBstdout\fP).
.UNINDENT
.INDENT 0.0
.TP
.B \-\-forceTableScan
New in version 2.2.
.sp
Forces \fI\%mongoexport\fP to scan the data store directly:
typically, \fI\%mongoexport\fP saves entries as they appear in the
index of the \fB_id\fP field. Use \fI\%--forceTableScan\fP to skip
the index and scan the data directly. Typically there are two cases
where this behavior is preferable to the default:
.INDENT 7.0
.IP 1. 3
If you have key sizes over 800 bytes that would not be present
in the \fB_id\fP index.
.IP 2. 3
Your database uses a custom \fB_id\fP field.
.UNINDENT
.sp
When you run with \fI\%--forceTableScan\fP, \fI\%mongoexport\fP
does not use \fB$snapshot\fP. As a result, the export produced
by \fI\%mongoexport\fP can reflect the state of the database at
many different points in time.
.IP Warning
Use \fI\%--forceTableScan\fP with extreme caution
and consideration.
.RE
.UNINDENT
.SH USAGE
.sp
In the following example, \fI\%mongoexport\fP exports the
collection \fBcontacts\fP from the \fBusers\fP database from the
\fBmongod\fP instance running on the localhost port
number \fB27017\fP. This command writes the export data in \fICSV\fP
format into a file located at \fB/opt/backups/contacts.csv\fP.
.sp
.nf
.ft C
mongoexport \-\-db users \-\-collection contacts \-\-csv \-\-out /opt/backups/contacts.csv
.ft P
.fi
.sp
The next example creates an export of the collection \fBcontacts\fP
from the MongoDB instance running on the localhost port number \fB27017\fP,
with journaling explicitly enabled. This writes the export to the
\fBcontacts.json\fP file in \fIJSON\fP format.
.sp
.nf
.ft C
mongoexport \-\-db sales \-\-collection contacts \-\-out contacts.json \-\-journal
.ft P
.fi
.sp
The following example exports the collection \fBcontacts\fP from the
\fBsales\fP database located in the MongoDB data files located at
\fB/srv/mongodb/\fP. This operation writes the export to standard output
in \fIJSON\fP format.
.sp
.nf
.ft C
mongoexport \-\-db sales \-\-collection contacts \-\-dbpath /srv/mongodb/
.ft P
.fi
.IP Warning
The above example will only succeed if there is no \fBmongod\fP
connected to the data files located in the \fB/srv/mongodb/\fP
directory.
.RE
.sp
The final example exports the collection \fBcontacts\fP from the
database \fBmarketing\fP . This data resides on the MongoDB instance
located on the host \fBmongodb1.example.net\fP running on port
\fB37017\fP, which requires the username \fBuser\fP and the password
\fBpass\fP.
.sp
.nf
.ft C
mongoexport \-\-host mongodb1.example.net \-\-port 37017 \-\-username user \-\-password pass \-\-collection contacts \-\-db marketing \-\-out mdb1\-examplenet.json
.ft P
.fi
.SH AUTHOR
MongoDB Documentation Project
.SH COPYRIGHT
2011-2013, 10gen, Inc.
.\" Generated by docutils manpage writer.
.

411
debian/mongofiles.1 vendored
View File

@ -1,94 +1,365 @@
.TH MONGOFILES "1" "June 2009" "10gen" "Mongo Database"
.SH "NAME"
mongofiles \- a simple GridFS interface
.SH "SYNOPSIS"
\fBmongofiles [\fIOPTIONS\fR] \fICOMMAND\fR \fIFILENAME\fR\fR
.SH "DESCRIPTION"
.PP
\fBmongofiles\fR
is used to list, get, and insert files in the database.
.TH "MONGOFILES" "1" "March 14, 2013" "2.2.3" "mongodb-manual"
.SH NAME
mongofiles \- MongoDB
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
The \fI\%mongofiles\fP utility makes it possible to manipulate files
stored in your MongoDB instance in \fIGridFS\fP objects from the
command line. It is particularly useful as it provides an interface
between objects stored in your file system and GridFS.
.sp
All \fI\%mongofiles\fP commands take arguments in three groups:
.INDENT 0.0
.IP 1. 3
\fI\%Options\fP. You may use one or more of
these options to control the behavior of \fI\%mongofiles\fP.
.IP 2. 3
\fI\%Commands\fP. Use one of these commands to
determine the action of \fI\%mongofiles\fP.
.IP 3. 3
A file name representing either the name of a file on your system\(aqs
file system, a GridFS object.
.UNINDENT
.sp
\fI\%mongofiles\fP, like \fBmongodump\fP, \fBmongoexport\fP,
\fBmongoimport\fP, and \fBmongorestore\fP, can access data
stored in a MongoDB data directory without requiring a running
\fBmongod\fP instance, if no other \fBmongod\fP is running.
.IP Note
For \fIreplica sets\fP, \fI\%mongofiles\fP can
only read from the set\(aqs \(aq\fIprimary\fP.
.RE
.SH COMMANDS
.INDENT 0.0
.TP
Commands:
.B mongofiles
.UNINDENT
.INDENT 0.0
.TP
.B list
list all files. FILENAME is an optional prefix which listed filenames
must begin with.
.B list <prefix>
Lists the files in the GridFS store. The characters specified after
\fBlist\fP (e.g. \fB<prefix>\fP) optionally limit the list of
returned items to files that begin with that string of characters.
.UNINDENT
.INDENT 0.0
.TP
.B search
search all files. FILENAME is a substring which listed
filenames must contain.
.B search <string>
Lists the files in the GridFS store with names that match any
portion of \fB<string>\fP.
.UNINDENT
.INDENT 0.0
.TP
.B put
add a file with filename FILENAME
.B put <filename>
Copy the specified file from the local file system into GridFS
storage.
.sp
Here, \fB<filename>\fP refers to the name the object will have in
GridFS, and \fI\%mongofiles\fP assumes that this reflects the name the
file has on the local file system. If the local filename is
different use the \fI\%mongofiles --local\fP option.
.UNINDENT
.INDENT 0.0
.TP
.B get
get a file with filename FILENAME
.B get <filename>
Copy the specified file from GridFS storage to the local file
system.
.sp
Here, \fB<filename>\fP refers to the name the object will have in
GridFS, and \fI\%mongofiles\fP assumes that this reflects the name the
file has on the local file system. If the local filename is
different use the \fI\%mongofiles --local\fP option.
.UNINDENT
.INDENT 0.0
.TP
.B delete
delete all files with filename FILENAME
.SH "EXAMPLES"
.TP
.B mongofiles list
lists files in test.fs.files
.TP
.B mongofiles put README.txt
inserts the file README.txt into the collection test.fs.files
.TP
.B mongofiles get photo.jpg
retrieves photo.jpg from test.fs.files and saves it locally
.SH "OPTIONS"
.B delete <filename>
Delete the specified file from GridFS storage.
.UNINDENT
.SH OPTIONS
.INDENT 0.0
.TP
.B \-\-help
show usage information
Returns a basic help and usage text.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-verbose, \-v
Increases the amount of internal reporting returned on the command
line. Increase the verbosity with the \fB\-v\fP form by including
the option multiple times, (e.g. \fB\-vvvvv\fP.)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-version
show version information
Returns the version of the \fI\%mongofiles\fP utility.
.UNINDENT
.INDENT 0.0
.TP
.B \-v, \-\-verbose
be more verbose (include multiple times for more verbosity
e.g. \-vvvvv)
.B \-\-host <hostname><:port>
Specifies a resolvable hostname for the \fBmongod\fP that
holds your GridFS system. By default \fI\%mongofiles\fP attempts
to connect to a MongoDB process ruining on the localhost port
number \fB27017\fP.
.sp
Optionally, specify a port number to connect a MongoDB instance
running on a port other than 27017.
.UNINDENT
.INDENT 0.0
.TP
.B \-h, \-\-host HOST
server to connect to (default HOST=localhost)
.TP
.B\-\-port arg
server port. Can also use \-\-host hostname:port
.B \-\-port <port>
Specifies the port number, if the MongoDB instance is not running on
the standard port. (i.e. \fB27017\fP) You may also specify a port
number using the \fI\%mongofiles --host\fP command.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-ipv6
enable IPv6 support (disabled by default)
Enables IPv6 support that allows \fI\%mongofiles\fP to connect
to the MongoDB instance using an IPv6 network. All MongoDB programs
and processes, including \fI\%mongofiles\fP, disable IPv6
support by default.
.UNINDENT
.INDENT 0.0
.TP
.B \-u|\-\-username USERNAME
specify user to log in as
.B \-\-ssl
New in version 2.4: MongoDB added support for SSL connections to \fBmongod\fP
instances in mongofiles.
.IP Note
SSL support in mongofiles is not compiled into the default
distribution of MongoDB. See \fB/administration/ssl\fP for more
information on SSL and MongoDB.
.sp
Additionally, mongofiles does not support connections to
\fBmongod\fP instances that require client certificate
validation.
.RE
.sp
Allows \fI\%mongofiles\fP to connect to \fBmongod\fP
instance over an SSL connection.
.UNINDENT
.INDENT 0.0
.TP
.B \-p|\-\-password PASSWORD
specify password of user
.B \-\-username <username>, \-u <username>
Specifies a username to authenticate to the MongoDB instance, if your
database requires authentication. Use in conjunction with the
\fI\%mongofiles --password\fP option to supply a password.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-dbpath PATH
directly access mongod data files in this path, instead of connecting to a mongod instance
.B \-\-password <password>, \-p <password>
Specifies a password to authenticate to the MongoDB instance. Use
in conjunction with the \fI\%mongofiles --username\fP option to
supply a username.
.sp
If you specify a \fI\%--username\fP
without the \fI\%--password\fP option, \fI\%mongofiles\fP
will prompt for a password interactively.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-authenticationDatabase <dbname>
New in version 2.4.
.sp
Specifies the database that holds the user\(aqs (e.g
\fI\%--username\fP) credentials.
.sp
By default, \fI\%mongofiles\fP assumes that the database specified to the
\fI\%--db\fP argument holds the user\(aqs credentials, unless you
specify \fI\%--authenticationDatabase\fP.
.sp
See \fBuserSource\fP,
\fB/reference/privilege\-documents\fP and
\fB/reference/user\-privileges\fP for more information about
delegated authentication in MongoDB.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-authenticationMechanism <name>
New in version 2.4.
.sp
Specifies the authentication mechanism. By default, the
authentication mechanism is \fBMONGODB\-CR\fP, which is the MongoDB
challenge/response authentication mechanism. In the MongoDB Subscriber Edition,
\fI\%mongofiles\fP also includes support for \fBGSSAPI\fP to handle
Kerberos authentication.
.sp
See \fB/tutorial/control\-access\-to\-mongodb\-with\-kerberos\-authentication\fP
for more information about Kerberos authentication.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-dbpath <path>
Specifies the directory of the MongoDB data files. If used, the
\fI\%--dbpath\fP option enables \fI\%mongofiles\fP to attach directly to
local data files interact with the GridFS data without the
\fBmongod\fP. To run with \fI\%--dbpath\fP, \fI\%mongofiles\fP needs to lock
access to the data directory: as a result, no \fBmongod\fP can access
the same path while the process runs.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-directoryperdb
if dbpath specified, each db is in a separate directory
Use the \fI\%--directoryperdb\fP in conjunction with the corresponding
option to \fBmongod\fP, which allows \fI\%mongofiles\fP when
running with the \fI\%--dbpath\fP option and MongoDB uses an
on\-disk format where every database has a distinct
directory. This option is only relevant when specifying the
\fI\%--dbpath\fP option.
.UNINDENT
.INDENT 0.0
.TP
.B \-d, \-\-db DATABASE
database to use
.B \-\-journal
Allows \fI\%mongofiles\fP operations to use the durability
\fIjournal\fP when running with \fI\%--dbpath\fP
to ensure that the database maintains a recoverable state. This
forces \fI\%mongofiles\fP to record all data on disk regularly.
.UNINDENT
.INDENT 0.0
.TP
.B \-c, \-\-c COLLECTION
collection to use (some commands, default COLLECTION=fs.files)
.B \-\-db <db>, \-d <db>
Use the \fI\%--db\fP option to specify the MongoDB database that stores
or will store the GridFS files.
.UNINDENT
.INDENT 0.0
.TP
.B \-l, \-\-local FILENAME
local filename for put|get (default is to use the same name as the
FILENAME)
.B \-\-collection <collection>, \-c <collection>
This option has no use in this context and a future release may
remove it. See \fI\%SERVER-4931\fP for more information.
.UNINDENT
.INDENT 0.0
.TP
.B \-t, \-\-type arg
MIME type for put (default is to omit)
.B \-\-local <filename>, \-l <filename>
Specifies the local filesystem name of a file for get and put
operations.
.sp
In the \fBmongofiles put\fP and \fBmongofiles get\fP
commands the required \fB<filename>\fP modifier refers to the name
the object will have in GridFS. \fI\%mongofiles\fP assumes that
this reflects the file\(aqs name on the local file
system. This setting overrides this default.
.UNINDENT
.INDENT 0.0
.TP
.B \-r, \-\-replace
Remove other files with the same name after PUT
.SH "COPYRIGHT"
.PP
Copyright 2007\-2011 10gen
.SH "SEE ALSO"
For more information, please refer to the mongofiles page in the MongoDB manual, available at http://dochub.mongodb.org/core/mongofilesmanpage
.SH "AUTHOR"
Kristina Chodorow
.B \-\-type <MIME>, t <MIME>
Provides the ability to specify a \fIMIME\fP type to describe the
file inserted into GridFS storage. \fI\%mongofiles\fP omits this
option in the default operation.
.sp
Use only with \fBmongofiles put\fP operations.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-replace, \-r
Alters the behavior of \fBmongofiles put\fP to replace
existing GridFS objects with the specified local file, rather than
adding an additional object with the same name.
.sp
In the default operation, files will not be overwritten by a
\fBmongofiles put\fP option.
.UNINDENT
.SH USE
.sp
To return a list of all files in a \fIGridFS\fP collection in the
\fBrecords\fP database, use the following invocation at the system shell:
.sp
.nf
.ft C
mongofiles \-d records list
.ft P
.fi
.sp
This \fI\%mongofiles\fP instance will connect to the
\fBmongod\fP instance running on the \fB27017\fP localhost
interface to specify the same operation on a different port or
hostname, and issue a command that resembles one of the following:
.sp
.nf
.ft C
mongofiles \-\-port 37017 \-d records list
mongofiles \-\-hostname db1.example.net \-d records list
mongofiles \-\-hostname db1.example.net \-\-port 37017 \-d records list
.ft P
.fi
.sp
Modify any of the following commands as needed if you\(aqre connecting
the \fBmongod\fP instances on different ports or hosts.
.sp
To upload a file named \fB32\-corinth.lp\fP to the GridFS collection in
the \fBrecords\fP database, you can use the following command:
.sp
.nf
.ft C
mongofiles \-d records put 32\-corinth.lp
.ft P
.fi
.sp
To delete the \fB32\-corinth.lp\fP file from this GridFS collection in
the \fBrecords\fP database, you can use the following command:
.sp
.nf
.ft C
mongofiles \-d records delete 32\-corinth.lp
.ft P
.fi
.sp
To search for files in the GridFS collection in the \fBrecords\fP
database that have the string \fBcorinth\fP in their names, you can use
following command:
.sp
.nf
.ft C
mongofiles \-d records search corinth
.ft P
.fi
.sp
To list all files in the GridFS collection in the \fBrecords\fP database
that begin with the string \fB32\fP, you can use the following command:
.sp
.nf
.ft C
mongofiles \-d records list 32
.ft P
.fi
.sp
To fetch the file from the GridFS collection in the \fBrecords\fP
database named \fB32\-corinth.lp\fP, you can use the following command:
.sp
.nf
.ft C
mongofiles \-d records get 32\-corinth.lp
.ft P
.fi
.SH AUTHOR
MongoDB Documentation Project
.SH COPYRIGHT
2011-2013, 10gen, Inc.
.\" Generated by docutils manpage writer.
.

407
debian/mongoimport.1 vendored
View File

@ -1,92 +1,379 @@
.TH MONGOIMPORT "1" "January 2010" "10gen" "Mongo Database"
.SH "NAME"
mongoimport \- the Mongo import tool
.SH "SYNOPSIS"
\fBmongoimport [\fIOPTIONS\fR]\fR
.SH "DESCRIPTION"
.PP
\fBmongoimport\fR
is a tool to import a MongoDB collection from JSON, CSV, or TSV. The query can be filtered or a list of fields to input can be given.
.\".SH "EXAMPLES"
.\".TP
.\".B mongoimport -d test -c test1 --csv -f "name,num"
.\"import documents from test.test1 in CSV format
.SH "OPTIONS"
.TH "MONGOIMPORT" "1" "March 14, 2013" "2.2.3" "mongodb-manual"
.SH NAME
mongoimport \- MongoDB
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
The \fI\%mongoimport\fP tool provides a route to import content from a
JSON, CSV, or TSV export created by \fBmongoexport\fP, or
potentially, another third\-party export tool. See the
"\fB/administration/import\-export\fP" document for a more in depth
usage overview, and the "\fBmongoexport\fP" document for more
information regarding \fBmongoexport\fP, which
provides the inverse "importing" capability.
.IP Note
Do not use \fI\%mongoimport\fP and \fBmongoexport\fP for
full instance, production backups because they will not reliably capture data type
information. Use \fBmongodump\fP and \fBmongorestore\fP as
described in "\fB/administration/backups\fP" for this kind of
functionality.
.RE
.SH OPTIONS
.INDENT 0.0
.TP
.B mongoimport
.UNINDENT
.INDENT 0.0
.TP
.B \-\-help
show usage information
Returns a basic help and usage text.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-verbose, \-v
Increases the amount of internal reporting returned on the command
line. Increase the verbosity with the \fB\-v\fP form by including
the option multiple times, (e.g. \fB\-vvvvv\fP.)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-version
show version information
Returns the version of the \fI\%mongoimport\fP program.
.UNINDENT
.INDENT 0.0
.TP
.B \-v, \-\-verbose
be more verbose (include multiple times for more verbosity
e.g. \-vvvvv)
.B \-\-host <hostname><:port>, \-h
Specifies a resolvable hostname for the \fBmongod\fP to which
you want to restore the database. By default \fI\%mongoimport\fP
will attempt to connect to a MongoDB process ruining on the
localhost port numbered \fB27017\fP.
.sp
Optionally, specify a port number to connect a MongoDB instance
running on a port other than \fB27017\fP.
.sp
To connect to a replica set, use the \fI\%--host\fP argument with a
setname, followed by a slash and a comma\-separated list of host and
port names. \fI\%mongoimport\fP will, given the seed of at least
one connected set member, connect to primary node of that set. This
option would resemble:
.sp
.nf
.ft C
\-\-host repl0/mongo0.example.net,mongo0.example.net:27018,mongo1.example.net,mongo2.example.net
.ft P
.fi
.sp
You can always connect directly to a single MongoDB instance by
specifying the host and port number directly.
.UNINDENT
.INDENT 0.0
.TP
.B \-h, \-\-host HOST
server to connect to (default HOST=localhost)
.TP
.B\-\-port arg
server port. Can also use \-\-host hostname:port
.B \-\-port <port>
Specifies the port number, if the MongoDB instance is not running on
the standard port. (i.e. \fB27017\fP) You may also specify a port
number using the \fI\%mongoimport --host\fP command.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-ipv6
enable IPv6 support (disabled by default)
Enables IPv6 support that allows \fI\%mongoimport\fP to connect
to the MongoDB instance using an IPv6 network. All MongoDB programs
and processes, including \fI\%mongoimport\fP, disable IPv6
support by default.
.UNINDENT
.INDENT 0.0
.TP
.B \-u|\-\-username USERNAME
specify user to log in as
.B \-\-ssl
New in version 2.4: MongoDB added support for SSL connections to \fBmongod\fP
instances in mongoimport.
.IP Note
SSL support in mongoimport is not compiled into the default
distribution of MongoDB. See \fB/administration/ssl\fP for more
information on SSL and MongoDB.
.sp
Additionally, mongoimport does not support connections to
\fBmongod\fP instances that require client certificate
validation.
.RE
.sp
Allows \fI\%mongoimport\fP to connect to \fBmongod\fP
instance over an SSL connection.
.UNINDENT
.INDENT 0.0
.TP
.B \-p|\-\-password PASSWORD
specify password of user
.B \-\-username <username>, \-u <username>
Specifies a username to authenticate to the MongoDB instance, if your
database requires authentication. Use in conjunction with the
\fI\%mongoimport --password\fP option to supply a password.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-dbpath PATH
directly access mongod data files in this path, instead of connecting to a mongod instance
.B \-\-password <password>, \-p <password>
Specifies a password to authenticate to the MongoDB instance. Use
in conjunction with the \fI\%mongoimport --username\fP option to
supply a username.
.sp
If you specify a \fI\%--username\fP
without the \fI\%--password\fP option, \fI\%mongoimport\fP
will prompt for a password interactively.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-authenticationDatabase <dbname>
New in version 2.4.
.sp
Specifies the database that holds the user\(aqs (e.g
\fI\%--username\fP) credentials.
.sp
By default, \fI\%mongoimport\fP assumes that the database specified to the
\fI\%--db\fP argument holds the user\(aqs credentials, unless you
specify \fI\%--authenticationDatabase\fP.
.sp
See \fBuserSource\fP,
\fB/reference/privilege\-documents\fP and
\fB/reference/user\-privileges\fP for more information about
delegated authentication in MongoDB.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-authenticationMechanism <name>
New in version 2.4.
.sp
Specifies the authentication mechanism. By default, the
authentication mechanism is \fBMONGODB\-CR\fP, which is the MongoDB
challenge/response authentication mechanism. In the MongoDB Subscriber Edition,
\fI\%mongoimport\fP also includes support for \fBGSSAPI\fP to handle
Kerberos authentication.
.sp
See \fB/tutorial/control\-access\-to\-mongodb\-with\-kerberos\-authentication\fP
for more information about Kerberos authentication.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-dbpath <path>
Specifies the directory of the MongoDB data files. If used, the
\fI\%--dbpath\fP option enables
\fI\%mongoimport\fP to attach directly to local data files and
insert the data without the \fBmongod\fP. To run with
\fB\-\-dbpath\fP, \fI\%mongoimport\fP needs to lock access to the
data directory: as a result, no \fBmongod\fP can access the
same path while the process runs.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-directoryperdb
if dbpath specified, each db is in a separate directory
Use the \fI\%--directoryperdb\fP in conjunction with the
corresponding option to \fBmongod\fP, which allows
\fI\%mongoimport\fP to import data into MongoDB instances that
have every database\(aqs files saved in discrete directories on the
disk. This option is only relevant when specifying the
\fI\%--dbpath\fP option.
.UNINDENT
.INDENT 0.0
.TP
.B \-d, \-\-db DATABASE
database to use
.B \-\-journal
Allows \fBmongoexport\fP write to the durability
\fIjournal\fP to ensure that the data files will remain in a
consistent state during the write process. This option is only
relevant when specifying the \fI\%--dbpath\fP option.
.UNINDENT
.INDENT 0.0
.TP
.B \-c, \-\-c COLLECTION
collection to use
.B \-\-db <db>, \-d <db>
Use the \fI\%--db\fP option to specify a database for
\fI\%mongoimport\fP to restore data. If you do not specify a
\fB<db>\fP, \fI\%mongoimport\fP creates new databases that
correspond to the databases where data originated and data may be
overwritten. Use this option to restore data into a MongoDB
instance that already has data, or to restore only some data in the
specified backup.
.UNINDENT
.INDENT 0.0
.TP
.B \-f, \-\-fields FIELDS
comma\-separated list of field names
.B \-\-collection <collection>, \-c <collection>
Use the \fI\%--collection\fP option to specify a collection for
\fBmongorestore\fP to restore. If you do not specify a
\fB<collection>\fP, \fI\%mongoimport\fP imports all collections
created. Existing data may be overwritten. Use this option to
restore data into a MongoDB instance that already has data, or to
restore only some data in the specified imported data set.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-fieldFile FILE
file with fields names \- 1 per line
.B \-\-fields <field1<,filed2>>, \-f <field1[,filed2]>
Specify a comma seperatedlist of field names when importing
\fIcsv\fP or \fItsv\fP files that do not have field names in
the first (i.e. header) line of the file.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-fieldFile <filename>
As an alternative to \fI\%--fields\fP the \fI\%--fieldFile\fP
option allows you to specify a file (e.g. \fB<file>\(ga\fP) to that
holds a list of field names if your \fIcsv\fP or \fItsv\fP
file does not include field names in the first (i.e. header) line
of the file. Place one field per line.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-ignoreBlanks
if given, empty fields in csv and tsv will be ignored
In \fIcsv\fP and \fItsv\fP exports, ignore empty fields. If not
specified, \fI\%mongoimport\fP creates fields without values in
imported documents.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-type TYPE
type of file to import. default: json (json,csv,tsv)
.B \-\-type <json|csv|tsv>
Declare the type of export format to import. The default format is
\fIJSON\fP, but it\(aqs possible to import \fIcsv\fP and
\fItsv\fP files.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-file FILE
file to import from; if not specified stdin is used
.B \-\-file <filename>
Specify the location of a file containing the data to
import. \fI\%mongoimport\fP will read data from standard input
(e.g. "stdin.") if you do not specify a file.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-drop
drop collection first
Modifies the importation procedure so that the target instance
drops every collection before restoring the collection from the
dumped backup.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-headerline
CSV,TSV only \- use first line as headers
If using "\fI\%--type csv\fP" or
"\fI\%--type tsv\fP," use the first line as
field names. Otherwise, \fI\%mongoimport\fP will import the first
line as a distinct document.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-upsert
insert or update objects that already exist
Modifies the import process to update existing objects in the
database if they match an imported object, while inserting all
other objects.
.sp
If you do not specify a field or fields using the
\fI\%--upsertFields\fP \fI\%mongoimport\fP will upsert on the
basis of the \fB_id\fP field.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-upsertFields ARG
comma-separated fields for the query part of the upsert. You should
make sure this is indexed
.B \-\-upsertFields <field1[,field2]>
Specifies a list of fields for the query portion of the
\fIupsert\fP. Use this option if the \fB_id\fP fields in the
existing documents don\(aqt match the field in the document, but
another field or field combination can uniquely identify
documents as a basis for performing upsert operations.
.sp
To ensure adequate performance, indexes should exist for this
field or fields.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-stopOnError
stop importing at first error rather than continuing
New in version 2.2.
.sp
Forces \fI\%mongoimport\fP to halt the import operation at the
first error rather than continuing the operation despite errors.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-jsonArray
load a json array, not one item per line. Currently limited to 16MB.
.SH "COPYRIGHT"
.PP
Copyright 2007\-2011 10gen
.SH "SEE ALSO"
For more information, please refer to the mongoimport page in the MongoDB manual, available at http://dochub.mongodb.org/core/mongoimportmanpage
.SH "AUTHOR"
Kristina Chodorow
Changed in version 2.2: The limit on document size increased from 4MB to 16MB.
.sp
Accept import of data expressed with multiple MongoDB document
within a single \fIJSON\fP array.
.sp
Use in conjunction with \fImongoexport \-\-jsonArray\fP to
import data written as a single \fIJSON\fP array. Limited to
imports of 16 MB or smaller.
.UNINDENT
.SH USAGE
.sp
In this example, \fI\%mongoimport\fP imports the \fIcsv\fP
formatted data in the \fB/opt/backups/contacts.csv\fP into the
collection \fBcontacts\fP in the \fBusers\fP database on the MongoDB
instance running on the localhost port numbered \fB27017\fP.
.sp
.nf
.ft C
mongoimport \-\-db users \-\-collection contacts \-\-type csv \-\-file /opt/backups/contacts.csv
.ft P
.fi
.sp
In the following example, \fI\%mongoimport\fP imports the data in
the \fIJSON\fP formatted file \fBcontacts.json\fP into the collection
\fBcontacts\fP on the MongoDB instance running on the localhost port
number 27017. Journaling is explicitly enabled.
.sp
.nf
.ft C
mongoimport \-\-collection contacts \-\-file contacts.json \-\-journal
.ft P
.fi
.sp
In the next example, \fI\%mongoimport\fP takes data passed to it on
standard input (i.e. with a \fB|\fP pipe.) and imports it into the
collection \fBcontacts\fP in the \fBsales\fP database is the
MongoDB datafiles located at \fB/srv/mongodb/\fP. if the import process
encounters an error, the \fI\%mongoimport\fP will halt because of
the \fI\%--stopOnError\fP option.
.sp
.nf
.ft C
mongoimport \-\-db sales \-\-collection contacts \-\-stopOnError \-\-dbpath /srv/mongodb/
.ft P
.fi
.sp
In the final example, \fI\%mongoimport\fP imports data from the
file \fB/opt/backups/mdb1\-examplenet.json\fP into the collection
\fBcontacts\fP within the database \fBmarketing\fP on a remote MongoDB
database. This \fI\%mongoimport\fP accesses the \fBmongod\fP
instance running on the host \fBmongodb1.example.net\fP over port
\fB37017\fP, which requires the username \fBuser\fP and the password
\fBpass\fP.
.sp
.nf
.ft C
mongoimport \-\-host mongodb1.example.net \-\-port 37017 \-\-username user \-\-password pass \-\-collection contacts \-\-db marketing \-\-file /opt/backups/mdb1\-examplenet.json
.ft P
.fi
.SH AUTHOR
MongoDB Documentation Project
.SH COPYRIGHT
2011-2013, 10gen, Inc.
.\" Generated by docutils manpage writer.
.

346
debian/mongooplog.1 vendored Normal file
View File

@ -0,0 +1,346 @@
.TH "MONGOOPLOG" "1" "March 14, 2013" "2.2.3" "mongodb-manual"
.SH NAME
mongooplog \- MongoDB
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.\" Man page generated from reStructuredText.
.
.sp
New in version 2.2.
.SH SYNOPSIS
.sp
\fI\%mongooplog\fP is a simple tool that polls operations from
the \fIreplication\fP \fIoplog\fP of a remote server, and applies
them to the local server. This capability supports certain classes of
real\-time migrations that require that the source server remain online
and in operation throughout the migration process.
.sp
Typically this command will take the following form:
.sp
.nf
.ft C
mongooplog \-\-from mongodb0.example.net \-\-host mongodb1.example.net
.ft P
.fi
.sp
This command copies oplog entries from the \fBmongod\fP instance
running on the host \fBmongodb0.example.net\fP and duplicates
operations to the host \fBmongodb1.example.net\fP. If you do not need
to keep the \fI\%--from\fP host running during
the migration, consider using \fBmongodump\fP and
\fBmongorestore\fP or another \fBbackup\fP operation, which may be better suited to
your operation.
.IP Note
If the \fBmongod\fP instance specified by the \fI\%--from\fP
argument is running with \fBauthentication\fP, then
\fI\%mongooplog\fP will not be able to copy oplog entries.
.RE
.IP "See also"
.sp
\fBmongodump\fP, \fBmongorestore\fP,
"\fB/administration/backups\fP", "\fIOplog Internals Overview\fP", and "\fIReplica Set Oplog Sizing\fP".
.RE
.SH OPTIONS
.INDENT 0.0
.TP
.B mongooplog
.UNINDENT
.INDENT 0.0
.TP
.B \-\-help
Returns a basic help and usage text.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-verbose, \-v
Increases the amount of internal reporting returned on the command
line. Increase the verbosity with the \fB\-v\fP form by including the
option multiple times, (e.g. \fB\-vvvvv\fP.)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-version
Returns the version of the \fI\%mongooplog\fP utility.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-host <hostname><:port>, \-h
Specifies a resolvable hostname for the \fBmongod\fP instance
to which \fI\%mongooplog\fP will apply \fIoplog\fP operations
retrieved from the serve specified by the \fI\%--from\fP
option.
.sp
\fI\%mongooplog\fP assumes that all target \fBmongod\fP
instances are accessible by way of port \fB27017\fP. You may,
optionally, declare an alternate port number as part of the
hostname argument.
.sp
You can always connect directly to a single \fBmongod\fP
instance by specifying the host and port number directly.
.sp
To connect to a replica set, you can specify the replica set seed
name, and a seed list of set members, in the following format:
.sp
.nf
.ft C
<replica_set_name>/<hostname1><:port>,<hostname2:<port>,...
.ft P
.fi
.UNINDENT
.INDENT 0.0
.TP
.B \-\-port
Specifies the port number of the \fBmongod\fP instance where
\fI\%mongooplog\fP will apply \fIoplog\fP entries. Only
specify this option if the MongoDB instance that you wish to
connect to is not running on the standard port. (i.e. \fB27017\fP)
You may also specify a port number using the \fI\%--host\fP command.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-ipv6
Enables IPv6 support that allows \fI\%mongooplog\fP to connect
to the MongoDB instance using an IPv6 network. All MongoDB programs
and processes, including \fI\%mongooplog\fP, disable IPv6
support by default.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-ssl
New in version 2.4: MongoDB added support for SSL connections to \fBmongod\fP
instances in mongooplog.
.IP Note
SSL support in mongooplog is not compiled into the default
distribution of MongoDB. See \fB/administration/ssl\fP for more
information on SSL and MongoDB.
.sp
Additionally, mongooplog does not support connections to
\fBmongod\fP instances that require client certificate
validation.
.RE
.sp
Allows \fI\%mongooplog\fP to connect to \fBmongod\fP
instance over an SSL connection.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-username <username>, \-u <username>
Specifies a username to authenticate to the MongoDB instance, if
your database requires authentication. Use in conjunction with the
\fI\%--password\fP option to supply a
password.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-password <password>, \-p <password>
Specifies a password to authenticate to the MongoDB instance. Use
in conjunction with the \fI\%--username\fP
option to supply a username.
.sp
If you specify a \fI\%--username\fP
without the \fI\%--password\fP option, \fI\%mongooplog\fP will
prompt for a password interactively.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-authenticationDatabase <dbname>
New in version 2.4.
.sp
Specifies the database that holds the user\(aqs (e.g
\fI\%--username\fP) credentials.
.sp
By default, \fI\%mongooplog\fP assumes that the database specified to the
\fI\-\-db\fP argument holds the user\(aqs credentials, unless you
specify \fI\%--authenticationDatabase\fP.
.sp
See \fBuserSource\fP,
\fB/reference/privilege\-documents\fP and
\fB/reference/user\-privileges\fP for more information about
delegated authentication in MongoDB.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-authenticationMechanism <name>
New in version 2.4.
.sp
Specifies the authentication mechanism. By default, the
authentication mechanism is \fBMONGODB\-CR\fP, which is the MongoDB
challenge/response authentication mechanism. In the MongoDB Subscriber Edition,
\fI\%mongooplog\fP also includes support for \fBGSSAPI\fP to handle
Kerberos authentication.
.sp
See \fB/tutorial/control\-access\-to\-mongodb\-with\-kerberos\-authentication\fP
for more information about Kerberos authentication.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-dbpath <path>
Specifies a directory, containing MongoDB data files, to which
\fI\%mongooplog\fP will apply operations from the \fIoplog\fP
of the database specified with the \fI\%--from\fP
option. When used, the \fI\%--dbpath\fP option enables
\fBmongo\fP to attach directly to local data files and write
data without a running \fBmongod\fP instance. To run with
\fI\%--dbpath\fP, \fI\%mongooplog\fP needs to restrict access
to the data directory: as a result, no \fBmongod\fP can be
access the same path while the process runs.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-directoryperdb
Use the \fI\%--directoryperdb\fP in conjunction with the
corresponding option to \fBmongod\fP. This option allows
\fI\%mongooplog\fP to write to data files organized with each
database located in a distinct directory. This option is only
relevant when specifying the \fI\%--dbpath\fP option.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-journal
Allows \fI\%mongooplog\fP operations to use the durability
\fIjournal\fP to ensure that the data files will
remain in a consistent state during the writing process. This
option is only relevant when specifying the \fI\%--dbpath\fP
option.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-fields [field1[,field2]], \-f [field1[,field2]]
Specify a field or number fields to constrain which data
\fI\%mongooplog\fP will migrate. All other fields will be
\fIexcluded\fP from the migration. Comma separate a list of fields to
limit the applied fields.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-fieldFile <file>
As an alternative to "\fI\%--fields\fP" the
\fI\%--fieldFile\fP option allows you to specify a file
(e.g. \fB<file>\fP) that holds a list of field names to \fIinclude\fP in
the migration. All other fields will be \fIexcluded\fP from the
migration. Place one field per line.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-seconds <number>, \-s <number>
Specify a number of seconds of operations for \fI\%mongooplog\fP
to pull from the \fI\%remote host\fP. Unless
specified the default value is \fB86400\fP seconds, or 24 hours.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-from <host[:port]>
Specify the host for \fI\%mongooplog\fP to retrieve \fIoplog\fP
operations from. \fI\%mongooplog\fP \fIrequires\fP this
option.
.sp
Unless you specify the \fI\%--host\fP option,
\fI\%mongooplog\fP will apply the operations collected with this
option to the oplog of the \fBmongod\fP instance running on
the localhost interface connected to port \fB27017\fP.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-oplogns <namespace>
Specify a namespace in the \fI\%--from\fP
host where the oplog resides. The default value is
\fBlocal.oplog.rs\fP, which is the where \fIreplica set\fP members
store their operation log. However, if you\(aqve copied \fIoplog\fP
entries into another database or collection, use this option to
copy oplog entries stored in another location.
.sp
\fINamespaces\fP take the form of
\fB[database].[collection]\fP.
.UNINDENT
.SS Usage
.sp
Consider the following prototype \fI\%mongooplog\fP command:
.sp
.nf
.ft C
mongooplog \-\-from mongodb0.example.net \-\-host mongodb1.example.net
.ft P
.fi
.sp
Here, entries from the \fIoplog\fP of the \fBmongod\fP running
on port \fB27017\fP. This only pull entries from the last 24 hours.
.sp
In the next command, the parameters limit this operation to only apply
operations to the database \fBpeople\fP in the collection \fBusage\fP on
the target host (i.e. \fBmongodb1.example.net\fP):
.sp
.nf
.ft C
mongooplog \-\-from mongodb0.example.net \-\-host mongodb1.example.net \-\-database people \-\-collection usage
.ft P
.fi
.sp
This operation only applies oplog entries from the last 24 hours. Use
the \fI\%--seconds\fP argument to capture a
greater or smaller amount of time. Consider the following example:
.sp
.nf
.ft C
mongooplog \-\-from mongodb0.example.net \-\-seconds 172800
.ft P
.fi
.sp
In this operation, \fI\%mongooplog\fP captures 2 full days of
operations. To migrate 12 hours of \fIoplog\fP entries, use the
following form:
.sp
.nf
.ft C
mongooplog \-\-from mongodb0.example.net \-\-seconds 43200
.ft P
.fi
.sp
For the previous two examples, \fI\%mongooplog\fP migrates entries
to the \fBmongod\fP process running on the localhost interface
connected to the \fB27017\fP port. \fI\%mongooplog\fP can also
operate directly on MongoDB\(aqs data files if no \fBmongod\fP is
running on the \fItarget\fP host. Consider the following example:
.sp
.nf
.ft C
mongooplog \-\-from mongodb0.example.net \-\-dbpath /srv/mongodb \-\-journal
.ft P
.fi
.sp
Here, \fI\%mongooplog\fP imports \fIoplog\fP operations from the
\fBmongod\fP host connected to port \fB27017\fP. This migrates
operations to the MongoDB data files stored in the \fB/srv/mongodb\fP
directory. Additionally \fI\%mongooplog\fP will use the durability
\fIjournal\fP to ensure that the data files remain in a consistent
state.
.SH AUTHOR
MongoDB Documentation Project
.SH COPYRIGHT
2011-2013, 10gen, Inc.
.\" Generated by docutils manpage writer.
.

245
debian/mongoperf.1 vendored Normal file
View File

@ -0,0 +1,245 @@
.TH "MONGOPERF" "1" "March 14, 2013" "2.2.3" "mongodb-manual"
.SH NAME
mongoperf \- MongoDB
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
\fI\%mongoperf\fP is a utility to check disk I/O performance
independently of MongoDB.
.sp
It times tests of random disk I/O and presents the results. You can
use \fI\%mongoperf\fP for any case apart from MongoDB. The
\fI\%mmf\fP \fBtrue\fP mode is completely generic. In
that mode is it somewhat analogous to tools such as \fI\%bonnie++\fP (albeit mongoperf is
simpler).
.sp
Specify options to \fI\%mongoperf\fP using a JavaScript document.
.IP "See also"
.INDENT 0.0
.IP \(bu 2
\fI\%bonnie\fP
.IP \(bu 2
\fI\%bonnie++\fP
.IP \(bu 2
\fI\%Output from an example run\fP
.IP \(bu 2
\fI\%Checking Disk Performance with the mongoperf Utility\fP
.UNINDENT
.RE
.SH OPTIONS
.INDENT 0.0
.TP
.B mongoperf
.UNINDENT
.INDENT 0.0
.TP
.B \-\-help
Displays the options to \fI\%mongoperf\fP. Specify options to
\fI\%mongoperf\fP with a JSON document described in the
\fI\%Configuration Fields\fP section.
.UNINDENT
.INDENT 0.0
.TP
.B <jsonconfig>
\fI\%mongoperf\fP accepts configuration options in the form of a
file that holds a \fIJSON\fP document. You must stream the
content of this file into \fI\%mongoperf\fP, as in the following
operation:
.sp
.nf
.ft C
mongoperf < config
.ft P
.fi
.sp
In this example \fBconfig\fP is the name of a file that holds a JSON
document that resembles the following example:
.sp
.nf
.ft C
{
nThreads:<n>,
fileSizeMB:<n>,
sleepMicros:<n>,
mmf:<bool>,
r:<bool>,
w:<bool>,
recSizeKB:<n>,
syncDelay:<n>
}
.ft P
.fi
.sp
See the \fI\%Configuration Fields\fP section for documentation of each
of these fields.
.UNINDENT
.SH CONFIGURATION FIELDS
.INDENT 0.0
.TP
.B mongoperf.nThreads
\fIType:\fP Integer.
.sp
\fIDefault:\fP 1
.sp
Defines the number of threads \fI\%mongoperf\fP will use in the
test. To saturate your system\(aqs storage system you will need
multiple threads. Consider setting \fI\%nThreads\fP to \fB16\fP.
.UNINDENT
.INDENT 0.0
.TP
.B mongoperf.fileSizeMB
\fIType:\fP Integer.
.sp
\fIDefault:\fP 1 megabyte (i.e. 1024\s-2\u2\d\s0 bytes)
.sp
Test file size.
.UNINDENT
.INDENT 0.0
.TP
.B mongoperf.sleepMicros
\fIType:\fP Integer.
.sp
\fIDefault:\fP 0
.sp
\fI\%mongoperf\fP will pause for the number of specified
\fI\%sleepMicros\fP divided by the
\fI\%nThreads\fP between each operation.
.UNINDENT
.INDENT 0.0
.TP
.B mongoperf.mmf
\fIType:\fP Boolean.
.sp
\fIDefault:\fP \fBfalse\fP
.sp
Set \fI\%mmf\fP to \fBtrue\fP to use memory mapped
files for the tests.
.sp
Generally:
.INDENT 7.0
.IP \(bu 2
when \fI\%mmf\fP is \fBfalse\fP, \fI\%mongoperf\fP
tests direct, physical, I/O, without caching. Use a large file
size to test heavy random I/O load and to avoid I/O coalescing.
.IP \(bu 2
when \fI\%mmf\fP is \fBtrue\fP, \fI\%mongoperf\fP
runs tests of the caching system, and can use normal file system
cache. Use \fBmmf\fP in this mode to test file system cache
behavior with memory mapped files.
.UNINDENT
.UNINDENT
.INDENT 0.0
.TP
.B mongoperf.r
\fIType:\fP Boolean.
.sp
\fIDefault:\fP \fBfalse\fP
.sp
Set \fI\%r\fP to \fBtrue\fP to perform reads as part of
the tests.
.sp
Either \fI\%r\fP or \fI\%w\fP must be \fBtrue\fP.
.UNINDENT
.INDENT 0.0
.TP
.B mongoperf.w
\fIType:\fP Boolean.
.sp
\fIDefault:\fP \fBfalse\fP
.sp
Set \fI\%w\fP to \fBtrue\fP to perform writes as part of
the tests.
.sp
Either \fI\%r\fP or \fI\%w\fP must be \fBtrue\fP.
.UNINDENT
.INDENT 0.0
.TP
.B mongoperf.syncDelay
\fIType:\fP Integer.
.sp
\fIDefault:\fP 0
.sp
Seconds between disk flushes. \fI\%syncDelay\fP is
similar to \fBsyncDelay\fP for \fBmongod\fP.
.sp
The \fI\%syncDelay\fP controls how frequently
\fI\%mongoperf\fP performs an asynchronous disk flush the memory
mapped file used for testing. By default, \fBmongod\fP
performs this operation every every 60 seconds. Use
\fI\%syncDelay\fP to test basic system performance of
this type of operation.
.sp
Only use \fI\%syncDelay\fP in conjunction with
\fI\%mmf\fP set to \fBtrue\fP.
.sp
The default value of \fB0\fP disables this
.UNINDENT
.SH USE
.sp
.nf
.ft C
mongoperf < jsonconfigfile
.ft P
.fi
.sp
Replace \fBjsonconfigfile\fP with the path to the \fI\%mongoperf\fP
configuration. You may also invoke \fI\%mongoperf\fP in the
following form:
.sp
.nf
.ft C
echo "{nThreads:16,fileSizeMB:1000,r:true}" | ./mongoperf
.ft P
.fi
.sp
In this operation:
.INDENT 0.0
.IP \(bu 2
\fI\%mongoperf\fP tests direct physical random read io\(aqs, using
16 concurrent reader threads.
.IP \(bu 2
\fI\%mongoperf\fP uses a 1 gigabyte test file.
.UNINDENT
.sp
Consider using \fBiostat\fP, as invoked in the following example to
monitor I/O performance during the test.
.sp
.nf
.ft C
iostat \-xm 2
.ft P
.fi
.SH AUTHOR
MongoDB Documentation Project
.SH COPYRIGHT
2011-2013, 10gen, Inc.
.\" Generated by docutils manpage writer.
.

413
debian/mongorestore.1 vendored
View File

@ -1,62 +1,395 @@
.TH MONGORESTORE "1" "June 2009" "10gen" "Mongo Database"
.SH "NAME"
mongorestore \- the Mongo restoration tool
.SH "SYNOPSIS"
\fBmongorestore [\fIOPTIONS\fR]\fR
.SH "DESCRIPTION"
.PP
\fBmongorestore\fR
is a tool to use the output from mongodump to restore a database.
.SH "OPTIONS"
.TH "MONGORESTORE" "1" "March 14, 2013" "2.2.3" "mongodb-manual"
.SH NAME
mongorestore \- MongoDB
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
The \fI\%mongorestore\fP tool imports content from binary database
dump, created by \fBmongodump\fP into a specific
database. \fI\%mongorestore\fP can import content to an existing
database or create a new one.
.sp
\fI\%mongorestore\fP only performs inserts into the existing
database, and does not perform updates or \fIupserts\fP. If
existing data with the same \fB_id\fP already exists on the target
database, \fI\%mongorestore\fP will \fInot\fP replace it.
.sp
\fI\%mongorestore\fP will recreate indexes from the dump
.sp
The behavior of \fI\%mongorestore\fP has the following properties:
.INDENT 0.0
.IP \(bu 2
all operations are inserts, not updates.
.IP \(bu 2
all inserts are "fire and forget," \fI\%mongorestore\fP does not
wait for a response from a \fBmongod\fP to ensure that the
MongoDB process has received or recorded the operation.
.sp
The \fBmongod\fP will record any errors to its log that occur
during a restore operation but \fI\%mongorestore\fP will not
receive errors.
.UNINDENT
.IP Note
The format of data created by \fBmongodump\fP tool from the
2.2 distribution or later is different and incompatible with
earlier versions of \fBmongod\fP.
.RE
.SH OPTIONS
.INDENT 0.0
.TP
.B mongorestore
.UNINDENT
.INDENT 0.0
.TP
.B \-\-help
show usage information
Returns a basic help and usage text.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-verbose, \-v
Increases the amount of internal reporting returned on the command
line. Increase the verbosity with the \fB\-v\fP form by including
the option multiple times, (e.g. \fB\-vvvvv\fP.)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-version
show version information
Returns the version of the \fI\%mongorestore\fP tool.
.UNINDENT
.INDENT 0.0
.TP
.B \-h, \-\-host HOST
server to connect to (default HOST=localhost)
.B \-\-host <hostname><:port>
Specifies a resolvable hostname for the \fBmongod\fP to which
you want to restore the database. By default
\fI\%mongorestore\fP will attempt to connect to a MongoDB
process running on the localhost port number \fB27017\fP.
.sp
Optionally, specify a port number to connect a MongoDB instance
running on a port other than \fB27017\fP.
.sp
To connect to a replica set, you can specify the replica set seed
name, and a seed list of set members, in the following format:
.sp
.nf
.ft C
<replica_set_name>/<hostname1><:port>,<hostname2:<port>,...
.ft P
.fi
.UNINDENT
.INDENT 0.0
.TP
.B\-\-port arg
server port. Can also use \-\-host hostname:port
.B \-\-port <port>
Specifies the port number, if the MongoDB instance is not running
on the standard port. (i.e. \fB27017\fP) You may also specify a port
number using the \fI\%--host\fP command.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-ipv6
enable IPv6 support (disabled by default)
Enables IPv6 support that allows \fI\%mongorestore\fP to connect
to the MongoDB instance using an IPv6 network. All MongoDB programs
and processes, including \fI\%mongorestore\fP, disable IPv6
support by default.
.UNINDENT
.INDENT 0.0
.TP
.B \-u|\-\-username USERNAME
specify user to log in as
.B \-\-ssl
New in version 2.4: MongoDB added support for SSL connections to \fBmongod\fP
instances in mongorestore.
.IP Note
SSL support in mongorestore is not compiled into the default
distribution of MongoDB. See \fB/administration/ssl\fP for more
information on SSL and MongoDB.
.sp
Additionally, mongorestore does not support connections to
\fBmongod\fP instances that require client certificate
validation.
.RE
.sp
Allows \fI\%mongorestore\fP to connect to \fBmongod\fP
instance over an SSL connection.
.UNINDENT
.INDENT 0.0
.TP
.B \-p|\-\-password PASSWORD
specify password of user (notice there is no space)
.B \-\-username <username>, \-u <username>
Specifies a username to authenticate to the MongoDB instance, if
your database requires authentication. Use in conjunction with the
\fI\%--password\fP option to supply a
password.
.UNINDENT
.INDENT 0.0
.TP
.B \-d, \-\-db DATABASE
database to use
.B \-\-password <password>, \-p <password>
Specifies a password to authenticate to the MongoDB instance. Use
in conjunction with the \fI\%mongorestore --username\fP option to
supply a username.
.sp
If you specify a \fI\%--username\fP
without the \fI\%--password\fP option, \fI\%mongorestore\fP
will prompt for a password interactively.
.UNINDENT
.INDENT 0.0
.TP
.B \-c, \-\-c COLLECTION
collection to use
.B \-\-authenticationDatabase <dbname>
New in version 2.4.
.sp
Specifies the database that holds the user\(aqs (e.g
\fI\%--username\fP) credentials.
.sp
By default, \fI\%mongorestore\fP assumes that the database specified to the
\fI\%--db\fP argument holds the user\(aqs credentials, unless you
specify \fI\%--authenticationDatabase\fP.
.sp
See \fBuserSource\fP,
\fB/reference/privilege\-documents\fP and
\fB/reference/user\-privileges\fP for more information about
delegated authentication in MongoDB.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-dbpath PATH
directly access mongod data files in this path, instead of connecting to a mongod instance
.B \-\-authenticationMechanism <name>
New in version 2.4.
.sp
Specifies the authentication mechanism. By default, the
authentication mechanism is \fBMONGODB\-CR\fP, which is the MongoDB
challenge/response authentication mechanism. In the MongoDB Subscriber Edition,
\fI\%mongorestore\fP also includes support for \fBGSSAPI\fP to handle
Kerberos authentication.
.sp
See \fB/tutorial/control\-access\-to\-mongodb\-with\-kerberos\-authentication\fP
for more information about Kerberos authentication.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-dbpath <path>
Specifies the directory of the MongoDB data files. If used, the
\fI\%--dbpath\fP option enables \fI\%mongorestore\fP to attach
directly to local data files and insert the data without the
\fBmongod\fP. To run with \fI\%--dbpath\fP,
\fI\%mongorestore\fP needs to lock access to the data directory:
as a result, no \fBmongod\fP can access the same path while the
process runs.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-directoryperdb
if dbpath specified, each db is in a separate directory
Use the \fI\%--directoryperdb\fP in conjunction with the
corresponding option to \fBmongod\fP, which allows
\fI\%mongorestore\fP to import data into MongoDB instances that
have every database\(aqs files saved in discrete directories on the
disk. This option is only relevant when specifying the
\fI\%--dbpath\fP option.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-journal
Allows \fI\%mongorestore\fP write to the durability
\fIjournal\fP to ensure that the data files will remain in a
consistent state during the write process. This option is only
relevant when specifying the \fI\%--dbpath\fP option.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-db <db>, \-d <db>
Use the \fI\%--db\fP option to specify a database for
\fI\%mongorestore\fP to restore data \fIinto\fP. If the database
doesn\(aqt exist, \fI\%mongorestore\fP will create the specified
database. If you do not specify a \fB<db>\fP,
\fI\%mongorestore\fP creates new databases that correspond to
the databases where data originated and data may be
overwritten. Use this option to restore data into a MongoDB
instance that already has data.
.sp
\fI\%--db\fP does \fInot\fP control which \fIBSON\fP files
\fI\%mongorestore\fP restores. You must use the
\fI\%mongorestore\fP \fI\%path option\fP to limit that restored data.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-collection <collection>, \-c <collection>
Use the \fI\%--collection\fP option to specify a collection for
\fI\%mongorestore\fP to restore. If you do not specify a
\fB<collection>\fP, \fI\%mongorestore\fP imports all collections
created. Existing data may be overwritten. Use this option to
restore data into a MongoDB instance that already has data, or to
restore only some data in the specified imported data set.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-objcheck
validate object before inserting
Forces the \fI\%mongorestore\fP to validate all requests from
clients upon receipt to ensure that clients never insert invalid
documents into the database. For objects with a high degree of
sub\-document nesting, \fI\%--objcheck\fP can have a small impact
on performance. You can set \fI\%--noobjcheck\fP to disable
object checking at run\-time.
.sp
Changed in version 2.4: MongoDB enables \fI\%--objcheck\fP by default, to prevent any
client from inserting malformed or invalid BSON into a MongoDB
database.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-filter arg
filter to apply before inserting
.B \-\-noobjcheck
New in version 2.4.
.sp
Disables the default document validation that MongoDB performs on all
incoming BSON documents.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-filter \(aq<JSON>\(aq
Limits the documents that \fI\%mongorestore\fP imports to only
those documents that match the JSON document specified as
\fB\(aq<JSON>\(aq\fP. Be sure to include the document in single quotes to
avoid interaction with your system\(aqs shell environment.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-drop
drop each collection before import
Modifies the restoration procedure to drop every collection from
the target database before restoring the collection from the dumped
backup.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-oplogReplay
replay oplog for point-in-time restore
.SH "COPYRIGHT"
.PP
Copyright 2007\-2011 10gen
.SH "SEE ALSO"
For more information, please refer to the mongorestore page in the MongoDB manual, available at http://dochub.mongodb.org/core/mongorestoremanpage
.SH "AUTHOR"
Kristina Chodorow
Replays the \fIoplog\fP after restoring the dump to ensure that the current
state of the database reflects the point\-in\-time backup captured with
the "\fImongodump \-\-oplog\fP" command.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-keepIndexVersion
Prevents \fI\%mongorestore\fP from upgrading the index to the latest
version during the restoration process.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-w <number of replicas per write>
New in version 2.2.
.sp
Specifies the \fIwrite concern\fP for each write operation that
\fI\%mongorestore\fP writes to the target database. By default,
\fI\%mongorestore\fP does not wait for a response for
\fIwrite acknowledgment\fP.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-noOptionsRestore
New in version 2.2.
.sp
Prevents \fI\%mongorestore\fP from setting the collection
options, such as those specified by the \fBcollMod\fP
\fIdatabase command\fP, on restored collections.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-noIndexRestore
New in version 2.2.
.sp
Prevents \fI\%mongorestore\fP from restoring and building
indexes as specified in the corresponding \fBmongodump\fP
output.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-oplogLimit <timestamp>
New in version 2.2.
.sp
Prevents \fI\%mongorestore\fP from applying \fIoplog\fP entries newer
than the \fB<timestamp>\fP. Specify \fB<timestamp>\fP values in the
form of \fB<time_t>:<ordinal>\fP, where \fB<time_t>\fP is the seconds
since the UNIX epoch, and \fB<ordinal>\fP represents a counter of
operations in the oplog that occurred in the specified second.
.sp
You must use \fI\%--oplogLimit\fP in conjunction with the
\fI\%--oplogReplay\fP option.
.UNINDENT
.INDENT 0.0
.TP
.B <path>
The final argument of the \fI\%mongorestore\fP command is a
directory path. This argument specifies the location of the
database dump from which to restore.
.UNINDENT
.SH USAGE
.sp
See \fB/tutorial/backup\-databases\-with\-binary\-database\-dumps\fP
for a larger overview of \fI\%mongorestore\fP
usage. Also see the "\fBmongodump\fP" document for an overview of the
\fBmongodump\fP, which provides the related inverse
functionality.
.sp
Consider the following example:
.sp
.nf
.ft C
mongorestore \-\-collection people \-\-db accounts dump/accounts/
.ft P
.fi
.sp
Here, \fI\%mongorestore\fP reads the database dump in the \fBdump/\fP
sub\-directory of the current directory, and restores \fIonly\fP the
documents in the collection named \fBpeople\fP from the database named
\fBaccounts\fP. \fI\%mongorestore\fP restores data to the instance
running on the localhost interface on port \fB27017\fP.
.sp
In the next example, \fI\%mongorestore\fP restores a backup of the
database instance located in \fBdump\fP to a database instance stored
in the \fB/srv/mongodb\fP on the local machine. This requires that there
are no active \fBmongod\fP instances attached to \fB/srv/mongodb\fP
data directory.
.sp
.nf
.ft C
mongorestore \-\-dbpath /srv/mongodb
.ft P
.fi
.sp
In the final example, \fI\%mongorestore\fP restores a database
dump located at \fB/opt/backup/mongodump\-2011\-10\-24\fP, from a database
running on port \fB37017\fP on the host
\fBmongodb1.example.net\fP. \fI\%mongorestore\fP authenticates to
the this MongoDB instance using the username \fBuser\fP and the
password \fBpass\fP, as follows:
.sp
.nf
.ft C
mongorestore \-\-host mongodb1.example.net \-\-port 37017 \-\-username user \-\-password pass /opt/backup/mongodump\-2011\-10\-24
.ft P
.fi
.SH AUTHOR
MongoDB Documentation Project
.SH COPYRIGHT
2011-2013, 10gen, Inc.
.\" Generated by docutils manpage writer.
.

435
debian/mongos.1 vendored
View File

@ -1,89 +1,400 @@
.TH MONGOS "1" "June 2009" "10gen" "Mongo Database"
.SH "NAME"
mongos \- the Mongo sharding server
.SH "SYNOPSIS"
\fBmongos [\fIOPTIONS\fR]\fR
.SH "DESCRIPTION"
.PP
\fBmongos\fR
is used to setup, configure, and get information about sharded databases.
.SH "EXAMPLES"
.PP
.B ./mongod --port 9999 --dbpath /data/db/a # first server
.PP
.B ./mongod --port 9998 --dbpath /data/db/b # second server
.PP
.B ./mongos --configdb localhost:9999 # mongos
.PP
starts three servers to set up sharding
.SH "OPTIONS"
.TH "MONGOS" "1" "March 14, 2013" "2.2.3" "mongodb-manual"
.SH NAME
mongos \- MongoDB Shard Utility
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
\fI\%mongos\fP for "MongoDB Shard," is a routing service for
MongoDB shard configurations that processes queries from the
application layer, and determines the location of this data in the
\fIsharded cluster\fP, in order to complete these operations.
From the perspective of the application, a
\fI\%mongos\fP instance behaves identically to any other MongoDB
instance.
.IP Note
Changed in version 2.1.
.sp
Some aggregation operations using the \fBaggregate\fP will
cause \fI\%mongos\fP instances to require more CPU resources
than in previous versions. This modified performance profile may
dictate alternate architecture decisions if you use the
\fIaggregation framework\fP extensively in a sharded environment.
.RE
.IP "See also"
.sp
\fB/sharding\fP and \fB/core/sharded\-clusters\fP.
.RE
.SH OPTIONS
.INDENT 0.0
.TP
.B \-\-help
show usage information
.B mongos
.UNINDENT
.INDENT 0.0
.TP
.B \-h, \-\-help
show this usage information
.B \-\-help, \-h
Returns a basic help and usage text.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-version
show version information
Returns the version of the \fBmongod\fP daemon.
.UNINDENT
.INDENT 0.0
.TP
.B \-f, \-\-config arg
configuration file specifying additional options
.B \-\-config <filename>, \-f <filename>
Specifies a configuration file, that you can use to specify
runtime\-configurations. While the options are equivalent and
accessible via the other command line arguments, the configuration
file is the preferred method for runtime configuration of
mongod. See the "\fB/reference/configuration\-options\fP" document
for more information about these options.
.sp
Not all configuration options for \fBmongod\fP make sense in
the context of \fI\%mongos\fP.
.UNINDENT
.INDENT 0.0
.TP
.B \-v, \-\-verbose
be more verbose (include multiple times for more verbosity
e.g. -vvvvv)
.B \-\-verbose, \-v
Increases the amount of internal reporting returned on standard
output or in the log file specified by \fI\%--logpath\fP. Use the
\fB\-v\fP form to control the level of verbosity by including the
option multiple times, (e.g. \fB\-vvvvv\fP.)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-quiet quieter output
.B \-\-quiet
Runs the \fI\%mongos\fP instance in a quiet mode that attempts to limit
the amount of output.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-port arg specify port number
.B \-\-port <port>
Specifies a TCP port for the \fI\%mongos\fP to listen for client
connections. By default \fI\%mongos\fP listens for connections on
port 27017.
.sp
UNIX\-like systems require root access to access ports with numbers
lower than 1024.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-bind_ip arg
comma separated list of ip addresses to listen on - all local ips by
default
.B \-\-bind_ip <ip address>
The IP address that the \fI\%mongos\fP process will bind to and
listen for connections. By default \fI\%mongos\fP listens for
connections on the localhost (i.e. \fB127.0.0.1\fP address.) You may
attach \fI\%mongos\fP to any interface; however, if you attach
\fI\%mongos\fP to a publicly accessible interface you must
implement proper authentication or firewall restrictions to protect
the integrity of your database.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-logpath arg
log file to send write to instead of stdout - has to be a file, not
directory
.B \-\-maxConns <number>
Specifies the maximum number of simultaneous connections that
\fI\%mongos\fP will accept. This setting will have no effect if
the value of this setting is higher than your operating system\(aqs
configured maximum connection tracking threshold.
.sp
This is particularly useful for \fI\%mongos\fP if you have a
client that creates a number of collections but allows them to
timeout rather than close the collections. When you set
\fBmaxConns\fP, ensure the value is slightly higher than the
size of the connection pool or the total number of connections to
prevent erroneous connection spikes from propagating to the members
of a \fIshard\fP cluster.
.IP Note
You cannot set \fBmaxConns\fP to a value higher
than \fI20000\fP.
.RE
.UNINDENT
.INDENT 0.0
.TP
.B \-\-objcheck
Forces the \fI\%mongos\fP to validate all requests from clients
upon receipt to ensure that invalid objects are never inserted into
the database. This option has a performance impact, and is not
enabled by default.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-logpath <path>
Specify a path for the log file that will hold all diagnostic
logging information.
.sp
Unless specified, \fI\%mongos\fP will output all log information
to the standard output. Additionally, unless you also specify
\fI\%--logappend\fP, the logfile will be overwritten when the
process restarts.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-logappend
append to logpath instead of over-writing
Specify to ensure that \fI\%mongos\fP appends additional logging
data to the end of the logfile rather than overwriting the content
of the log when the process restarts.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-pidfilepath arg
full path to pidfile (if not set, no pidfile is created)
.B \-\-syslog
New in version 2.1.0.
.sp
Sends all logging output to the host\(aqs \fIsyslog\fP system rather
than to standard output or a log file as with \fI\%--logpath\fP.
.IP Warning
You cannot use \fI\%--syslog\fP with \fI\%--logpath\fP.
.RE
.UNINDENT
.INDENT 0.0
.TP
.B \-\-keyFile arg
private key for cluster authentication (only for replica sets)
.B \-\-pidfilepath <path>
Specify a file location to hold the "\fIPID\fP" or process ID of the
\fI\%mongos\fP process. Useful for tracking the \fI\%mongos\fP process in
combination with the \fI\%mongos --fork\fP option.
.sp
Without a specified \fI\%--pidfilepath\fP option,
\fI\%mongos\fP creates no PID file.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-unixSocketPrefix arg
alternative directory for UNIX domain sockets (defaults to /tmp)
.B \-\-keyFile <file>
Specify the path to a key file to store authentication
information. This option is only useful for the connection between
\fI\%mongos\fP instances and components of the \fIsharded cluster\fP.
.IP "See also"
.sp
\fIsharding\-security\fP
.RE
.UNINDENT
.INDENT 0.0
.TP
.B \-\-nounixsocket
Disables listening on the UNIX socket. Without this option
\fI\%mongos\fP creates a UNIX socket.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-unixSocketPrefix <path>
Specifies a path for the UNIX socket. Unless specified,
\fI\%mongos\fP creates a socket in the \fB/tmp\fP path.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-fork
fork server process
.SH "SHARDING OPTIONS"
Enables a \fIdaemon\fP mode for \fBmongod\fP which forces the
process to the background. This is the normal mode of operation, in
production and production\-like environments, but may \fInot\fP be
desirable for testing.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-configdb arg
1 or 3 comma separated config servers
.B \-\-configdb <config1>,<config2><:port>,<config3>
Set this option to specify a configuration database
(i.e. \fIconfig database\fP) for the \fIsharded cluster\fP. You must
specify either 1 configuration server or 3 configuration servers,
in a comma separated list.
.IP Note
\fI\%mongos\fP instances read from the first \fIconfig
server\fP in the list provided. All
\fI\%mongos\fP instances \fBmust\fP specify the hosts to the
\fI\%--configdb\fP setting in the same order.
.sp
If your configuration databases reside in more that one data
center, order the hosts in the \fI\%--configdb\fP argument so
that the config database that is closest to the majority of your
\fI\%mongos\fP instances is first servers in the list.
.RE
.IP Warning
Never remove a config server from the \fI\%--configdb\fP parameter, even if
the config server or servers are not available, or offline.
.RE
.UNINDENT
.INDENT 0.0
.TP
.B \-\-test
just run unit tests
This option is for internal testing use only, and runs unit tests
without starting a \fI\%mongos\fP instance.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-upgrade
upgrade meta data version
This option updates the meta data format used by the
\fIconfig database\fP.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-chunkSize arg
maximum amount of data per chunk
.B \-\-chunkSize <value>
The value of the \fI\%--chunkSize\fP determines the size of each
\fIchunk\fP, \fIin megabytes\fP, of data distributed around the
\fIsharded cluster\fP. The default value is 64 megabytes, which
is the ideal size for chunks in most deployments: larger chunk size
can lead to uneven data distribution, smaller chunk size often
leads to inefficient movement of chunks between nodes. However, in
some circumstances it may be necessary to set a different chunk
size.
.sp
This option \fIonly\fP sets the chunk size when initializing the
cluster for the first time. If you modify the run\-time option
later, the new value will have no effect. See the
"\fIsharding\-balancing\-modify\-chunk\-size\fP" procedure if you
need to change the chunk size on an existing sharded cluster.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-ipv6
enable IPv6 support (disabled by default)
Enables IPv6 support to allow clients to connect to \fI\%mongos\fP
using IPv6 networks. MongoDB disables IPv6 support by default in
\fBmongod\fP and all utilities.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-jsonp
allow JSONP access via http (has security implications)
.SH "COPYRIGHT"
.PP
Copyright 2007\-2011 10gen
.SH "SEE ALSO"
For more information, please refer to the mongos page in the MongoDB manual, available at http://dochub.mongodb.org/core/mongosmanpage
.SH "AUTHOR"
Kristina Chodorow
Permits \fIJSONP\fP access via an HTTP interface. Consider the
security implications of allowing this activity before enabling
this option.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-noscripting
Disables the scripting engine.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-nohttpinterface
New in version 2.1.2.
.sp
Disables the HTTP interface.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-localThreshold
New in version 2.2.
.sp
\fI\%--localThreshold\fP affects the logic that \fI\%mongos\fP
uses when selecting \fIreplica set\fP members to pass read
operations to from clients. Specify a value to
\fI\%--localThreshold\fP in milliseconds. The default value is
\fB15\fP, which corresponds to the default value in all of the client
\fBdrivers\fP.
.sp
When \fI\%mongos\fP receives a request that permits reads to
\fIsecondary\fP members, the \fI\%mongos\fP will:
.INDENT 7.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
find the member of the set with the lowest ping time.
.IP \(bu 2
construct a list of replica set members that is within a ping
time of 15 milliseconds of the nearest suitable member of the
set.
.sp
If you specify a value for \fI\%--localThreshold\fP,
\fI\%mongos\fP will construct the list of replica members
that are within the latency allowed by this value.
.IP \(bu 2
The \fI\%mongos\fP will select a member to read from at
random from this list.
.UNINDENT
.UNINDENT
.UNINDENT
.sp
The ping time used for a set member compared by the
\fI\%--localThreshold\fP setting is a moving average of recent
ping times, calculated, at most, every 10 seconds. As a result, some queries
may reach members above the threshold until the \fI\%mongos\fP
recalculates the average.
.sp
See the \fIreplica\-set\-read\-preference\-behavior\-member\-selection\fP
section of the \fIread preference\fP
documentation for more information.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-noAutoSplit
New in version 2.0.7.
.sp
\fI\%--noAutoSplit\fP prevents \fI\%mongos\fP from
automatically inserting metadata splits in a \fIsharded
collection\fP. If set on all \fI\%mongos\fP, this will prevent
MongoDB from creating new chunks as the data in a collection
grows.
.sp
Because any \fI\%mongos\fP in a cluster can create a split,
to totally disable splitting in a cluster you must
set \fI\%--noAutoSplit\fP on all \fI\%mongos\fP.
.IP Warning
With \fI\%--noAutoSplit\fP enabled, the data in your sharded
cluster may become imbalanced over time. Enable with caution.
.RE
.UNINDENT
.SS SSL Options
.IP "See"
.sp
\fB/administration/ssl\fP for full documentation of
MongoDB\(aqs support.
.RE
.INDENT 0.0
.TP
.B \-\-authenticationDatabase <dbname>
New in version 2.4.
.sp
Specifies the database that holds the user\(aqs (e.g
\fI\-\-username\fP) credentials.
.sp
By default, \fI\%mongos\fP assumes that the database specified to the
\fI\-\-db\fP argument holds the user\(aqs credentials, unless you
specify \fI\%--authenticationDatabase\fP.
.sp
See \fBuserSource\fP,
\fB/reference/privilege\-documents\fP and
\fB/reference/user\-privileges\fP for more information about
delegated authentication in MongoDB.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-authenticationMechanism <name>
New in version 2.4.
.sp
Specifies the authentication mechanism. By default, the
authentication mechanism is \fBMONGODB\-CR\fP, which is the MongoDB
challenge/response authentication mechanism. In the MongoDB Subscriber Edition,
\fI\%mongos\fP also includes support for \fBGSSAPI\fP to handle
Kerberos authentication.
.sp
See \fB/tutorial/control\-access\-to\-mongodb\-with\-kerberos\-authentication\fP
for more information about Kerberos authentication.
.UNINDENT
.SH AUTHOR
MongoDB Documentation Project
.SH COPYRIGHT
2011-2013, 10gen, Inc.
.\" Generated by docutils manpage writer.
.

206
debian/mongosniff.1 vendored
View File

@ -1,33 +1,183 @@
.TH MONGOSNIFF "1" "Jan 2010" "10gen" "Mongo Database"
.SH "NAME"
mongosniff \- the Mongo packet analyzer
.SH "SYNOPSIS"
\fBmongosniff [\fIOPTIONS\fR] [\fI<port0> <port1> ...\fR]
.SH "DESCRIPTION"
.PP
\fBmongosniff\fR
is a analyzer tool for analyzing packets coming to your database.
.PP
.SH "OPTIONS"
.TH "MONGOSNIFF" "1" "March 14, 2013" "2.2.3" "mongodb-manual"
.SH NAME
mongosniff \- MongoDB
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
\fI\%mongosniff\fP provides a low\-level operation tracing/sniffing view
into database activity in real time. Think of \fI\%mongosniff\fP as a
MongoDB\-specific analogue of \fBtcpdump\fP for TCP/IP network
traffic. Typically, \fI\%mongosniff\fP is most frequently used in driver
development.
.IP Note
\fI\%mongosniff\fP requires \fBlibpcap\fP and is only available for
Unix\-like systems. Furthermore, the version distributed with the
MongoDB binaries is dynamically linked against aversion 0.9 of
\fBlibpcap\fP. If your system has a different version of \fBlibpcap\fP, you
will need to compile \fI\%mongosniff\fP yourself or create a
symbolic link pointing to \fBlibpcap.so.0.9\fP to your local version
of \fBlibpcap\fP. Use an operation that resembles the following:
.sp
.nf
.ft C
ln \-s /usr/lib/libpcap.so.1.1.1 /usr/lib/libpcap.so.0.9
.ft P
.fi
.sp
Change the path\(aqs and name of the shared library as needed.
.RE
.sp
As an alternative to \fI\%mongosniff\fP, Wireshark, a popular
network sniffing tool is capable of inspecting and parsing the MongoDB
wire protocol.
.SH OPTIONS
.INDENT 0.0
.TP
.B \-\-forward
Forward all parsed request messages to mongod instance at specified host:port
.TP
.B \-\-source
Source of traffic to sniff, either a network interface or a file containing previously captured packets, in pcap format. If no source is specified, mongosniff will attempt to sniff from one of the machine's network interfaces.
.B mongosniff
.UNINDENT
.INDENT 0.0
.TP
.B \-\-help
print a short help message.
Returns a basic help and usage text.
.UNINDENT
.INDENT 0.0
.TP
.B <port0>
These parameters are used to filter sniffing. By default, only port 27017 is sniffed.
.B \-\-forward <host><:port>
Declares a host to forward all parsed requests that the
\fI\%mongosniff\fP intercepts to another \fBmongod\fP
instance and issue those operations on that database instance.
.sp
Specify the target host name and port in the \fB<host><:port>\fP
format.
.sp
To connect to a replica set, you can specify the replica set seed
name, and a seed list of set members, in the following format:
.sp
.nf
.ft C
<replica_set_name>/<hostname1><:port>,<hostname2:<port>,...
.ft P
.fi
.UNINDENT
.INDENT 0.0
.TP
.B \-\-help
show usage information
.SH "COPYRIGHT"
.PP
Copyright 2007\-2011 10gen
.SH "SEE ALSO"
For more information, please refer to the mongosniff page in the MongoDB manual, available at http://dochub.mongodb.org/core/mongosniffmanpage
.SH "AUTHOR"
Antonin Kral
.B \-\-source <NET [interface]>, <FILE [filename]>, <DIAGLOG [filename]>
Specifies source material to inspect. Use \fB\-\-source NET
[interface]\fP to inspect traffic from a network interface
(e.g. \fBeth0\fP or \fBlo\fP.) Use \fB\-\-source FILE [filename]\fP to
read captured packets in \fIpcap\fP format.
.sp
You may use the \fB\-\-source DIAGLOG [filename]\fP option to read
the output files produced by the \fI\-\-diaglog\fP
option.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-objcheck
Modifies the behavior to \fIonly\fP display invalid BSON objects and
nothing else. Use this option for troubleshooting driver
development. This option has some performance impact on the
performance of \fI\%mongosniff\fP.
.UNINDENT
.INDENT 0.0
.TP
.B <port>
Specifies alternate ports to sniff for traffic. By default,
\fI\%mongosniff\fP watches for MongoDB traffic on port 27017. Append
multiple port numbers to the end of \fI\%mongosniff\fP to monitor
traffic on multiple ports.
.UNINDENT
.SH USAGE
.sp
Use the following command to connect to a \fBmongod\fP or
\fBmongos\fP running on port 27017 \fIand\fP 27018 on the localhost
interface:
.sp
.nf
.ft C
mongosniff \-\-source NET lo 27017 27018
.ft P
.fi
.sp
Use the following command to only log invalid \fIBSON\fP objects for
the \fBmongod\fP or \fBmongos\fP running on the localhost
interface and port 27018, for driver development and troubleshooting:
.sp
.nf
.ft C
mongosniff \-\-objcheck \-\-source NET lo 27018
.ft P
.fi
.SH BUILD MONGOSNIFF
.sp
To build \fBmongosniff\fP yourself, Linux users can use the following
procedure:
.INDENT 0.0
.IP 1. 3
Obtain prerequisites using your operating
systems package management software. Dependencies include:
.INDENT 3.0
.IP \(bu 2
\fBlibpcap\fP \- to capture network packets.
.IP \(bu 2
\fBgit\fP \- to download the MongoDB source code.
.IP \(bu 2
\fBscons\fP and a C++ compiler \- to build \fI\%mongosniff\fP.
.UNINDENT
.IP 2. 3
Download a copy of the MongoDB source code using \fBgit\fP:
.sp
.nf
.ft C
git clone git://github.com/mongodb/mongo.git
.ft P
.fi
.IP 3. 3
Issue the following sequence of commands to change to the
\fBmongo/\fP directory and build \fI\%mongosniff\fP:
.sp
.nf
.ft C
cd mongo
scons mongosniff
.ft P
.fi
.UNINDENT
.IP Note
If you run \fBscons mongosniff\fP before installing \fBlibpcap\fP you
must run \fBscons clean\fP before you can build \fI\%mongosniff\fP.
.RE
.SH AUTHOR
MongoDB Documentation Project
.SH COPYRIGHT
2011-2013, 10gen, Inc.
.\" Generated by docutils manpage writer.
.

518
debian/mongostat.1 vendored
View File

@ -1,113 +1,501 @@
.TH MONGOSTAT "1" "March 2010" "10gen" "Mongo Database"
.SH "NAME"
mongostat \- view statistics on a running mongod instance
.SH "SYNOPSIS"
\fBmongostat [\fIOPTIONS\fR] [\fISLEEP TIME\fR]
.SH "DESCRIPTION"
.PP
\fBmongostat\fR
prints statistics on a running mongod instance. [\fISLEEP TIME\fR] is
time to wait (in seconds) between calls to servers
.SH "OPTIONS"
.TH "MONGOSTAT" "1" "March 14, 2013" "2.2.3" "mongodb-manual"
.SH NAME
mongostat \- MongoDB
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
The \fI\%mongostat\fP utility provides a quick overview of the
status of a currently running \fBmongod\fP
or \fBmongos\fP
instance. \fI\%mongostat\fP is functionally similar to the
UNIX/Linux file system utility \fBvmstat\fP, but provides data regarding
\fBmongod\fP and \fBmongos\fP instances.
.IP "See also"
.sp
For more information about monitoring MongoDB, see
\fB/administration/monitoring\fP.
.sp
For more background on various other MongoDB status outputs see:
.INDENT 0.0
.IP \(bu 2
\fB/reference/server\-status\fP
.IP \(bu 2
\fB/reference/replica\-status\fP
.IP \(bu 2
\fB/reference/database\-statistics\fP
.IP \(bu 2
\fB/reference/collection\-statistics\fP
.UNINDENT
.sp
For an additional utility that provides MongoDB metrics see
"\fBmongotop\fP."
.RE
.sp
\fI\%mongostat\fP connects to the \fBmongod\fP instance running
on the local host interface on TCP port \fB27017\fP; however,
\fI\%mongostat\fP can connect to any accessible remote \fBmongod\fP
instance.
.SH OPTIONS
.INDENT 0.0
.TP
.B \-\-help
produce help message
.B mongostat
.UNINDENT
.INDENT 0.0
.TP
.B \-\-help
Returns a basic help and usage text.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-verbose, \-v
Increases the amount of internal reporting returned on the command
line. Increase the verbosity with the \fB\-v\fP form by including
the option multiple times, (e.g. \fB\-vvvvv\fP.)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-version
show version information
Returns the version of the \fI\%mongostat\fP utility.
.UNINDENT
.INDENT 0.0
.TP
.B \-v, \-\-verbose
be more verbose (include multiple times for more verbosity
e.g. \-vvvvv)
.B \-\-host <hostname><:port>
Specifies a resolvable hostname for the \fBmongod\fP from which you
want to export data. By default \fI\%mongostat\fP attempts to connect
to a MongoDB instance running on the localhost port number \fB27017\fP.
.sp
Optionally, specify a port number to connect a MongoDB instance
running on a port other than \fB27017\fP.
.sp
To connect to a replica set, you can specify the replica set seed
name, and a seed list of set members, in the following format:
.sp
.nf
.ft C
<replica_set_name>/<hostname1><:port>,<hostname2:<port>,...
.ft P
.fi
.UNINDENT
.INDENT 0.0
.TP
.B \-h, \-\-host arg
mongo host to connect to ( <set name>/s1,s2 for sets)
.B \-\-port <port>
Specifies the port number, if the MongoDB instance is not running on
the standard port. (i.e. \fB27017\fP) You may also specify a port
number using the \fI\%mongostat --host\fP command.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-port arg
server port. Can also use \-\-host hostname:port
.B \-\-ipv6
Enables IPv6 support that allows \fI\%mongostat\fP to connect
to the MongoDB instance using an IPv6 network. All MongoDB programs
and processes, including \fI\%mongostat\fP, disable IPv6
support by default.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-ipv6
enable IPv6 support (disabled by default)
.B \-\-ssl
New in version 2.4: MongoDB added support for SSL connections to \fBmongod\fP
instances in mongostat.
.IP Note
SSL support in mongostat is not compiled into the default
distribution of MongoDB. See \fB/administration/ssl\fP for more
information on SSL and MongoDB.
.sp
Additionally, mongostat does not support connections to
\fBmongod\fP instances that require client certificate
validation.
.RE
.sp
Allows \fI\%mongostat\fP to connect to \fBmongod\fP
instance over an SSL connection.
.UNINDENT
.INDENT 0.0
.TP
.B \-u, \-\-username arg
username
.B \-\-username <username>, \-u <username>
Specifies a username to authenticate to the MongoDB instance, if your
database requires authentication. Use in conjunction with the
\fI\%mongostat --password\fP option to supply a password.
.UNINDENT
.INDENT 0.0
.TP
.B \-p, \-\-password arg
password
.B \-\-password <password>, \-p <password>
Specifies a password to authenticate to the MongoDB instance. Use
in conjunction with the \fI\%mongostat --username\fP option to
supply a username.
.sp
If you specify a \fI\%--username\fP
without the \fI\%--password\fP option, \fI\%mongostat\fP will
prompt for a password interactively.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-noheaders
don't output column names
.B \-\-authenticationDatabase <dbname>
New in version 2.4.
.sp
Specifies the database that holds the user\(aqs (e.g
\fI\%--username\fP) credentials.
.sp
By default, \fI\%mongostat\fP assumes that the database specified to the
\fI\-\-db\fP argument holds the user\(aqs credentials, unless you
specify \fI\%--authenticationDatabase\fP.
.sp
See \fBuserSource\fP,
\fB/reference/privilege\-documents\fP and
\fB/reference/user\-privileges\fP for more information about
delegated authentication in MongoDB.
.UNINDENT
.INDENT 0.0
.TP
.B \-n, \-\-rowcount arg
number of stats lines to print (0 for indefinite)
.B \-\-authenticationMechanism <name>
New in version 2.4.
.sp
Specifies the authentication mechanism. By default, the
authentication mechanism is \fBMONGODB\-CR\fP, which is the MongoDB
challenge/response authentication mechanism. In the MongoDB Subscriber Edition,
\fI\%mongostat\fP also includes support for \fBGSSAPI\fP to handle
Kerberos authentication.
.sp
See \fB/tutorial/control\-access\-to\-mongodb\-with\-kerberos\-authentication\fP
for more information about Kerberos authentication.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-http
use http instead of raw db connection
.B \-\-noheaders
Disables the output of column or field names.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-discover
discover nodes and display stats for all
.B \-\-rowcount <number>, \-n <number>
Controls the number of rows to output. Use in conjunction with
the \fBsleeptime\fP argument to control the duration of a
\fI\%mongostat\fP operation.
.sp
Unless \fI\%--rowcount\fP is specified, \fI\%mongostat\fP
will return an infinite number
of rows (e.g. value of \fB0\fP.)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-all
all optional fields
.SH "FIELDS"
.B \-\-http
Configures \fI\%mongostat\fP to collect data using the HTTP interface
rather than a raw database connection.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-discover
With this option \fI\%mongostat\fP discovers and reports on
statistics from all members of a \fIreplica set\fP or
\fIsharded cluster\fP. When connected to any member of a replica
set, \fI\%--discover\fP all non\-\fIhidden members\fP of the replica set. When connected to a \fBmongos\fP,
\fI\%mongostat\fP will return data from all \fIshards\fP in the cluster. If a replica set provides a shard in the
sharded cluster, \fI\%mongostat\fP will report on non\-hidden
members of that replica set.
.sp
The \fI\%mongostat --host\fP option is not required but
potentially useful in this case.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-all
Configures \fI\%mongostat\fP to return all optional \fI\%fields\fP.
.UNINDENT
.INDENT 0.0
.TP
.B <sleeptime>
The final argument is the length of time, in seconds, that
\fI\%mongostat\fP waits in between calls. By default \fI\%mongostat\fP
returns one call every second.
.sp
\fI\%mongostat\fP returns values that reflect the operations
over a 1 second period. For values of \fB<sleeptime>\fP greater
than 1, \fI\%mongostat\fP averages data to reflect average
operations per second.
.UNINDENT
.SH FIELDS
.sp
\fI\%mongostat\fP returns values that reflect the operations over a
1 second period. When \fBmongostat <sleeptime>\fP has a value
greater than 1, \fI\%mongostat\fP averages the statistics to reflect
average operations per second.
.sp
\fI\%mongostat\fP outputs the following fields:
.INDENT 0.0
.TP
.B inserts
# of inserts per second
The number of objects inserted into the database per second. If
followed by an asterisk (e.g. \fB*\fP), the datum refers to a
replicated operation.
.UNINDENT
.INDENT 0.0
.TP
.B query
# of queries per second
The number of query operations per second.
.UNINDENT
.INDENT 0.0
.TP
.B update
# of updates per second
The number of update operations per second.
.UNINDENT
.INDENT 0.0
.TP
.B delete
# of deletes per second
The number of delete operations per second.
.UNINDENT
.INDENT 0.0
.TP
.B getmore
# of get mores (cursor batch) per second
The number of get more (i.e. cursor batch) operations per second.
.UNINDENT
.INDENT 0.0
.TP
.B command
# of commands per second
The number of commands per second. On \fIslave\fP and
\fIsecondary\fP systems, \fI\%mongostat\fP presents two values
separated by a pipe character (e.g. \fB|\fP), in the form of
\fBlocal|replicated\fP commands.
.UNINDENT
.INDENT 0.0
.TP
.B flushes
# of fsync flushes per second
The number of \fIfsync\fP operations per second.
.UNINDENT
.INDENT 0.0
.TP
.B mapped
amount of data mmaped (total data size) megabytes
The total amount of data mapped in megabytes. This is the total
data size at the time of the last \fI\%mongostat\fP call.
.UNINDENT
.INDENT 0.0
.TP
.B visze
virtual size of process in megabytes
.B size
The amount of (virtual) memory in megabytes used by the process at
the time of the last \fI\%mongostat\fP call.
.UNINDENT
.INDENT 0.0
.TP
.B res
resident size of process in megabytes
The amount of (resident) memory in megabytes used by the process at
the time of the last \fI\%mongostat\fP call.
.UNINDENT
.INDENT 0.0
.TP
.B faults
# of pages faults per sec (linux only)
Changed in version 2.1.
.sp
The number of page faults per second.
.sp
Before version 2.1 this value was only provided for MongoDB
instances running on Linux hosts.
.UNINDENT
.INDENT 0.0
.TP
.B locked
percent of time in global write lock
The percent of time in a global write lock.
.sp
Changed in version 2.2: The \fBlocked db\fP field replaces the \fBlocked %\fP field to
more appropriate data regarding the database specific locks in
version 2.2.
.UNINDENT
.INDENT 0.0
.TP
.B idx
percent of btree page misses (sampled)
.B locked db
New in version 2.2.
.sp
The percent of time in the per\-database context\-specific
lock. \fI\%mongostat\fP will report the database that has spent
the most time since the last \fI\%mongostat\fP call with a write
lock.
.sp
This value represents the amount of time that the listed database
spent in a locked state \fIcombined\fP with the time that the
\fBmongod\fP spent in the global lock. Because of this, and
the sampling method, you may see some values greater than 100%.
.UNINDENT
.INDENT 0.0
.TP
.B idx miss
The percent of index access attempts that required a page fault
to load a btree node. This is a sampled value.
.UNINDENT
.INDENT 0.0
.TP
.B qr
queue lengths for clients waiting (read|write)
The length of the queue of clients waiting to read data from the
MongoDB instance.
.UNINDENT
.INDENT 0.0
.TP
.B qw
The length of the queue of clients waiting to write data from the
MongoDB instance.
.UNINDENT
.INDENT 0.0
.TP
.B ar
active clients (read|write)
The number of active clients performing read operations.
.UNINDENT
.INDENT 0.0
.TP
.B aw
The number of active clients performing write operations.
.UNINDENT
.INDENT 0.0
.TP
.B netIn
network traffic in - bits
The amount of network traffic, in \fIbytes\fP, received by the MongoDB instance.
.sp
This includes traffic from \fI\%mongostat\fP itself.
.UNINDENT
.INDENT 0.0
.TP
.B netOut
network traffic out - bits
The amount of network traffic, in \fIbytes\fP, sent by the MongoDB instance.
.sp
This includes traffic from \fI\%mongostat\fP itself.
.UNINDENT
.INDENT 0.0
.TP
.B conn
number of open connections
.SH "COPYRIGHT"
.PP
Copyright 2011 10gen
.SH "SEE ALSO"
For more information, please refer to the mongostat page in the MongoDB manual, available at http://dochub.mongodb.org/core/mongostatmanpage
.SH "AUTHOR"
Eliot Horowitz
The total number of open connections.
.UNINDENT
.INDENT 0.0
.TP
.B set
The name, if applicable, of the replica set.
.UNINDENT
.INDENT 0.0
.TP
.B repl
The replication status of the node.
.TS
center;
|l|l|.
_
T{
\fBValue\fP
T} T{
\fBReplication Type\fP
T}
_
T{
M
T} T{
\fImaster\fP
T}
_
T{
SEC
T} T{
\fIsecondary\fP
T}
_
T{
REC
T} T{
recovering
T}
_
T{
UNK
T} T{
unknown
T}
_
T{
SLV
T} T{
\fIslave\fP
T}
_
.TE
.UNINDENT
.SH USAGE
.sp
In the first example, \fI\%mongostat\fP will return data every
second for 20 seconds. \fI\%mongostat\fP collects data from the
\fBmongod\fP instance running on the localhost interface on
port 27017. All of the following invocations produce identical
behavior:
.sp
.nf
.ft C
mongostat \-\-rowcount 20 1
mongostat \-\-rowcount 20
mongostat \-n 20 1
mongostat \-n 20
.ft P
.fi
.sp
In the next example, \fI\%mongostat\fP returns data every 5 minutes
(or 300 seconds) for as long as the program runs. \fI\%mongostat\fP
collects data from the \fBmongod\fP instance running on the
localhost interface on port \fB27017\fP. Both of the following
invocations produce identical behavior.
.sp
.nf
.ft C
mongostat \-\-rowcount 0 300
mongostat \-n 0 300
mongostat 300
.ft P
.fi
.sp
In the following example, \fI\%mongostat\fP returns data every 5
minutes for an hour (12 times.) \fI\%mongostat\fP collects data
from the \fBmongod\fP instance running on the localhost interface
on port 27017. Both of the following invocations produce identical
behavior.
.sp
.nf
.ft C
mongostat \-\-rowcount 12 300
mongostat \-n 12 300
.ft P
.fi
.sp
In many cases, using the \fI\%--discover\fP
will help provide a more complete snapshot of the state of an entire
group of machines. If a \fBmongos\fP process connected to a
\fIsharded cluster\fP is running on port \fB27017\fP of the local
machine, you can use the following form to return statistics from all
members of the cluster:
.sp
.nf
.ft C
mongostat \-\-discover
.ft P
.fi
.SH AUTHOR
MongoDB Documentation Project
.SH COPYRIGHT
2011-2013, 10gen, Inc.
.\" Generated by docutils manpage writer.
.

304
debian/mongotop.1 vendored Normal file
View File

@ -0,0 +1,304 @@
.TH "MONGOTOP" "1" "March 14, 2013" "2.2.3" "mongodb-manual"
.SH NAME
mongotop \- MongoDB
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.\" Man page generated from reStructuredText.
.
.SH SYNOPSIS
.sp
\fI\%mongotop\fP provides a method to track the amount of time a
MongoDB instance spends reading and writing data. \fI\%mongotop\fP
provides statistics on a per\-collection level. By default,
\fI\%mongotop\fP returns values every second.
.IP "See also"
.sp
For more information about monitoring MongoDB, see
\fB/administration/monitoring\fP.
.sp
For additional background on various other MongoDB status outputs
see:
.INDENT 0.0
.IP \(bu 2
\fB/reference/server\-status\fP
.IP \(bu 2
\fB/reference/replica\-status\fP
.IP \(bu 2
\fB/reference/database\-statistics\fP
.IP \(bu 2
\fB/reference/collection\-statistics\fP
.UNINDENT
.sp
For an additional utility that provides MongoDB metrics
see "\fBmongostat\fP."
.RE
.SH OPTIONS
.INDENT 0.0
.TP
.B mongotop
.UNINDENT
.INDENT 0.0
.TP
.B \-\-help
Returns a basic help and usage text.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-verbose, \-v
Increases the amount of internal reporting returned on the command
line. Increase the verbosity with the \fB\-v\fP form by including the
option multiple times, (e.g. \fB\-vvvvv\fP.)
.UNINDENT
.INDENT 0.0
.TP
.B \-\-version
Print the version of the \fI\%mongotop\fP utility and exit.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-host <hostname><:port>
Specifies a resolvable hostname for the \fBmongod\fP from which you
want to export data. By default \fI\%mongotop\fP attempts to
connect to a MongoDB process running on the localhost port number
\fB27017\fP.
.sp
Optionally, specify a port number to connect a MongoDB instance
running on a port other than \fB27017\fP.
.sp
To connect to a replica set, you can specify the replica set seed
name, and a seed list of set members, in the following format:
.sp
.nf
.ft C
<replica_set_name>/<hostname1><:port>,<hostname2:<port>,...
.ft P
.fi
.UNINDENT
.INDENT 0.0
.TP
.B \-\-port <port>
Specifies the port number, if the MongoDB instance is not running on
the standard port. (i.e. \fB27017\fP) You may also specify a port
number using the \fI\%mongotop --host\fP command.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-ipv6
Enables IPv6 support that allows \fI\%mongotop\fP to connect
to the MongoDB instance using an IPv6 network. All MongoDB programs
and processes, including \fI\%mongotop\fP, disable IPv6
support by default.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-username <username>, \-u <username>
Specifies a username to authenticate to the MongoDB instance, if
your database requires authentication. Use in conjunction with the
\fI\%mongotop\fP option to supply a
password.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-password <password>, \-p <password>
Specifies a password to authenticate to the MongoDB instance. Use
in conjunction with the \fI\%--username\fP
option to supply a username.
.sp
If you specify a \fI\%--username\fP without
the \fI\%--password\fP option, \fI\%mongotop\fP will prompt
for a password interactively.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-authenticationDatabase <dbname>
New in version 2.4.
.sp
Specifies the database that holds the user\(aqs (e.g
\fI\%--username\fP) credentials.
.sp
By default, \fI\%mongotop\fP assumes that the database specified to the
\fI\-\-db\fP argument holds the user\(aqs credentials, unless you
specify \fI\%--authenticationDatabase\fP.
.sp
See \fBuserSource\fP,
\fB/reference/privilege\-documents\fP and
\fB/reference/user\-privileges\fP for more information about
delegated authentication in MongoDB.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-authenticationMechanism <name>
New in version 2.4.
.sp
Specifies the authentication mechanism. By default, the
authentication mechanism is \fBMONGODB\-CR\fP, which is the MongoDB
challenge/response authentication mechanism. In the MongoDB Subscriber Edition,
\fI\%mongotop\fP also includes support for \fBGSSAPI\fP to handle
Kerberos authentication.
.sp
See \fB/tutorial/control\-access\-to\-mongodb\-with\-kerberos\-authentication\fP
for more information about Kerberos authentication.
.UNINDENT
.INDENT 0.0
.TP
.B \-\-locks
New in version 2.2.
.sp
Toggles the mode of \fI\%mongotop\fP to report on use of
per\-database \fIlocks\fP. These data are useful for
measuring concurrent operations and lock percentage.
.UNINDENT
.INDENT 0.0
.TP
.B <sleeptime>
The final argument is the length of time, in seconds, that
\fI\%mongotop\fP waits in between calls. By default
\fI\%mongotop\fP returns data every second.
.UNINDENT
.SH FIELDS
.sp
\fI\%mongotop\fP returns time values specified in milliseconds
(ms.)
.sp
\fI\%mongotop\fP only reports active namespaces or databases,
depending on the \fI\%--locks\fP option. If you don\(aqt see a database
or collection, it has received no recent activity. You can issue a
simple operation in the \fBmongo\fP shell to generate activity to
affect the output of \fI\%mongotop\fP.
.INDENT 0.0
.TP
.B mongotop.ns
Contains the database namespace, which combines the database name
and collection.
.sp
Changed in version 2.2: If you use the \fI\%--locks\fP, the \fI\%ns\fP field does not
appear in the \fI\%mongotop\fP output.
.UNINDENT
.INDENT 0.0
.TP
.B mongotop.db
New in version 2.2.
.sp
Contains the name of the database. The database named \fB.\fP refers
to the global lock, rather than a specific database.
.sp
This field does not appear unless you have invoked
\fI\%mongotop\fP with the \fI\%--locks\fP option.
.UNINDENT
.INDENT 0.0
.TP
.B mongotop.total
Provides the total amount of time that this \fBmongod\fP spent
operating on this namespace.
.UNINDENT
.INDENT 0.0
.TP
.B mongotop.read
Provides the amount of time that this \fBmongod\fP spent
performing read operations on this namespace.
.UNINDENT
.INDENT 0.0
.TP
.B mongotop.write
Provides the amount of time that this \fBmongod\fP spent
performing write operations on this namespace.
.UNINDENT
.INDENT 0.0
.TP
.B mongotop.<timestamp>
Provides a time stamp for the returned data.
.UNINDENT
.SH USE
.sp
By default \fI\%mongotop\fP connects to the MongoDB instance
running on the localhost port \fB27017\fP. However, \fI\%mongotop\fP can optionally
connect to remote \fBmongod\fP
instances. See the \fI\%mongotop options\fP for more
information.
.sp
To force \fI\%mongotop\fP to return less frequently specify a number, in
seconds at the end of the command. In this example, \fI\%mongotop\fP will
return every 15 seconds.
.sp
.nf
.ft C
mongotop 15
.ft P
.fi
.sp
This command produces the following output:
.sp
.nf
.ft C
connected to: 127.0.0.1
ns total read write 2012\-08\-13T15:45:40
test.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
admin.system.indexes 0ms 0ms 0ms
admin. 0ms 0ms 0ms
ns total read write 2012\-08\-13T15:45:55
test.system.namespaces 0ms 0ms 0ms
local.system.replset 0ms 0ms 0ms
local.system.indexes 0ms 0ms 0ms
admin.system.indexes 0ms 0ms 0ms
admin. 0ms 0ms 0ms
.ft P
.fi
.sp
To return a \fI\%mongotop\fP report every 5 minutes, use the
following command:
.sp
.nf
.ft C
mongotop 300
.ft P
.fi
.sp
To report the use of per\-database locks, use \fI\%mongotop --locks\fP,
which produces the following output:
.sp
.nf
.ft C
$ mongotop \-\-locks
connected to: 127.0.0.1
db total read write 2012\-08\-13T16:33:34
local 0ms 0ms 0ms
admin 0ms 0ms 0ms
. 0ms 0ms 0ms
.ft P
.fi
.SH AUTHOR
MongoDB Documentation Project
.SH COPYRIGHT
2011-2013, 10gen, Inc.
.\" Generated by docutils manpage writer.
.

View File

@ -22,13 +22,27 @@ AddOption("--prefix",
help="installation root")
# Stub out has_option so that we can use it in SConscript.client
def has_option(name):
return False
# Stub out use_system_version_of_library so we can use it in SConscript.client
def use_system_version_of_library(name):
return True
env = Environment(BUILD_DIR='#build',
CLIENT_ARCHIVE='${CLIENT_DIST_BASENAME}${DIST_ARCHIVE_SUFFIX}',
CLIENT_DIST_BASENAME='mongo-cxx-driver',
CLIENT_LICENSE='#LICENSE.txt',
CLIENT_SCONSTRUCT='#SConstruct',
MSVS_ARCH=None,
PYTHON=sys.executable)
PYTHON=sys.executable,
PYSYSPLATFORM=os.sys.platform)
if env['PYSYSPLATFORM'] == 'linux3':
env['PYSYSPLATFORM'] = 'linux2'
if 'freebsd' in env['PYSYSPLATFORM']:
env['PYSYSPLATFORM'] = 'freebsd'
def addExtraLibs(s):
for x in s.split(","):
@ -44,18 +58,20 @@ env.Append(CPPDEFINES=[ "_SCONS", "MONGO_EXPOSE_MACROS" ])
nix = False
linux = False
win = False
windows = False
darwin = False
if "darwin" == sys.platform:
addExtraLibs( "/opt/local/" )
nix = True
darwin = True
elif sys.platform in ("linux2", "linux3"):
nix = True
linux = True
elif sys.platform == 'win32':
win = True
windows = True
if win:
if windows:
env['DIST_ARCHIVE_SUFFIX'] = '.zip'
env.Append(CCFLAGS=['/EHsc', '/O2'])
else:
@ -64,25 +80,36 @@ else:
if nix:
env.Append(CCFLAGS=["-O3", "-pthread"])
if linux:
env.Append(LINKFLAGS=["-Wl,--as-needed", "-Wl,-zdefs", "-pthread"])
env.Append(LINKFLAGS=["-pthread"])
boostLibs = ["thread", "filesystem", "system"]
conf = Configure(env)
for lib in boostLibs:
if not conf.CheckLib(["boost_%s-mt" % lib, "boost_%s" % lib],
language="C++"):
if not win:
if not windows:
Exit(1)
env['MONGO_BUILD_SASL_CLIENT'] = conf.CheckLibWithHeader(
"gsasl", "gsasl.h", "C", "gsasl_check_version(GSASL_VERSION);", autoadd=False)
"sasl2", "sasl/sasl.h", "C", "sasl_version_info(0, 0, 0, 0, 0, 0);", autoadd=False)
if (conf.CheckCXXHeader( "execinfo.h" ) and
conf.CheckDeclaration('backtrace', includes='#include <execinfo.h>') and
conf.CheckDeclaration('backtrace_symbols', includes='#include <execinfo.h>') and
conf.CheckDeclaration('backtrace_symbols_fd', includes='#include <execinfo.h>')):
env.Append( CPPDEFINES=[ "MONGO_HAVE_EXECINFO_BACKTRACE" ] )
conf.Finish()
clientEnv = env.Clone()
clientEnv['CPPDEFINES'].remove('MONGO_EXPOSE_MACROS')
class InstallSetup:
binaries = False
libraries = False
headers = False
installSetup = InstallSetup()
Export("env clientEnv")
Export("env has_option use_system_version_of_library installSetup")
Export("nix linux windows darwin")
env.SConscript('src/SConscript.client', variant_dir='$BUILD_DIR', duplicate=False)
mongoclient = env.Alias('mongoclient', ['${LIBPREFIX}mongoclient${LIBSUFFIX}'])

View File

@ -3,7 +3,7 @@
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = MongoDB
PROJECT_NUMBER = 2.4.0-rc3-pre-
PROJECT_NUMBER = 2.4.15-pre-
OUTPUT_DIRECTORY = docs/doxygen
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English

View File

@ -0,0 +1,38 @@
/**
* Tests aggregate command against mongos with slaveOk. For more tests on read preference,
* please refer to jstests/sharding/read_pref_cmd.js.
*/
var NODES = 2;
var doTest = function(st, doSharded) {
var testDB = st.s.getDB('test');
if (doSharded) {
testDB.adminCommand({ enableSharding: 'test' });
testDB.adminCommand({ shardCollection: 'test.user', key: { x: 1 }});
}
testDB.user.insert({ x: 10 });
testDB.runCommand({ getLastError: 1, w: NODES });
testDB.setSlaveOk(true);
var secNode = st.rs0.getSecondary();
secNode.getDB('test').setProfilingLevel(2);
var res = testDB.runCommand({ aggregate: 'user', pipeline: [{ $project: { x: 1 }}]});
assert(res.ok, 'aggregate command failed: ' + tojson(res));
var profileQuery = { op: 'command', ns: 'test.$cmd', 'command.aggregate': 'user' };
var profileDoc = secNode.getDB('test').system.profile.findOne(profileQuery);
assert(profileDoc != null);
testDB.dropDatabase();
};
var st = new ShardingTest({ shards: { rs0: { oplogSize: 10, verbose: 1, nodes: NODES }}});
doTest(st, false);
doTest(st, true);
st.stop();

View File

@ -0,0 +1,139 @@
// Test for SERVER-9129
// Verify global scope data does not persist past logout or auth.
// NOTE: Each test case covers 3 state transitions:
// no auth -> auth user 'a'
// auth user 'a' -> auth user 'b'
// auth user 'b' -> logout
//
// These transitions are tested for dbEval, $where, MapReduce and $group
var conn = MongoRunner.runMongod({ auth: "", smallfiles: ""});
var test = conn.getDB("test");
// insert a single document and add two test users
test.foo.insert({a:1});
test.getLastError();
assert.eq(1, test.foo.findOne().a);
test.addUser('a', 'a');
test.addUser('b', 'b');
function missingOrEquals(string) {
return 'function() { '
+ 'var global = function(){return this;}.call();'
// Uncomment the next line when debugging.
// + 'print(global.hasOwnProperty("someGlobal") ? someGlobal : "MISSING" );'
+ 'return !global.hasOwnProperty("someGlobal")'
+ ' || someGlobal == unescape("' + escape(string) + '");'
+'}()'
}
function testDbEval() {
// set the global variable 'someGlobal' before authenticating
test.eval('someGlobal = "noUsers";');
// test new user auth causes scope to be cleared
test.auth('a', 'a');
assert(test.eval('return ' + missingOrEquals('a')), "dbEval: Auth user 'a'");
// test auth as another user causes scope to be cleared
test.eval('someGlobal = "a";');
test.auth('b', 'b');
assert(test.eval('return ' + missingOrEquals('a&b')), "dbEval: Auth user 'b'");
// test user logout causes scope to be cleared
test.eval('someGlobal = "a&b";');
test.logout();
assert(test.eval('return ' + missingOrEquals('noUsers')), "dbEval: log out");
}
testDbEval();
testDbEval();
// test $where
function testWhere() {
// set the global variable 'someGlobal' before authenticating
test.foo.findOne({$where:'someGlobal = "noUsers";'});
// test new user auth causes scope to be cleared
test.auth('a', 'a');
assert.eq(1,
test.foo.count({$where: 'return ' + missingOrEquals('a')}),
"$where: Auth user 'a");
// test auth as another user causes scope to be cleared
test.foo.findOne({$where:'someGlobal = "a";'});
test.auth('b', 'b');
assert(test.foo.count({$where: 'return ' + missingOrEquals('a&b')}), "$where: Auth user 'b'");
// test user logout causes scope to be cleared
test.foo.findOne({$where:'someGlobal = "a&b";'});
test.logout();
assert(test.foo.count({$where: 'return ' + missingOrEquals('noUsers')}), "$where: log out");
}
testWhere();
testWhere();
function testMapReduce() {
var mapSet = function(string) { return Function('someGlobal = "' + string + '"'); }
var mapGet = function(string) { return Function('assert(' + missingOrEquals(string) +')'); }
var reduce = function(k, v) { }
var setGlobalInMap = function(string) {
test.foo.mapReduce(mapSet(string), reduce, {out:{inline:1}});
}
var getGlobalFromMap = function(string) {
test.foo.mapReduce(mapGet(string), reduce, {out:{inline:1}});
}
// set the global variable 'someGlobal' before authenticating
setGlobalInMap('noUsers');
// test new user auth causes scope to be cleared
test.auth('a', 'a');
getGlobalFromMap('a'); // throws on fail
// test auth as another user causes scope to be cleared
setGlobalInMap('a');
test.auth('b', 'b');
getGlobalFromMap('a&b'); // throws on fail
// test user logout causes scope to be cleared
setGlobalInMap('a&b');
test.logout();
getGlobalFromMap('noUsers'); // throws on fail
}
testMapReduce();
testMapReduce();
function testGroup() {
var setGlobalInGroup = function(string) {
return test.foo.group({key: 'a',
reduce: Function('doc1', 'agg',
'someGlobal = "' + string + '"'),
initial:{}});
}
var getGlobalFromGroup = function(string) {
return test.foo.group({key: 'a',
reduce: Function('doc1', 'agg',
'assert(' + missingOrEquals(string) +')'),
initial:{}});
}
// set the global variable 'someGlobal' before authenticating
setGlobalInGroup('noUsers');
// test new user auth causes scope to be cleared
test.auth('a', 'a');
getGlobalFromGroup('a'); // throws on fail
// test auth as another user causes scope to be cleared
setGlobalInGroup('a');
test.auth('b', 'b');
getGlobalFromGroup('a&b'); // throws on fail
// test user logout causes scope to be cleared
setGlobalInGroup('a&b');
test.logout();
getGlobalFromGroup('noUsers'); // throws on fail
}
testGroup();
testGroup();

View File

@ -0,0 +1,101 @@
/*
* Regression test for SECURITY-27.
*
* Verifies that creating a user named "__system" in any database does not get internal system
* privileges.
*
* Operates by creating an "admin" user for set-up, then creating __system users in the "test",
* "admin" and "local" databases. Then, it verifies that the __system@local user is shadowed for
* password and privilege purposes by the keyfile. It then procedes to verify that the
* __system@test and __system@admin users are _not_ shadowed in any way by the keyfile user.
*/
(function() {
"use strict";
// Runs the "count" command on a database in a way that returns the result document, for easier
// inspection of the errmsg.
function runCountCommand(conn, dbName, collectionName) {
return conn.getDB(dbName).runCommand({ count: collectionName });
}
// Asserts that on the given "conn", "dbName"."collectionName".count() fails as unauthorized.
function assertCountUnauthorized(conn, dbName, collectionName) {
assert.eq(runCountCommand(conn, dbName, collectionName).errmsg,
"unauthorized",
"On " + dbName + "." + collectionName);
}
var conn = MongoRunner.runMongod({ smallfiles: "", auth: "" });
var admin = conn.getDB('admin');
var test = conn.getDB('test');
var local = conn.getDB('local');
//
// Preliminary set up.
//
admin.addUser('admin', 'a');
admin.auth('admin', 'a');
//
// Add users named "__system" with no privileges on "test", "admin" and "local". The one in
// "local" is shadowed by the keyfile.
//
test.addUser({user: '__system', pwd: 'a', roles: []});
admin.addUser({user: '__system', pwd: 'a', roles: []});
local.addUser({user: '__system', pwd: 'a', roles: []});
//
// Add some data to count.
//
admin.foo.insert({_id: 1});
test.foo.insert({_id: 2});
local.foo.insert({_id: 3});
admin.logout();
assertCountUnauthorized(conn, "admin", "foo");
assertCountUnauthorized(conn, "local", "foo");
assertCountUnauthorized(conn, "test", "foo");
//
// Validate that you cannot even log in as __system@local with the supplied password; you _must_
// use the password from the keyfile.
//
assert(!local.auth('__system', 'a'))
assertCountUnauthorized(conn, "admin", "foo");
assertCountUnauthorized(conn, "local", "foo");
assertCountUnauthorized(conn, "test", "foo");
//
// Validate that __system@test is not shadowed by the keyfile __system user.
//
test.auth('__system', 'a');
assertCountUnauthorized(conn, "admin", "foo");
assertCountUnauthorized(conn, "local", "foo");
assertCountUnauthorized(conn, "test", "foo");
test.logout();
assertCountUnauthorized(conn, "admin", "foo");
assertCountUnauthorized(conn, "local", "foo");
assertCountUnauthorized(conn, "test", "foo");
//
// Validate that __system@test is not shadowed by the keyfile __system user.
//
admin.auth('__system', 'a');
assertCountUnauthorized(conn, "admin", "foo");
assertCountUnauthorized(conn, "local", "foo");
assertCountUnauthorized(conn, "test", "foo");
admin.logout();
assertCountUnauthorized(conn, "admin", "foo");
assertCountUnauthorized(conn, "local", "foo");
assertCountUnauthorized(conn, "test", "foo");
})();

View File

@ -8,7 +8,7 @@ benchArgs = { ops : [ { ns : t.getFullName() ,
query : { _id : { "#RAND_INT" : [ 0 , 5 , 4 ] } } ,
update : { $inc : { x : 1 } } } ] ,
parallel : 2 ,
seconds : 1 ,
seconds : 5 ,
totals : true ,
host : db.getMongo().host }
@ -24,4 +24,5 @@ printjson( res );
var keys = []
var totals = {}
db.bench_test3.find().sort( { _id : 1 } ).forEach( function(z){ keys.push( z._id ); totals[z._id] = z.x } );
printjson(totals);
assert.eq( [ 0 , 4 , 8 , 12 , 16 ] , keys )

View File

@ -0,0 +1,118 @@
// Test that serverStatus() features dependent on the ProcessInfo::blockCheckSupported() routine
// work correctly. These features are db.serverStatus({workingSet:1}).workingSet and
// db.serverStatus().indexCounters.
// Related to SERVER-9242, SERVER-6450.
// Check that an object contains a specific set of fields and only those fields
// NOTE: destroys 'item'
//
var testExpectedFields = function(itemString, item, fieldList) {
print('Testing ' + itemString + ' for expected fields');
for (var i = 0; i < fieldList.length; ++i) {
var field = fieldList[i];
if (typeof item[field] == 'undefined') {
doassert('Test FAILED: missing "' + field + '" field');
}
delete item[field];
}
if (!friendlyEqual({}, item)) {
doassert('Test FAILED: found unexpected field(s): ' + tojsononeline(item));
}
}
// Run test as function to keep cruft out of global namespace
//
var doTest = function () {
print('Testing workingSet and indexCounters portions of serverStatus');
var hostInfo = db.hostInfo();
var isXP = (hostInfo.os.name == 'Windows XP') ? true : false;
var isEmpty = (hostInfo.os.name == '') ? true : false;
// Check that the serverStatus command returns something for these sub-documents
//
var serverStatus = db.serverStatus({ workingSet: 1 });
if (!serverStatus) {
doassert('Test FAILED: db.serverStatus({workingSet:1}) did not return a value');
}
if (!serverStatus.workingSet) {
doassert('Test FAILED: db.serverStatus({workingSet:1}).workingSet was not returned');
}
if (!serverStatus.indexCounters) {
doassert('Test FAILED: db.serverStatus().indexCounters was not returned');
}
var workingSet_1 = serverStatus.workingSet;
var indexCounters_1 = serverStatus.indexCounters;
if (isXP) {
// Windows XP is the only supported platform that should be missing this data; make sure
// that we don't get bogus data back
//
var expectedResult = { info: 'not supported' };
print('Testing db.serverStatus({workingSet:1}).workingSet on Windows XP -- expecting ' +
tojsononeline(expectedResult));
assert.eq(expectedResult, workingSet_1,
'Test FAILED: db.serverStatus({workingSet:1}).workingSet' +
' did not return the expected value');
expectedResult = { note: 'not supported on this platform' };
print('Testing db.serverStatus().indexCounters on Windows XP -- expecting ' +
tojsononeline(expectedResult));
assert.eq(expectedResult, indexCounters_1,
'Test FAILED: db.serverStatus().indexCounters' +
' did not return the expected value');
}
else if (isEmpty) {
// Until SERVER-9325 is fixed, Solaris/SmartOS will also be missing this data; make sure
// that we don't get bogus data back
//
expectedResult = { info: 'not supported' };
print('Testing db.serverStatus({workingSet:1}).workingSet on "" (Solaris?) -- expecting ' +
tojsononeline(expectedResult));
assert.eq(expectedResult, workingSet_1,
'Test FAILED: db.serverStatus({workingSet:1}).workingSet' +
' did not return the expected value');
expectedResult = { note: 'not supported on this platform' };
print('Testing db.serverStatus().indexCounters on "" (Solaris?) -- expecting ' +
tojsononeline(expectedResult));
assert.eq(expectedResult, indexCounters_1,
'Test FAILED: db.serverStatus().indexCounters' +
' did not return the expected value');
}
else {
// Check that we get both workingSet and indexCounters and that all expected
// fields are present with no unexpected fields
//
testExpectedFields('db.serverStatus({workingSet:1}).workingSet',
workingSet_1,
['note', 'pagesInMemory', 'computationTimeMicros', 'overSeconds']);
testExpectedFields('db.serverStatus().indexCounters',
indexCounters_1,
['accesses', 'hits', 'misses', 'resets', 'missRatio']);
if (0) { // comment out until SERVER-9284 is fixed
// See if we can make the index counters values change
//
print('Testing that indexCounters accesses and hits increase by 1 on indexed find()');
var blockDB = db.getSiblingDB('block_check_supported');
blockDB.dropDatabase();
blockDB.coll.insert({ a: 1 });
blockDB.coll.ensureIndex({ a: 1 });
indexCounters_1 = db.serverStatus().indexCounters;
var doc = blockDB.coll.findOne({ a: 1 });
var indexCounters_2 = db.serverStatus().indexCounters;
assert.gt(indexCounters_2.accesses, indexCounters_1.accesses,
'Test FAILED: db.serverStatus().indexCounters.accesses' +
' should have had a value greater than ' + indexCounters_1.accesses +
': indexCounters: before find(): ' + tojsononeline(indexCounters_1) +
', after find(): ' + tojsononeline(indexCounters_2));
assert.gt(indexCounters_2.hits, indexCounters_1.hits,
'Test FAILED: db.serverStatus().indexCounters.hits' +
' should have had a value greater than ' + indexCounters_1.hits +
': indexCounters: before find(): ' + tojsononeline(indexCounters_1) +
', after find(): ' + tojsononeline(indexCounters_2));
} // comment out until SERVER-9284 is fixed
}
print('Test PASSED!');
};
doTest();

View File

@ -0,0 +1,99 @@
// Test validation of connection strings passed to the JavaScript "connect()" function.
// Related to SERVER-8030.
var goodStrings = [
"localhost:27999/test",
"127.0.0.1:27999/test"
];
var badStrings = [
{ s: undefined, r: /^Missing connection string$/ },
{ s: 7, r: /^Incorrect type/ },
{ s: null, r: /^Incorrect type/ },
{ s: "", r: /^Empty connection string$/ },
{ s: " ", r: /^Empty connection string$/ },
{ s: ":", r: /^Missing host name/ },
{ s: "/", r: /^Missing host name/ },
{ s: ":/", r: /^Missing host name/ },
{ s: ":/test", r: /^Missing host name/ },
{ s: ":27999/", r: /^Missing host name/ },
{ s: ":27999/test", r: /^Missing host name/ },
{ s: "/test", r: /^Missing host name/ },
{ s: "localhost:/test", r: /^Missing port number/ },
{ s: "127.0.0.1:/test", r: /^Missing port number/ },
{ s: "127.0.0.1:cat/test", r: /^Invalid port number/ },
{ s: "127.0.0.1:1cat/test", r: /^Invalid port number/ },
{ s: "127.0.0.1:123456/test", r: /^Invalid port number/ },
{ s: "127.0.0.1:65536/test", r: /^Invalid port number/ },
{ s: "::1:65536/test", r: /^Invalid port number/ },
{ s: "127.0.0.1:27999/", r: /^Missing database name/ },
{ s: "::1:27999/", r: /^Missing database name/ }
];
function testGood(i, connectionString) {
print("\nTesting good connection string " + i + " (\"" + connectionString + "\") ...");
var gotException = false;
var exception;
try {
var connectDB = connect(connectionString);
connectDB = null;
}
catch (e) {
gotException = true;
exception = e;
}
if (!gotException) {
print("Good connection string " + i +
" (\"" + connectionString + "\") correctly validated");
return;
}
var message = "FAILED to correctly validate goodString " + i +
" (\"" + connectionString + "\"): exception was \"" + tojson(exception) + "\"";
doassert(message);
}
function testBad(i, connectionString, errorRegex) {
print("\nTesting bad connection string " + i + " (\"" + connectionString + "\") ...");
var gotException = false;
var gotCorrectErrorText = false;
var exception;
try {
var connectDB = connect(connectionString);
connectDB = null;
}
catch (e) {
gotException = true;
exception = e;
if (errorRegex.test(e.message)) {
gotCorrectErrorText = true;
}
}
if (gotCorrectErrorText) {
print("Bad connection string " + i + " (\"" + connectionString +
"\") correctly rejected:\n" + tojson(exception));
return;
}
var message = "FAILED to generate correct exception for badString " + i +
" (\"" + connectionString + "\"): ";
if (gotException) {
message += "exception was \"" + tojson(exception) +
"\", it should have matched \"" + errorRegex.toString() + "\"";
}
else {
message += "no exception was thrown";
}
doassert(message);
}
var i;
jsTest.log("TESTING " + goodStrings.length + " good connection strings");
for (i = 0; i < goodStrings.length; ++i) {
testGood(i, goodStrings[i]);
}
jsTest.log("TESTING " + badStrings.length + " bad connection strings");
for (i = 0; i < badStrings.length; ++i) {
testBad(i, badStrings[i].s, badStrings[i].r);
}
jsTest.log("SUCCESSFUL test completion");

230
jstests/constructors.js Normal file
View File

@ -0,0 +1,230 @@
// Tests to see what validity checks are done for 10gen specific object construction
function clientEvalConstructorTest (constructorList) {
var i;
constructorList.valid.forEach(function (constructor) {
try {
eval(constructor);
}
catch (e) {
throw ("valid constructor: " + constructor + " failed in eval context: " + e);
}
});
constructorList.invalid.forEach(function (constructor) {
assert.throws(function () { eval(constructor) },
[], "invalid constructor did not throw error in eval context: " + constructor);
});
}
function dbEvalConstructorTest (constructorList) {
var i;
constructorList.valid.forEach(function (constructor) {
try {
db.eval(constructor);
}
catch (e) {
throw ("valid constructor: " + constructor + " failed in db.eval context: " + e);
}
});
constructorList.invalid.forEach(function (constructor) {
assert.throws(function () { db.eval(constructor) },
[], "invalid constructor did not throw error in db.eval context: " + constructor);
});
}
function mapReduceConstructorTest (constructorList) {
t = db.mr_constructors;
t.drop();
t.save( { "partner" : 1, "visits" : 9 } )
t.save( { "partner" : 2, "visits" : 9 } )
t.save( { "partner" : 1, "visits" : 11 } )
t.save( { "partner" : 1, "visits" : 30 } )
t.save( { "partner" : 2, "visits" : 41 } )
t.save( { "partner" : 2, "visits" : 41 } )
constructorList.valid.forEach(function (constructor) {
try {
m = eval("dummy = function(){ emit( \"test\" , " + constructor + " ) }");
r = eval("dummy = function( k , v ){ return { test : " + constructor + " } }");
res = t.mapReduce( m , r , { out : "mr_constructors_out" , scope : { xx : 1 } } );
}
catch (e) {
throw ("valid constructor: " + constructor + " failed in mapReduce context: " + e);
}
});
constructorList.invalid.forEach(function (constructor) {
m = eval("dummy = function(){ emit( \"test\" , " + constructor + " ) }");
r = eval("dummy = function( k , v ){ return { test : " + constructor + " } }");
assert.throws(function () { res = t.mapReduce( m , r ,
{ out : "mr_constructors_out" , scope : { xx : 1 } } ) },
[], "invalid constructor did not throw error in mapReduce context: " + constructor);
});
db.mr_constructors_out.drop();
t.drop();
}
function whereConstructorTest (constructorList) {
t = db.where_constructors;
t.drop();
t.insert({ x : 1 });
assert(!db.getLastError());
constructorList.valid.forEach(function (constructor) {
try {
t.findOne({ $where : constructor });
}
catch (e) {
throw ("valid constructor: " + constructor + " failed in $where query: " + e);
}
});
constructorList.invalid.forEach(function (constructor) {
assert.throws(function () { t.findOne({ $where : constructor }) },
[], "invalid constructor did not throw error in $where query: " + constructor);
});
}
var dbrefConstructors = {
"valid" : [
"DBRef(\"namespace\", 0)",
"DBRef(\"namespace\", \"test\")",
"DBRef(\"namespace\", ObjectId())",
"DBRef(\"namespace\", ObjectId(\"000000000000000000000000\"))",
],
"invalid" : [
"DBRef()",
"DBRef(true, ObjectId())",
"DBRef(\"namespace\")",
"DBRef(\"namespace\", ObjectId(), true)"
]
}
var dbpointerConstructors = {
"valid" : [
"DBPointer(\"namespace\", ObjectId())",
"DBPointer(\"namespace\", ObjectId(\"000000000000000000000000\"))",
],
"invalid" : [
"DBPointer()",
"DBPointer(true, ObjectId())",
"DBPointer(\"namespace\", 0)",
"DBPointer(\"namespace\", \"test\")",
"DBPointer(\"namespace\")",
"DBPointer(\"namespace\", ObjectId(), true)"
]
}
var objectidConstructors = {
"valid" : [
'ObjectId()',
'ObjectId("FFFFFFFFFFFFFFFFFFFFFFFF")',
'new ObjectId()',
'new ObjectId("FFFFFFFFFFFFFFFFFFFFFFFF")'
],
"invalid" : [
'ObjectId(5)',
'ObjectId("FFFFFFFFFFFFFFFFFFFFFFFQ")',
'new ObjectId(5)',
'new ObjectId("FFFFFFFFFFFFFFFFFFFFFFFQ")'
]
}
var timestampConstructors = {
"valid" : [
'Timestamp()',
'Timestamp(0,0)',
'new Timestamp()',
'new Timestamp(0,0)',
'Timestamp(1.0,1.0)',
'new Timestamp(1.0,1.0)',
],
"invalid" : [
'Timestamp(0)',
'Timestamp(0,0,0)',
'new Timestamp(0)',
'new Timestamp(0,0,0)',
'Timestamp("test","test")',
'Timestamp("test",0)',
'Timestamp(0,"test")',
'new Timestamp("test","test")',
'new Timestamp("test",0)',
'new Timestamp(0,"test")',
'Timestamp(true,true)',
'Timestamp(true,0)',
'Timestamp(0,true)',
'new Timestamp(true,true)',
'new Timestamp(true,0)',
'new Timestamp(0,true)'
]
}
var bindataConstructors = {
"valid" : [
'BinData(0,"test")',
//'BinData()', SERVER-8961
'new BinData(0,"test")',
//'new BinData()' SERVER-8961
],
"invalid" : [
'BinData(0,"test", "test")',
'new BinData(0,"test", "test")'
]
}
var dateConstructors = {
"valid" : [
'Date()',
'Date(0)',
'Date(0,0)',
'Date(0,0,0)',
'Date("foo")',
'new Date()',
'new Date(0)',
'new Date(0,0)',
'new Date(0,0,0)',
'new Date(0,0,0,0)',
'new Date("foo")'
],
"invalid" : [
]
}
clientEvalConstructorTest(dbrefConstructors);
clientEvalConstructorTest(dbpointerConstructors);
clientEvalConstructorTest(objectidConstructors);
clientEvalConstructorTest(timestampConstructors);
clientEvalConstructorTest(bindataConstructors);
clientEvalConstructorTest(dateConstructors);
dbEvalConstructorTest(dbrefConstructors);
dbEvalConstructorTest(dbpointerConstructors);
dbEvalConstructorTest(objectidConstructors);
dbEvalConstructorTest(timestampConstructors);
dbEvalConstructorTest(bindataConstructors);
dbEvalConstructorTest(dateConstructors);
// SERVER-8963
if (db.runCommand({buildinfo:1}).javascriptEngine == "V8") {
mapReduceConstructorTest(dbrefConstructors);
mapReduceConstructorTest(dbpointerConstructors);
mapReduceConstructorTest(objectidConstructors);
mapReduceConstructorTest(timestampConstructors);
mapReduceConstructorTest(bindataConstructors);
}
mapReduceConstructorTest(dateConstructors);
// SERVER-8963
if (db.runCommand({buildinfo:1}).javascriptEngine == "V8") {
whereConstructorTest(dbrefConstructors);
whereConstructorTest(dbpointerConstructors);
whereConstructorTest(objectidConstructors);
whereConstructorTest(timestampConstructors);
whereConstructorTest(bindataConstructors);
}
whereConstructorTest(dateConstructors);

22
jstests/dbhash2.js Normal file
View File

@ -0,0 +1,22 @@
mydb = db.getSisterDB( "config" );
t = mydb.foo;
t.drop();
t.insert( { x : 1 } );
res1 = mydb.runCommand( "dbhash" );
assert( res1.fromCache.indexOf( "config.foo" ) == -1 );
res2 = mydb.runCommand( "dbhash" );
assert( res2.fromCache.indexOf( "config.foo" ) >= 0 );
assert.eq( res1.collections.foo, res2.collections.foo );
t.insert( { x : 2 } );
res3 = mydb.runCommand( "dbhash" );
assert( res3.fromCache.indexOf( "config.foo" ) < 0 );
assert.neq( res1.collections.foo, res3.collections.foo );

22
jstests/dbref3.js Normal file
View File

@ -0,0 +1,22 @@
// Make sure we only make a DBRef object for objects where the first field is a string named $ref
// and the second field is $id with any type. Only the first two fields matter for deciding if it
// is a DBRef. See http://docs.mongodb.org/manual/reference/database-references/#dbrefs.
var t = db.dbref3
// true cases
t.insert({sub: {$ref: "foo", $id: "bar"}, dbref: true});
t.insert({sub: {$ref: "foo", $id: "bar", $db: "baz"}, dbref: true});
t.insert({sub: {$ref: "foo", $id: "bar", db: "baz"}, dbref: true}); // out of spec but accepted
t.insert({sub: {$ref: "foo", $id: ObjectId()}, dbref: true});
t.insert({sub: {$ref: "foo", $id: 1}, dbref: true});
t.insert({sub: {$ref: 123/*not a string*/, $id: "bar"}, dbref: false});
t.insert({sub: {$id: "bar", $ref: "foo"}, dbref: false});
t.insert({sub: {$ref: "foo"}, dbref: false});
t.insert({sub: {$id: "foo"}, dbref: false});
t.insert({sub: {other: 1, $ref: "foo", $id: "bar"}, dbref: false});
t.find().forEach(function(obj) {
assert.eq(obj.sub.constructor == DBRef, obj.dbref, tojson(obj));
});

View File

@ -23,7 +23,6 @@ p = startParallelShell( 'for( i = 0; i < 2500; ++i ) {
' db.jstests_distinct3.save( { a:49, c:49, d:j } ); ' +
' } ' +
'} ' +
'// Wait for the above writes to complete. ' +
'db.getLastError(); ' );
for( i = 0; i < 100; ++i ) {

View File

@ -6,12 +6,21 @@ m = db.getMongo();
baseName = "jstests_dropdb";
ddb = db.getSisterDB( baseName );
print("initial dbs: " + tojson(m.getDBNames()));
function check(shouldExist) {
var dbs = m.getDBNames();
assert.eq(Array.contains(dbs, baseName), shouldExist,
"DB " + baseName + " should " + (shouldExist ? "" : "not ") + "exist."
+ " dbs: " + tojson(dbs));
}
ddb.c.save( {} );
ddb.getLastError();
assert.neq( -1, m.getDBNames().indexOf( baseName ) );
check(true);
ddb.dropDatabase();
assert.eq( -1, m.getDBNames().indexOf( baseName ) );
check(false);
ddb.dropDatabase();
assert.eq( -1, m.getDBNames().indexOf( baseName ) );
check(false);

89
jstests/dur/checksum.js Normal file
View File

@ -0,0 +1,89 @@
// Test checksum validation of journal files.
var testname = "dur_checksum";
var path = MongoRunner.dataPath + testname;
if (0) {
// This is used to create the prototype journal file.
jsTest.log("Just creating prototype journal, not testing anything");
var conn = startMongodEmpty("--port", 30001, "--dbpath", path, "--dur");
var db = conn.getDB("test");
// each insert is in it's own commit.
db.foo.insert({a: 1});
db.runCommand({getlasterror:1, j:1})
db.foo.insert({a: 2});
db.runCommand({getlasterror:1, j:1})
stopMongod(30001, /*signal*/9);
jsTest.log("Journal file left at " + path + "/journal/j._0");
quit();
// A hex editor must be used to replace the checksums of specific journal sections with
// "0BADC0DE 1BADC0DE 2BADC0DE 3BADCD0E"
}
function startMongodWithJournal() {
return startMongodNoReset("--port", 30001,
"--dbpath", path,
"--dur",
"--smallfiles",
"--durOptions", 1 /*DurDumpJournal*/);
}
jsTest.log("Starting with good.journal to make sure everything works");
resetDbpath(path);
mkdir(path + '/journal');
copyFile("jstests/libs/dur_checksum_good.journal", path + "/journal/j._0");
var conn = startMongodWithJournal();
var db = conn.getDB('test');
assert.eq(db.foo.count(), 2);
stopMongod(30001);
// dur_checksum_bad_last.journal is good.journal with the bad checksum on the last section.
jsTest.log("Starting with bad_last.journal");
resetDbpath(path);
mkdir(path + '/journal');
copyFile("jstests/libs/dur_checksum_bad_last.journal", path + "/journal/j._0");
conn = startMongodWithJournal();
var db = conn.getDB('test');
assert.eq(db.foo.count(), 1); // 2nd insert "never happened"
stopMongod(30001);
// dur_checksum_bad_first.journal is good.journal with the bad checksum on the prior section.
// This means there is a good commit after the bad one. We currently ignore this, but a future
// version of the server may be able to detect this case.
jsTest.log("Starting with bad_first.journal");
resetDbpath(path);
mkdir(path + '/journal');
copyFile("jstests/libs/dur_checksum_bad_first.journal", path + "/journal/j._0");
conn = startMongodWithJournal();
var db = conn.getDB('test');
assert.eq(db.foo.count(), 0); // Neither insert happened.
stopMongod(30001);
// If we detect an error in a non-final journal file, that is considered an error.
jsTest.log("Starting with bad_last.journal followed by good.journal");
resetDbpath(path);
mkdir(path + '/journal');
copyFile("jstests/libs/dur_checksum_bad_first.journal", path + "/journal/j._0");
copyFile("jstests/libs/dur_checksum_good.journal", path + "/journal/j._1");
exitCode = runMongoProgram("mongod",
"--port", 30001,
"--dbpath", path,
"--dur",
"--smallfiles",
"--durOptions", 1 /*DurDumpJournal*/
+ 2 /*DurScanOnly*/);
assert.eq(exitCode, 100 /*EXIT_UNCAUGHT*/);
// TODO Possibly we could check the mongod log to verify that the correct type of exception was
// thrown. But that would introduce a dependency on the mongod log format, which we may not want.
jsTest.log("SUCCESS checksum.js");

View File

@ -89,12 +89,19 @@ function f(variant, quickCommits, paranoid) {
stopMongod(30001);
}
for (var variant=0; variant < 4; variant++){
for (var quickCommits=0; quickCommits <= 1; quickCommits++){ // false then true
for (var paranoid=0; paranoid <= 1; paranoid++){ // false then true
f(variant, quickCommits, paranoid);
sleep(500);
// Skip this test on 32-bit Windows (unfixable failures in MapViewOfFileEx)
//
if (_isWindows() && getBuildInfo().bits == 32 ) {
print("Skipping closeall.js on 32-bit Windows");
}
else {
for (var variant=0; variant < 4; variant++){
for (var quickCommits=0; quickCommits <= 1; quickCommits++){ // false then true
for (var paranoid=0; paranoid <= 1; paranoid++){ // false then true
f(variant, quickCommits, paranoid);
sleep(500);
}
}
}
print("SUCCESS closeall.js");
}
print("SUCCESS closeall.js");

View File

@ -1,4 +1,13 @@
/** Test running out of disk space with durability enabled */
/** Test running out of disk space with durability enabled.
To set up the test, it's required to set up a small partition something like the following:
sudo umount /data/db/diskfulltest/
rm -rf /data/db/diskfulltest
mkdir -p /data/images
dd bs=512 count=83968 if=/dev/zero of=/data/images/diskfulltest.img
/sbin/mkfs.ext2 -m 0 -F /data/images/diskfulltest.img
mkdir -p /data/db/diskfulltest
mount -o loop /data/images/diskfulltest.img /data/db/diskfulltest
*/
startPath = "/data/db/diskfulltest";
recoverPath = "/data/db/dur_diskfull";
@ -52,7 +61,10 @@ function work() {
var d = conn.getDB("test");
big = new Array( 5000 ).toString();
for( i = 0; i < 10000; ++i ) {
// This part of the test depends on the partition size used in the build env
// Currently, unused, but with larger partitions insert enough documents here
// to create a second db file
for( i = 0; i < 1; ++i ) {
d.foo.insert( { _id:i, b:big } );
}

View File

@ -1,101 +0,0 @@
/**
* Test md5 validation of journal file.
* This test is dependent on the journal file format and may require an update if the format changes,
* see comments near fuzzFile() below.
*/
var debugging = false;
var testname = "dur_md5";
var step = 1;
var conn = null;
function log(str) {
print();
if(str)
print(testname+" step " + step++ + " " + str);
else
print(testname+" step " + step++);
}
/** Changes here may require updating the byte index of the md5 hash, see File comments below. */
function work() {
log("work");
var d = conn.getDB("test");
d.foo.insert({ _id: 3, x: 22 });
d.foo.insert({ _id: 4, x: 22 });
d.a.insert({ _id: 3, x: 22, y: [1, 2, 3] });
d.a.insert({ _id: 4, x: 22, y: [1, 2, 3] });
d.a.update({ _id: 4 }, { $inc: { x: 1} });
// try building an index. however, be careful as object id's in system.indexes would vary, so we do it manually:
d.system.indexes.insert({ _id: 99, ns: "test.a", key: { x: 1 }, name: "x_1", v: 0 });
// d.a.update({ _id: 4 }, { $inc: { x: 1} });
// d.a.reIndex();
// assure writes applied in case we kill -9 on return from this function
d.getLastError();
log("endwork");
}
if( debugging ) {
// mongod already running in debugger
conn = db.getMongo();
work();
sleep(30000);
quit();
}
log();
var path = "/data/db/" + testname+"dur";
log();
conn = startMongodEmpty("--port", 30001, "--dbpath", path, "--dur", "--smallfiles", "--durOptions", 8);
work();
// wait for group commit.
printjson(conn.getDB('admin').runCommand({getlasterror:1, fsync:1}));
log("kill -9");
// kill the process hard
stopMongod(30001, /*signal*/9);
// journal file should be present, and non-empty as we killed hard
// Bit flip the first byte of the md5sum contained within the opcode footer.
// This ensures we get an md5 exception instead of some other type of exception.
var file = path + "/journal/j._0";
// if test fails, uncomment these "cp" lines to debug:
// run("cp", file, "/tmp/before");
// journal header is 8192
// jsectheader is 20
// so a little beyond that
fuzzFile(file, 8214+8);
// run("cp", file, "/tmp/after");
log("run mongod again recovery should fail");
// 100 exit code corresponds to EXIT_UNCAUGHT, which is triggered when there is an exception during recovery.
// 14 is is sometimes triggered instead due to SERVER-2184
exitCode = runMongoProgram( "mongod", "--port", 30002, "--dbpath", path, "--dur", "--smallfiles", "--durOptions", /*9*/13 );
if (exitCode != 100 && exitCode != 14) {
print("\n\n\nFAIL md5.js expected mongod to fail but didn't? mongod exitCode: " + exitCode + "\n\n\n");
// sleep a little longer to get more output maybe
sleep(2000);
assert(false);
}
// TODO Possibly we could check the mongod log to verify that the correct type of exception was thrown. But
// that would introduce a dependency on the mongod log format, which we may not want.
print("SUCCESS md5.js");
// if we sleep a littler here we may get more out the mongod output logged
sleep(500);

View File

@ -1,12 +1,12 @@
t = db.test;
t = db.eval2;
t.drop();
t.save({a:1});
t.save({a:1});
var f = db.group(
{
ns: "test",
ns: t.getName(),
key: { a:true},
cond: { a:1 },
reduce: function(obj,prev) { prev.csum++; } ,

View File

@ -5,14 +5,14 @@ lookAtDocumentMetrics = false;
if ( db.serverStatus().metrics ) {
var ss = db.serverStatus();
lookAtDocumentMetrics = ss.metrics.document != null && ss.metrics.document.scanned != null;
lookAtDocumentMetrics = ss.metrics.document != null && ss.metrics.queryExecutor.scanned != null;
}
print( "lookAtDocumentMetrics: " + lookAtDocumentMetrics );
if ( lookAtDocumentMetrics ) {
// ignore mongos
nscannedStart = db.serverStatus().metrics.document.scanned
nscannedStart = db.serverStatus().metrics.queryExecutor.scanned
}
@ -47,6 +47,6 @@ assert(t.validate().valid,"not valid");
if ( lookAtDocumentMetrics ) {
// ignore mongos
nscannedEnd = db.serverStatus().metrics.document.scanned
nscannedEnd = db.serverStatus().metrics.queryExecutor.scanned
assert.lte( nscannedStart + 16, nscannedEnd );
}

135
jstests/fts_index3.js Normal file
View File

@ -0,0 +1,135 @@
// Test that updates to fields in a text-indexed document are correctly reflected in the text index.
load("jstests/libs/fts.js");
var coll = db.fts_index3;
var res;
// 1) Create a text index on a single field, insert a document, update the value of the field, and
// verify that searching with the new value returns the document.
coll.drop();
res = coll.ensureIndex({a: "text"});
assert.isnull(res);
coll.insert({a: "hello"});
assert(!db.getLastError());
assert.eq(1, coll.runCommand("text", {search: "hello"}).stats.n);
coll.update({}, {$set: {a: "world"}});
assert(!db.getLastError());
assert.eq(0, coll.runCommand("text", {search: "hello"}).stats.n);
assert.eq(1, coll.runCommand("text", {search: "world"}).stats.n);
// 2) Same as #1, but with a wildcard text index.
coll.drop();
res = coll.ensureIndex({"$**": "text"});
assert.isnull(res);
coll.insert({a: "hello"});
assert(!db.getLastError());
assert.eq(1, coll.runCommand("text", {search: "hello"}).stats.n);
coll.update({}, {$set: {a: "world"}});
assert(!db.getLastError());
assert.eq(0, coll.runCommand("text", {search: "hello"}).stats.n);
assert.eq(1, coll.runCommand("text", {search: "world"}).stats.n);
// 3) Create a compound text index with an index prefix, insert a document, update the value of the
// index prefix field, and verify that searching with the new value returns the document.
coll.drop();
res = coll.ensureIndex({a: 1, b: "text"});
assert.isnull(res);
coll.insert({a: 1, b: "hello"});
assert(!db.getLastError());
assert.eq(1, coll.runCommand("text", {search: "hello", filter: {a: 1}}).stats.n);
coll.update({}, {$set: {a: 2}});
assert(!db.getLastError());
assert.eq(0, coll.runCommand("text", {search: "hello", filter: {a: 1}}).stats.n);
assert.eq(1, coll.runCommand("text", {search: "hello", filter: {a: 2}}).stats.n);
// 4) Same as #3, but with a wildcard text index.
coll.drop();
res = coll.ensureIndex({a: 1, "$**": "text"});
assert.isnull(res);
coll.insert({a: 1, b: "hello"});
assert(!db.getLastError());
assert.eq(1, coll.runCommand("text", {search: "hello", filter: {a: 1}}).stats.n);
coll.update({}, {$set: {a: 2}});
assert(!db.getLastError());
assert.eq(0, coll.runCommand("text", {search: "hello", filter: {a: 1}}).stats.n);
assert.eq(1, coll.runCommand("text", {search: "hello", filter: {a: 2}}).stats.n);
// 5) Create a compound text index with an index suffix, insert a document, update the value of the
// index suffix field, and verify that searching with the new value returns the document.
coll.drop();
res = coll.ensureIndex({a: "text", b: 1});
assert.isnull(res);
coll.insert({a: "hello", b: 1});
assert(!db.getLastError());
assert.eq(1, coll.runCommand("text", {search: "hello", filter: {b: 1}}).stats.n);
coll.update({}, {$set: {b: 2}});
assert(!db.getLastError());
assert.eq(0, coll.runCommand("text", {search: "hello", filter: {b: 1}}).stats.n);
assert.eq(1, coll.runCommand("text", {search: "hello", filter: {b: 2}}).stats.n);
// 6) Same as #5, but with a wildcard text index.
coll.drop();
res = coll.ensureIndex({"$**": "text", b: 1});
assert.isnull(res);
coll.insert({a: "hello", b: 1});
assert(!db.getLastError());
assert.eq(1, coll.runCommand("text", {search: "hello", filter: {b: 1}}).stats.n);
coll.update({}, {$set: {b: 2}});
assert(!db.getLastError());
assert.eq(0, coll.runCommand("text", {search: "hello", filter: {b: 1}}).stats.n);
assert.eq(1, coll.runCommand("text", {search: "hello", filter: {b: 2}}).stats.n);
// 7) Create a text index on a single field, insert a document, update the language of the document
// (so as to change the stemming), and verify that searching with the new language returns the
// document.
coll.drop();
res = coll.ensureIndex({a: "text"});
assert.isnull(res);
coll.insert({a: "testing", language: "spanish"});
assert(!db.getLastError());
assert.eq(1, coll.runCommand("text", {search: "testing", language: "spanish"}).stats.n);
assert.eq(0, coll.runCommand("text", {search: "testing", language: "english"}).stats.n);
coll.update({}, {$set: {language: "english"}});
assert(!db.getLastError());
assert.eq(0, coll.runCommand("text", {search: "testing", language: "spanish"}).stats.n);
assert.eq(1, coll.runCommand("text", {search: "testing", language: "english"}).stats.n);
// 8) Same as #7, but with a wildcard text index.
coll.drop();
res = coll.ensureIndex({"$**": "text"});
assert.isnull(res);
coll.insert({a: "testing", language: "spanish"});
assert(!db.getLastError());
assert.eq(1, coll.runCommand("text", {search: "testing", language: "spanish"}).stats.n);
assert.eq(0, coll.runCommand("text", {search: "testing", language: "english"}).stats.n);
coll.update({}, {$set: {language: "english"}});
assert(!db.getLastError());
assert.eq(0, coll.runCommand("text", {search: "testing", language: "spanish"}).stats.n);
assert.eq(1, coll.runCommand("text", {search: "testing", language: "english"}).stats.n);
// 9) Create a text index on a single field with a custom language override, insert a document,
// update the language of the document (so as to change the stemming), and verify that searching
// with the new language returns the document.
coll.drop();
res = coll.ensureIndex({a: "text"}, {language_override: "idioma"});
assert.isnull(res);
coll.insert({a: "testing", idioma: "spanish"});
assert(!db.getLastError());
assert.eq(1, coll.runCommand("text", {search: "testing", language: "spanish"}).stats.n);
assert.eq(0, coll.runCommand("text", {search: "testing", language: "english"}).stats.n);
coll.update({}, {$set: {idioma: "english"}});
assert(!db.getLastError());
assert.eq(0, coll.runCommand("text", {search: "testing", language: "spanish"}).stats.n);
assert.eq(1, coll.runCommand("text", {search: "testing", language: "english"}).stats.n);
// 10) Same as #9, but with a wildcard text index.
coll.drop();
res = coll.ensureIndex({"$**": "text"}, {language_override: "idioma"});
assert.isnull(res);
coll.insert({a: "testing", idioma: "spanish"});
assert(!db.getLastError());
assert.eq(1, coll.runCommand("text", {search: "testing", language: "spanish"}).stats.n);
assert.eq(0, coll.runCommand("text", {search: "testing", language: "english"}).stats.n);
coll.update({}, {$set: {idioma: "english"}});
assert(!db.getLastError());
assert.eq(0, coll.runCommand("text", {search: "testing", language: "spanish"}).stats.n);
assert.eq(1, coll.runCommand("text", {search: "testing", language: "english"}).stats.n);

View File

@ -18,3 +18,6 @@ assert.eq( [ 1 ], queryIDS( t, "foo" , { x : 1 } ) );
res = t.runCommand( "text", { search : "foo" , filter : { x : 1 } } );
assert( res.results[0].score > 0, tojson( res ) )
// repeat search with "language" specified, SERVER-8999
res = t.runCommand( "text", { search : "foo" , filter : { x : 1 } , language : "english" } );
assert( res.results[0].score > 0, tojson( res ) )

View File

@ -2,35 +2,36 @@
// Tests to make sure that nested multi-key indexing works for geo indexes and is not used for direct position
// lookups
db.test.drop()
db.test.insert({ p : [1112,3473], t : [{ k : 'a', v : 'b' }, { k : 'c', v : 'd' }] })
db.test.ensureIndex({ p : '2d', 't.k' : 1 }, { min : 0, max : 10000 })
var coll = db.geo_circle2a;
coll.drop();
coll.insert({ p : [1112,3473], t : [{ k : 'a', v : 'b' }, { k : 'c', v : 'd' }] })
coll.ensureIndex({ p : '2d', 't.k' : 1 }, { min : 0, max : 10000 })
// Succeeds, since on direct lookup should not use the index
assert(1 == db.test.find({p:[1112,3473],'t.k':'a'}).count(), "A")
assert(1 == coll.find({p:[1112,3473],'t.k':'a'}).count(), "A")
// Succeeds and uses the geo index
assert(1 == db.test.find({p:{$within:{$box:[[1111,3472],[1113,3475]]}}, 't.k' : 'a' }).count(), "B")
assert(1 == coll.find({p:{$within:{$box:[[1111,3472],[1113,3475]]}}, 't.k' : 'a' }).count(), "B")
db.test.drop()
db.test.insert({ point:[ 1, 10 ], tags : [ { k : 'key', v : 'value' }, { k : 'key2', v : 123 } ] })
db.test.insert({ point:[ 1, 10 ], tags : [ { k : 'key', v : 'value' } ] })
coll.drop()
coll.insert({ point:[ 1, 10 ], tags : [ { k : 'key', v : 'value' }, { k : 'key2', v : 123 } ] })
coll.insert({ point:[ 1, 10 ], tags : [ { k : 'key', v : 'value' } ] })
db.test.ensureIndex({ point : "2d" , "tags.k" : 1, "tags.v" : 1 })
coll.ensureIndex({ point : "2d" , "tags.k" : 1, "tags.v" : 1 })
// Succeeds, since should now lookup multi-keys correctly
assert(2 == db.test.find({ point : { $within : { $box : [[0,0],[12,12]] } } }).count(), "C")
assert(2 == coll.find({ point : { $within : { $box : [[0,0],[12,12]] } } }).count(), "C")
// Succeeds, and should not use geoindex
assert(2 == db.test.find({ point : [1, 10] }).count(), "D")
assert(2 == db.test.find({ point : [1, 10], "tags.v" : "value" }).count(), "E")
assert(1 == db.test.find({ point : [1, 10], "tags.v" : 123 }).count(), "F")
assert(2 == coll.find({ point : [1, 10] }).count(), "D")
assert(2 == coll.find({ point : [1, 10], "tags.v" : "value" }).count(), "E")
assert(1 == coll.find({ point : [1, 10], "tags.v" : 123 }).count(), "F")
db.test.drop()
db.test.insert({ point:[ 1, 10 ], tags : [ { k : { 'hello' : 'world'}, v : 'value' }, { k : 'key2', v : 123 } ] })
db.test.insert({ point:[ 1, 10 ], tags : [ { k : 'key', v : 'value' } ] })
coll.drop()
coll.insert({ point:[ 1, 10 ], tags : [ { k : { 'hello' : 'world'}, v : 'value' }, { k : 'key2', v : 123 } ] })
coll.insert({ point:[ 1, 10 ], tags : [ { k : 'key', v : 'value' } ] })
db.test.ensureIndex({ point : "2d" , "tags.k" : 1, "tags.v" : 1 })
coll.ensureIndex({ point : "2d" , "tags.k" : 1, "tags.v" : 1 })
// Succeeds, should be able to look up the complex element
assert(1 == db.test.find({ point : { $within : { $box : [[0,0],[12,12]] } }, 'tags.k' : { 'hello' : 'world' } }).count(), "G")
assert(1 == coll.find({ point : { $within : { $box : [[0,0],[12,12]] } }, 'tags.k' : { 'hello' : 'world' } }).count(), "G")

View File

@ -0,0 +1,65 @@
//
// Tests 2dsphere with descending fields, ensures correct lookup
//
var coll = db.getCollection("twodspheredesc");
var descriptors = [["field1", -1], ["field2", -1], ["coordinates", "2dsphere"]]
var docA = {field1 : "a", field2 : 1, coordinates : [-118.2400013, 34.073893]}
var docB = {field1 : "b", field2 : 1, coordinates : [-118.2400012, 34.073894]}
// Try both regular and near index cursors
var query = {coordinates : {$geoWithin : {$centerSphere : [[-118.240013, 34.073893],
0.44915760491198753]}}};
var queryNear = {coordinates : {$geoNear : {"type" : "Point", "coordinates" : [0, 0]}}};
//
// The idea here is we try "2dsphere" indexes in combination with descending
// other fields in various
// positions and ensure that we return correct results.
//
for ( var t = 0; t < descriptors.length; t++) {
var descriptor = {};
for ( var i = 0; i < descriptors.length; i++) {
descriptor[descriptors[i][0]] = descriptors[i][1];
}
jsTest.log("Trying 2dsphere index with descriptor " + tojson(descriptor));
coll.drop();
coll.ensureIndex(descriptor);
coll.insert(docA);
coll.insert(docB);
assert.eq(1, coll.count(Object.merge(query, {field1 : "a"})));
assert.eq(1, coll.count(Object.merge(query, {field1 : "b"})));
assert.eq(2, coll.count(Object.merge(query, {field2 : 1})));
assert.eq(0, coll.count(Object.merge(query, {field2 : 0})));
assert.eq(2, coll.count(queryNear));
var firstEls = descriptors.splice(1);
descriptors = firstEls.concat(descriptors);
}
//
// Data taken from previously-hanging result
//
jsTest.log("Trying case found in wild...");
coll.drop();
coll.ensureIndex({coordinates : "2dsphere", field : -1});
coll.insert({coordinates : [-118.240013, 34.073893]});
var query = {coordinates : {$geoWithin : {$centerSphere : [[-118.240013, 34.073893],
0.44915760491198753]}},
field : 1};
assert.eq(null, coll.findOne(query));
coll.remove({})
coll.insert({coordinates : [-118.240013, 34.073893], field : 1});
assert.neq(null, coll.findOne(query));
jsTest.log("Success!");

View File

@ -5,20 +5,20 @@ roundworldpoint = { "type" : "Point", "coordinates": [ 180, 0 ] }
// Opposite the equator
roundworld = { "type" : "Polygon",
"coordinates" : [ [ [179,1], [181,1], [181,-1], [179,-1], [179,1]]]}
"coordinates" : [ [ [179,1], [-179,1], [-179,-1], [179,-1], [179,1]]]}
t.insert({geo : roundworld})
roundworld2 = { "type" : "Polygon",
"coordinates" : [ [ [179,1], [179,-1], [181,-1], [181,1], [179,1]]]}
"coordinates" : [ [ [179,1], [179,-1], [-179,-1], [-179,1], [179,1]]]}
t.insert({geo : roundworld2})
// North pole
santapoint = { "type" : "Point", "coordinates": [ 180, 90 ] }
santa = { "type" : "Polygon",
"coordinates" : [ [ [179,89], [179,90], [181,90], [181,89], [179,89]]]}
"coordinates" : [ [ [179,89], [179,90], [-179,90], [-179,89], [179,89]]]}
t.insert({geo : santa})
santa2 = { "type" : "Polygon",
"coordinates" : [ [ [179,89], [181,89], [181,90], [179,90], [179,89]]]}
"coordinates" : [ [ [179,89], [-179,89], [-179,90], [179,90], [179,89]]]}
t.insert({geo : santa2})
// South pole

View File

@ -1,15 +1,20 @@
t = db.geo_s2index
t.drop()
// We internally drop adjacent duplicate points in lines.
someline = { "type" : "LineString", "coordinates": [ [40,5], [40,5], [ 40, 5], [41, 6], [41,6]]}
t.insert( {geo : someline , nonGeo: "someline"})
t.ensureIndex({geo: "2dsphere"})
foo = t.find({geo: {$geoIntersects: {$geometry: {type: "Point", coordinates: [40,5]}}}}).next();
assert.eq(foo.geo, someline);
t.dropIndex({geo: "2dsphere"})
pointA = { "type" : "Point", "coordinates": [ 40, 5 ] }
t.insert( {geo : pointA , nonGeo: "pointA"})
pointD = { "type" : "Point", "coordinates": [ 41.001, 6.001 ] }
t.insert( {geo : pointD , nonGeo: "pointD"})
someline = { "type" : "LineString", "coordinates": [ [ 40, 5], [41, 6]]}
t.insert( {geo : someline , nonGeo: "someline"})
pointB = { "type" : "Point", "coordinates": [ 41, 6 ] }
t.insert( {geo : pointB , nonGeo: "pointB"})

View File

@ -0,0 +1,113 @@
// Tests 2dsphere index option "2dsphereIndexVersion". Verifies that only index version 1 is
// permitted.
var coll = db.getCollection("geo_s2indexversion1");
coll.drop();
//
// Index build should fail for invalid values of "2dsphereIndexVersion".
//
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": -1});
assert.gleError(db);
coll.drop();
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": 0});
assert.gleError(db);
coll.drop();
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": 2});
assert.gleError(db);
coll.drop();
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": 3});
assert.gleError(db);
coll.drop();
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": Infinity});
assert.gleError(db);
coll.drop();
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": "foo"});
assert.gleError(db);
coll.drop();
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": {a: 1}});
assert.gleError(db);
coll.drop();
//
// Index build should succeed for valid values of "2dsphereIndexVersion".
//
coll.ensureIndex({geo: "2dsphere"});
assert.gleSuccess(db);
coll.drop();
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": 1});
assert.gleSuccess(db);
coll.drop();
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": NumberInt(1)});
assert.gleSuccess(db);
coll.drop();
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": NumberLong(1)});
assert.gleSuccess(db);
coll.drop();
//
// Test compatibility of various GeoJSON objects with 2dsphere.
//
var pointDoc = {geo: {type: "Point", coordinates: [40, 5]}};
var lineStringDoc = {geo: {type: "LineString", coordinates: [[40, 5], [41, 6]]}};
var polygonDoc = {geo: {type: "Polygon", coordinates: [[[0, 0], [3, 6], [6, 1], [0, 0]]]}};
var multiPointDoc = {geo: {type: "MultiPoint",
coordinates: [[-73.9580, 40.8003], [-73.9498, 40.7968],
[-73.9737, 40.7648], [-73.9814, 40.7681]]}};
var multiLineStringDoc = {geo: {type: "MultiLineString",
coordinates: [[[-73.96943, 40.78519], [-73.96082, 40.78095]],
[[-73.96415, 40.79229], [-73.95544, 40.78854]],
[[-73.97162, 40.78205], [-73.96374, 40.77715]],
[[-73.97880, 40.77247], [-73.97036, 40.76811]]]}};
var multiPolygonDoc = {geo: {type: "MultiPolygon",
coordinates: [[[[-73.958, 40.8003], [-73.9498, 40.7968],
[-73.9737, 40.7648], [-73.9814, 40.7681],
[-73.958, 40.8003]]],
[[[-73.958, 40.8003], [-73.9498, 40.7968],
[-73.9737, 40.7648], [-73.958, 40.8003]]]]}};
var geometryCollectionDoc = {geo: {type: "GeometryCollection",
geometries: [{type: "MultiPoint",
coordinates: [[-73.9580, 40.8003],
[-73.9498, 40.7968],
[-73.9737, 40.7648],
[-73.9814, 40.7681]]},
{type: "MultiLineString",
coordinates: [[[-73.96943, 40.78519],
[-73.96082, 40.78095]],
[[-73.96415, 40.79229],
[-73.95544, 40.78854]],
[[-73.97162, 40.78205],
[-73.96374, 40.77715]],
[[-73.97880, 40.77247],
[-73.97036, 40.76811]]]}]}};
// {2dsphereIndexVersion: 1} indexes allow only Point, LineString, and Polygon.
coll.ensureIndex({geo: "2dsphere"}, {"2dsphereIndexVersion": 1});
assert.gleSuccess(db);
coll.insert(pointDoc);
assert.gleSuccess(db);
coll.insert(lineStringDoc);
assert.gleSuccess(db);
coll.insert(polygonDoc);
assert.gleSuccess(db);
coll.insert(multiPointDoc);
assert.gleError(db);
coll.insert(multiLineStringDoc);
assert.gleError(db);
coll.insert(multiPolygonDoc);
assert.gleError(db);
coll.insert(geometryCollectionDoc);
assert.gleError(db);
coll.drop();

View File

@ -59,15 +59,25 @@ function uniformPoints(origin, count, minDist, maxDist){
var pointLat = asin((sin(lat) * cos(distance)) + (cos(lat) * sin(distance) * cos(angle)));
var pointDLng = atan2(sin(angle) * sin(distance) * cos(lat), cos(distance) - sin(lat) * sin(pointLat));
var pointLng = ((lng - pointDLng + PI) % 2*PI) - PI;
// Latitude must be [-90, 90]
var newLat = lat + pointLat;
if (newLat > 90) newLat -= 180;
if (newLat < -90) newLat += 180;
// Longitude must be [-180, 180]
var newLng = lng + pointLng;
if (newLng > 180) newLng -= 360;
if (newLng < -180) newLng += 360;
var newPoint = {
geo: {
type: "Point",
coordinates: [lng + pointLng, lat + pointLat]
//coordinates: [lng + pointLng, lat + pointLat]
coordinates: [newLng, newLat]
}
};
if(lat + pointLat > 90.0){
continue;
}
points.push(newPoint);
}
for(i=0; i < points.length; i++){

View File

@ -0,0 +1,12 @@
// SERVER-9484
// A geometry may have several covers, one of which is in a search ring and the other of which is
// not. If we see the cover that's not in the search ring, we can't mark the object as 'seen' for
// this ring.
t = db.geo_s2nearcorrect
t.drop()
longline = { "type" : "LineString", "coordinates": [ [0,0], [179, 89]]};
t.insert({geo: longline});
t.ensureIndex({geo: "2dsphere"});
origin = { "type" : "Point", "coordinates": [ 45, 45] }
assert.eq(1, t.find({ "geo" : { "$near" : { "$geometry" : origin, $maxDistance: 20000000} } }).count());

View File

@ -0,0 +1,27 @@
//
// Tests valid cases for creation of 2dsphere index
//
var coll = db.getCollection("twodspherevalid");
// Valid index
coll.drop();
assert.eq(undefined, coll.ensureIndex({geo : "2dsphere", other : 1}));
// Valid index
coll.drop();
assert.eq(undefined, coll.ensureIndex({geo : "2dsphere", other : 1, geo2 : "2dsphere"}));
// Invalid index, using hash with 2dsphere
coll.drop();
assert.neq(undefined, coll.ensureIndex({geo : "2dsphere", other : "hash"}).err);
// Invalid index, using 2d with 2dsphere
coll.drop();
assert.neq(undefined, coll.ensureIndex({geo : "2dsphere", other : "2d"}).err);
jsTest.log("Success!");
// Need to drop index since replication tests will fail otherwise - empty creation on index error
// isn't replicated.
coll.drop();

View File

@ -0,0 +1,45 @@
// This test creates a large projection, which causes a set of field names to
// be stored in a StringMap (based on UnorderedFastKeyTable). The hash table
// starts with 20 slots, but must be grown repeatedly to hold the complete set
// of fields. This test verifies that we can grow the hash table repeatedly
// with no failures.
//
// Related to SERVER-9824.
var testDB = db.getSiblingDB('grow_hash_table');
var doTest = function(count) {
print('Testing with count of ' + count);
testDB.dropDatabase();
var id = { data: 1 };
var doc = { _id: id };
var projection = { };
// Create a document and a projection with fields r1, r2, r3 ...
for (var i = 1; i <= count; ++i) {
var r = 'r' + i;
doc[r] = i;
projection[r] = 1;
}
// Store the document
testDB.collection.insert(doc);
var errorObj = testDB.getLastErrorObj();
assert(errorObj.err == null,
'Failed to insert document, getLastErrorObj = ' + tojsononeline(errorObj));
// Try to read the document using a large projection
try {
var findCount = testDB.collection.find({ _id: id }, projection).itcount();
assert(findCount == 1,
'Failed to find single stored document, find().itcount() == ' + findCount);
}
catch (e) {
testDB.dropDatabase();
doassert('Test FAILED! Caught exception ' + tojsononeline(e));
}
testDB.dropDatabase();
jsTest.log('Test PASSED');
}
doTest(10000);

38
jstests/index_id_desc.js Normal file
View File

@ -0,0 +1,38 @@
// Test creation of an index with key pattern {_id: -1}. It is expected that a request for creation
// of a {_id: -1} index is treated as if it were a request for creation of a {_id: 1} index.
// SERVER-14833.
var coll = db.index_id_desc;
var indexes;
var res;
// Test ensureIndex({_id: -1}) on a nonexistent collection.
coll.drop();
res = coll.ensureIndex({_id: -1});
assert.isnull(res);
indexes = coll.getIndexes();
assert.eq(1, indexes.length);
assert.eq("_id_", indexes[0].name);
assert.eq({_id: 1}, indexes[0].key);
// Test ensureIndex({_id: -1}) on a normal empty collection.
coll.drop();
assert.commandWorked(coll.runCommand("create"));
assert.eq(1, coll.getIndexes().length);
res = coll.ensureIndex({_id: -1});
assert.isnull(res);
indexes = coll.getIndexes();
assert.eq(1, indexes.length);
assert.eq("_id_", indexes[0].name);
assert.eq({_id: 1}, indexes[0].key);
// Test ensureIndex({_id: -1}) on an empty collection with no _id index.
coll.drop();
assert.commandWorked(coll.runCommand("create", {autoIndexId: false}));
assert.eq(0, coll.getIndexes().length);
res = coll.ensureIndex({_id: -1});
assert.isnull(res);
indexes = coll.getIndexes();
assert.eq(1, indexes.length);
assert.eq("_id_", indexes[0].name);
assert.eq({_id: 1}, indexes[0].key);

View File

@ -0,0 +1,19 @@
// ensure an index cannot be created on system.indexes
t = db.getSiblingDB("indexes_on_indexes");
printjson(t.system.indexes.getIndexes());
assert.eq(t.system.indexes.getIndexes().length, 0);
print("trying via ensureIndex");
assert.throws(t.system.indexes.ensureIndex({_id:1}));
printjson(t.system.indexes.getIndexes());
assert.eq(t.system.indexes.getIndexes().length, 0);
print("trying via createIndex");
assert.throws(t.system.indexes.createIndex({_id:1}));
printjson(t.system.indexes.getIndexes());
assert.eq(t.system.indexes.getIndexes().length, 0);
print("trying via direct insertion");
assert.throws(t.system.indexes.insert({ v:1,
key:{_id:1},
ns: "indexes_on_indexes.system.indexes",
name:"wontwork"}));
printjson(t.system.indexes.getIndexes());
assert.eq(t.system.indexes.getIndexes().length, 0);

View File

@ -1,7 +1,5 @@
t = db.jstests_js7;
t.drop();
assert.eq( 17 , db.eval( function(){ return args[0]; } , 17 ) );
assert.eq( 17 , db.eval( function( foo ){ return foo; } , 17 ) );

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
[libdefaults]
default_realm = 10GEN.ME
[realms]
10GEN.ME = {
kdc = kdc.10gen.me
admin_server = kdc.10gen.me
default_domain = 10gen.me
}
[domain_realm]
.10gen.me = 10GEN.ME
10gen.me = 10GEN.ME

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,62 @@
// See SERVER-9448
// Test argument and receiver (aka 'this') objects and their children can be mutated
// in Map, Reduce and Finalize functions
var collection = db.mrMutableReceiver;
collection.drop();
collection.insert({a:1});
var map = function() {
// set property on receiver
this.feed = {beef:1};
// modify property on receiever
this.a = {cake:1};
emit(this._id, this.feed);
emit(this._id, this.a);
}
var reduce = function(key, values) {
// set property on receiver
this.feed = {beat:1};
// set property on key arg
key.fed = {mochi:1};
// push properties onto values array arg
values.push(this.feed);
values.push(key.fed);
// modify each value in the (modified) array arg
values.forEach(function(val) { val.mod = 1; });
return {food:values};
}
var finalize = function(key, values) {
// set property on receiver
this.feed = {ice:1};
// set property on key arg
key.fed = {cream:1};
// push properties onto values array arg
printjson(values);
values.food.push(this.feed);
values.food.push(key.fed);
// modify each value in the (modified) array arg
values.food.forEach(function(val) { val.mod = 1; });
return values;
}
var mr = collection.mapReduce(map, reduce, {finalize: finalize, out: {inline: 1}});
printjson(mr);
// verify mutated properties exist (order dictated by emit sequence and properties added)
assert.eq(mr.results[0].value.food[0].beef, 1);
assert.eq(mr.results[0].value.food[1].cake, 1);
assert.eq(mr.results[0].value.food[2].beat, 1);
assert.eq(mr.results[0].value.food[3].mochi, 1);
assert.eq(mr.results[0].value.food[4].ice, 1);
assert.eq(mr.results[0].value.food[5].cream, 1);
mr.results[0].value.food.forEach(function(val) { assert.eq(val.mod, 1); });

View File

@ -152,7 +152,7 @@ var coll = mongos.getCollection("foo.bar");
printjson(admin.runCommand({ enableSharding : coll.getDB() + "" }));
printjson(admin.runCommand({ shardCollection : coll + "", key : { _id : 1 } }));
printjson(admin.runCommand({ split : coll + "", middle : { _id : 0 } }));
printjson(admin.runCommand({ split : coll + "", middle : { _id : 0 } }));
config.collections.update({ _id : coll + "" }, { $set : { lastmodEpoch : ObjectId() }});
assert.eq(null, config.getLastError());
@ -170,6 +170,11 @@ resetBackupDBs();
jsTest.log("Adding bad (dropped) sharded collection data...")
printjson(coll.drop());
// Disable balancing on the (dropped) coll to trigger additional collection validation.
// At least in 2.2, dropping a collection drops the noBalance flag as well, but this has been seen
// in the wild.
// TODO: Enable when 2.4.4 comes out
//sh.disableBalancing( coll );
printjson(config.collections.find().toArray());
// Make sure up

View File

@ -14,7 +14,7 @@ t = db.objNestTest;
t.drop();
t.ensureIndex({a:1});
nestedObj = makeNestObj(500);
nestedObj = makeNestObj(300);
t.insert( { tst : "test1", a : nestedObj }, true );
t.insert( { tst : "test2", a : nestedObj }, true );

View File

@ -0,0 +1,8 @@
// SERVER-10313: Test that null char in field name causes an error when converting to bson
assert.throws( function () { Object.bsonsize({"a\0":1}); },
null,
"null char in field name");
assert.throws( function () { Object.bsonsize({"\0asdf":1}); },
null,
"null char in field name");

View File

@ -35,4 +35,7 @@ doTest = function() {
soonCount( "c", "c", 2 );
}
doTest();
// Disabled because of SERVER-10344
if (false) {
doTest();
}

View File

@ -0,0 +1,59 @@
if (0) { // this test also commented out in master (renamed to auth_compact.js) b/c of SERVER-12697
// test that nodes still respond to heartbeats during compact() SERVER-12264
var replTest = new ReplSetTest({ name: 'compact', nodes: 3 });
replTest.startSet();
replTest.initiate();
var master = replTest.getMaster();
var compactingSlave = replTest.liveNodes.slaves[0];
// populate data
for (i=0; i<1000; i++) {
var bulkInsertArr = [];
for (j=0; j<1000; j++) {
bulkInsertArr.push({x:i, y:j});
}
master.getDB("compact").foo.insert(bulkInsertArr);
}
// takes a while to replicate all this data...
replTest.awaitReplication(1000*60*5);
// run compact in parallel with this rest of the script
var cmd = "tojson(db.getSiblingDB('compact').runCommand({'compact': 'foo', 'paddingFactor': 2}));";
var compactor = startParallelShell(cmd, compactingSlave.port);;
// wait for compact to show up in currentOp
assert.soon(function() {
var curop = compactingSlave.getDB('compact').currentOp();
for (index in curop.inprog) {
entry = curop.inprog[index];
if (entry.query.hasOwnProperty("compact") && entry.query.compact === "foo"
&& entry.hasOwnProperty("locks") && entry.locks.hasOwnProperty("^compact")
&& entry.locks["^compact"] === "W") {
return true;
}
}
return false;
}, "compact didn't start in 30 seconds", 30*1000, 100);
// then check that it is still responding to heartbeats
for (i=0; i<5; i++) {
var start = new Date();
var result = compactingSlave.getDB("admin").runCommand({"replSetHeartbeat": "compact",
"v": NumberInt(1),
"pv": NumberInt(1),
"checkEmpty": false,
"fromId": NumberInt(0)
});
var end = new Date();
assert.eq(result.ok, 1, "heartbeat didn't return properly");
// wait for 10 seconds because that's how long it takes for a node to be considered down
assert.lt(end - start, 10 * 1000, "heartbeat didn't return quickly enough");
}
replTest.stopSet();
}

View File

@ -0,0 +1,57 @@
//
// Tests the use of the wOpTime option in getLastError
//
var rst = new ReplSetTest({ nodes : 2 });
rst.startSet();
rst.initiate();
var primary = rst.getPrimary();
var secondary = rst.getSecondary();
var coll = primary.getCollection( "foo.bar" );
// Insert a doc and replicate it to two servers
coll.insert({ some : "doc" });
var gleObj = coll.getDB().getLastErrorObj( 2 ); // w : 2
assert.eq( null, gleObj.err );
var opTimeBeforeFailure = gleObj.lastOp;
// Lock the secondary
secondary.getDB("admin").fsyncLock();
// Insert a doc and replicate it to the primary only
coll.insert({ some : "doc" });
gleObj = coll.getDB().getLastErrorObj( 1 ); // w : 1
assert.eq( null, gleObj.err );
var opTimeAfterFailure = gleObj.lastOp;
printjson(opTimeBeforeFailure);
printjson(opTimeAfterFailure);
printjson( primary.getDB("admin").runCommand({ replSetGetStatus : true }) );
// Create a new connection with new client and no opTime
var newClientConn = new Mongo( primary.host );
// New client has no set opTime, so w : 2 has no impact
gleObj = newClientConn.getCollection( coll.toString() ).getDB().getLastErrorObj( 2 ); // w : 2
assert.eq( null, gleObj.err );
// Using an explicit optime on the new client should work if the optime is earlier than the
// secondary was locked
var gleOpTimeBefore = { getLastError : true, w : 2, wOpTime : opTimeBeforeFailure };
gleObj = newClientConn.getCollection( coll.toString() ).getDB().runCommand( gleOpTimeBefore );
assert.eq( null, gleObj.err );
// Using an explicit optime on the new client should not work if the optime is later than the
// secondary was locked
var gleOpTimeAfter = { getLastError : true, w : 2, wtimeout : 1000, wOpTime : opTimeAfterFailure };
gleObj = newClientConn.getCollection( coll.toString() ).getDB().runCommand( gleOpTimeAfter );
assert.neq( null, gleObj.err );
assert( gleObj.wtimeout );
jsTest.log("DONE!");
// Unlock the secondary
secondary.getDB("admin").fsyncUnlock();
rst.stopSet();

View File

@ -12,8 +12,8 @@ for (var i = 0; i < 10000; i++) db1.foo.insert( {_id:i, x:i%1000, t:t} );
db1.foo.createIndex( {x:1}, {v: 0} );
var r2 = rs.add();
rs.reInitiate();
rs.awaitSecondaryNodes();
rs.reInitiate(60000);
var db2 = r2.getDB('test');
r2.setSlaveOk();

19
jstests/replsets/regex.js Normal file
View File

@ -0,0 +1,19 @@
// don't allow regex as _id: SERVER-9502
var replTest = new ReplSetTest( {name: "server9502", nodes: 2} );
var nodes = replTest.startSet();
replTest.initiate();
var master = replTest.getMaster();
var mdb = master.getDB("test");
mdb.foo.insert({ _id: "ABCDEF" });
var gle = master.getDB("test").runCommand({getLastError : 1, w : 2, wtimeout : 60000});
assert(gle.err === null);
mdb.foo.insert({ _id: /^A/ });
var gle = master.getDB("test").runCommand({getLastError : 1, w : 2, wtimeout : 60000});
assert(gle.code === 16824);
// _id doesn't have to be first; still disallowed
mdb.foo.insert({ xxx: "ABCDEF", _id: /ABCDEF/ });
var gle = master.getDB("test").runCommand({getLastError : 1, w : 2, wtimeout : 60000});
assert(gle.code === 16824);

View File

@ -1,11 +1,11 @@
var rt = new ReplSetTest( { name : "replset9tests" , nodes: 1, oplogSize: 100 } );
var rt = new ReplSetTest( { name : "replset9tests" , nodes: 1, oplogSize: 300 } );
var nodes = rt.startSet();
rt.initiate();
var master = rt.getMaster();
var bigstring = Array(1000).toString();
var bigstring = Array(5000).toString();
var md = master.getDB( 'd' );
var mdc = md[ 'c' ];
@ -32,7 +32,26 @@ md.getLastError();
// add a secondary; start cloning
var slave = rt.add();
rt.reInitiate();
(function reinitiate() {
var master = rt.nodes[0];
var c = master.getDB("local")['system.replset'].findOne();
var config = rt.getReplSetConfig();
config.version = c.version + 1;
var admin = master.getDB("admin");
var cmd = {};
var cmdKey = 'replSetReconfig';
var timeout = timeout || 30000;
cmd[cmdKey] = config;
printjson(cmd);
jsTest.attempt({context:rt, timeout: timeout, desc: "reinitiate replica set"}, function() {
var result = admin.runCommand(cmd);
printjson(result);
return result['ok'] == 1;
});
})();
print ("initiation complete!");
var sc = slave.getDB( 'd' )[ 'c' ];
slave.setSlaveOk();

View File

@ -1,9 +1,8 @@
doTest = function( signal ) {
(function() {
// Make sure that we can manually shutdown a remove a
// slave from the configuration.
// Make sure that we can manually shutdown and remove a
// secondary from the configuration.
// Create a new replica set test. Specify set name and the number of nodes you want.
var replTest = new ReplSetTest( {name: 'testSet', nodes: 3} );
// call startSet() to start each mongod in the replica set
@ -30,6 +29,10 @@ doTest = function( signal ) {
// Shut down the unwanted node
replTest.stop( slaveId );
// Note: this will cause the PRIMARY to step down, which causes it to close all
// connections, including the one we're using from the shell to drive this test.
// The shell will attempt to reconnect once.
// Remove that node from the configuration
replTest.remove( slaveId );
@ -39,40 +42,44 @@ doTest = function( signal ) {
var config = replTest.getReplSetConfig();
config.version = c.version + 1;
config.members = [ { "_id" : 0, "host" : replTest.host + ":31000" },
{ "_id" : 2, "host" : replTest.host + ":31002" } ]
{ "_id" : 2, "host" : replTest.host + ":31002" } ];
try {
// Note that this will cause the shell's connection to the primary to be disconnected again
replTest.initiate( config , 'replSetReconfig' );
}
catch(e) {
print(e);
}
// Make sure that a new master comes up
master = replTest.getMaster();
slaves = replTest.liveNodes.slaves;
// Trigger a reconnect from the shell again, to be sure we're reconnected.
try {
master.getDB("local").system.replset.findOne();
}
catch (e) {
print (e);
}
// Do a status check on each node
// Master should be set to 1 (primary)
assert.soon(function() {
stat = master.getDB("admin").runCommand({replSetGetStatus: 1});
var stat = master.getDB("admin").runCommand({replSetGetStatus: 1});
printjson( stat );
return stat.myState == 1;
}, "Master failed to come up as master.", 60000);
// Slaves to be set to 2 (secondary)
assert.soon(function() {
stat = slaves[0].getDB("admin").runCommand({replSetGetStatus: 1});
var stat = slaves[0].getDB("admin").runCommand({replSetGetStatus: 1});
return stat.myState == 2;
}, "Slave failed to come up as slave.", 60000);
assert.soon(function() {
stat = slaves[0].getDB("admin").runCommand({replSetGetStatus: 1});
var stat = slaves[0].getDB("admin").runCommand({replSetGetStatus: 1});
return stat.members.length == 2;
}, "Wrong number of members", 60000);
}
print("replset_remove_node.js");
doTest(15);
print("replset_remove_node SUCCESS");
}());

View File

@ -7,10 +7,12 @@ doTest = function( signal ) {
replTest.startSet();
replTest.initiate({"_id" : "testSet",
"members" : [
{"_id" : 0, "host" : nodes[0], "priority" : 1},
{"_id" : 1, "host" : nodes[1], "priority" : 2},
{"_id" : 2, "host" : nodes[2], "priority" : 3}]});
"members" : [
{"_id" : 0, "host" : nodes[0], "priority" : 1},
{"_id" : 1, "host" : nodes[1], "priority" : 2},
{"_id" : 2, "host" : nodes[2], "priority" : 3}]},
'replSetInitiate',
80000);
// 2 should be master (give this a while to happen, as 0 will be elected, then demoted)
assert.soon(function() {

View File

@ -0,0 +1,102 @@
// test that a rollback directory is created during a replica set rollback
// this also tests that updates are recorded in the rollback file
// (this test does no delete rollbacks)
var replTest = new ReplSetTest({ name: 'rollback5', nodes: 3 });
var nodes = replTest.nodeList();
var conns = replTest.startSet();
var r = replTest.initiate({ "_id": "rollback5",
"members": [
{ "_id": 0, "host": nodes[0] },
{ "_id": 1, "host": nodes[1] },
{ "_id": 2, "host": nodes[2], arbiterOnly: true}]
});
// Make sure we have a master
var master = replTest.getMaster();
var a_conn = conns[0];
var b_conn = conns[1];
a_conn.setSlaveOk();
b_conn.setSlaveOk();
var A = a_conn.getDB("test");
var B = b_conn.getDB("test");
var AID = replTest.getNodeId(a_conn);
var BID = replTest.getNodeId(b_conn);
var Apath = "/data/db/rollback5-0/";
var Bpath = "/data/db/rollback5-1/";
assert(master == conns[0], "conns[0] assumed to be master");
assert(a_conn.host == master.host);
// Make sure we have an arbiter
assert.soon(function () {
res = conns[2].getDB("admin").runCommand({ replSetGetStatus: 1 });
return res.myState == 7;
}, "Arbiter failed to initialize.");
A.foo.update({key:'value1'}, {$set: {req: 'req'}}, true);
A.foo.runCommand({getLastError : 1, w : 2, wtimeout : 60000});
replTest.stop(AID);
master = replTest.getMaster();
assert(b_conn.host == master.host);
B.foo.update({key:'value1'}, {$set: {res: 'res'}}, true);
B.foo.runCommand({getLastError : 1, w : 1, wtimeout : 60000});
replTest.stop(BID);
replTest.restart(AID);
master = replTest.getMaster();
assert(a_conn.host == master.host);
A.foo.update({key:'value2'}, {$set: {req: 'req'}}, true);
A.foo.runCommand({getLastError : 1, w : 1, wtimeout : 60000});
replTest.restart(BID); // should rollback
reconnect(B);
print("BEFORE------------------");
printjson(A.foo.find().toArray());
replTest.awaitReplication();
replTest.awaitSecondaryNodes();
print("AFTER------------------");
printjson(A.foo.find().toArray());
assert.eq(2, A.foo.count());
assert.eq('req', A.foo.findOne({key:'value1'}).req);
assert.eq(null, A.foo.findOne({key:'value1'}).res);
assert.eq(2, B.foo.count());
assert.eq('req', B.foo.findOne({key:'value1'}).req);
assert.eq(null, B.foo.findOne({key:'value1'}).res);
// check here for rollback files
var rollbackDir = Bpath + "rollback/";
assert(pathExists(rollbackDir), "rollback directory was not created!");
print("rollback5.js SUCCESS");
replTest.stopSet(15);
function wait(f) {
var n = 0;
while (!f()) {
if (n % 4 == 0)
print("rollback5.js waiting");
if (++n == 4) {
print("" + f);
}
assert(n < 200, 'tried 200 times, giving up');
sleep(1000);
}
}
function reconnect(a) {
wait(function() {
try {
a.bar.stats();
return true;
} catch(e) {
print(e);
return false;
}
});
};

View File

@ -26,7 +26,7 @@ var checkRepl = function(db1, db2) {
.next();
print(tojson(last1)+" "+tojson(last2));
return last2.ts.t == last1.ts.t;
return ((last1.ts.t === last2.ts.t) && (last1.ts.i === last2.ts.i))
}
);
};
@ -83,7 +83,7 @@ for (var i = 50; i < 75; i++) {
var last = primary.getSisterDB("local").oplog.rs.find().sort({$natural:-1}).limit(1).next();
print("waiting a bit for the secondaries to get the write");
sleep(20000);
sleep(10000);
print("Shut down the primary");
replSet.stop(0);
@ -125,8 +125,8 @@ assert.soon(
function() {
var last3 = member3.getSisterDB("local").oplog.rs.find().sort({$natural:-1}).limit(1)
.next();
print("primary: " + last.ts.t + " secondary: " + last3.ts.t);
return last.ts.t == last3.ts.t;
print("primary: " + tojson(last.ts) + " secondary: " + tojson(last3.ts));
return ((last.ts.t === last3.ts.t) && (last.ts.i === last3.ts.i))
}
);
@ -134,10 +134,10 @@ print(" --- start 3's bgsync thread ---");
member3.runCommand({configureFailPoint: 'rsBgSyncProduce', mode: 'off'});
print("Shouldn't hit rollback");
var end = (new Date()).getTime()+30000;
var end = (new Date()).getTime()+10000;
while ((new Date()).getTime() < end) {
assert('ROLLBACK' != member3.runCommand({replSetGetStatus:1}).members[2].stateStr);
sleep(1000);
sleep(30);
}
replSet.stopSet();

View File

@ -12,17 +12,16 @@ doTest = function( signal ) {
/* set slaveDelay to 30 seconds */
var config = replTest.getReplSetConfig();
config.members[2].priority = 0;
config.members[2].slaveDelay = 10;
config.members[2].slaveDelay = 30;
replTest.initiate(config);
var master = replTest.getMaster().getDB(name);
var slaveConns = replTest.liveNodes.slaves;
var slave = [];
var slaves = [];
for (var i in slaveConns) {
var d = slaveConns[i].getDB(name);
d.getMongo().setSlaveOk();
slave.push(d);
slaves.push(d);
}
waitForAllMembers(master);
@ -35,68 +34,44 @@ doTest = function( signal ) {
assert.eq(doc.x, 1);
// make sure slave has it
var doc = slave[0].foo.findOne();
var doc = slaves[0].foo.findOne();
assert.eq(doc.x, 1);
// make sure delayed slave doesn't have it
assert.eq(slave[1].foo.findOne(), null);
for (var i=0; i<8; i++) {
assert.eq(slave[1].foo.findOne(), null);
assert.eq(slaves[1].foo.findOne(), null);
sleep(1000);
}
// now delayed slave should have it
// within 30 seconds delayed slave should have it
assert.soon(function() {
var z = slave[1].foo.findOne();
var z = slaves[1].foo.findOne();
return z && z.x == 1;
});
/************* Part 2 *******************/
// how about non-initial sync?
for (var i=0; i<100; i++) {
master.foo.insert({_id : i, "foo" : "bar"});
}
master.runCommand({getlasterror:1,w:2});
assert.eq(master.foo.findOne({_id : 99}).foo, "bar");
assert.eq(slave[0].foo.findOne({_id : 99}).foo, "bar");
assert.eq(slave[1].foo.findOne({_id : 99}), null);
for (var i=0; i<8; i++) {
assert.eq(slave[1].foo.findOne({_id:99}), null);
sleep(1000);
}
assert.soon(function() {
var z = slave[1].foo.findOne({_id : 99});
return z && z.foo == "bar";
});
/************* Part 3 *******************/
// how about if we add a new server? will it sync correctly?
conn = replTest.add();
config = master.getSisterDB("local").system.replset.findOne();
printjson(config);
config.version++;
config.members.push({_id : 3, host : host+":"+replTest.ports[replTest.ports.length-1],priority:0, slaveDelay:10});
config.members.push({_id: 3,
host: host+":"+replTest.ports[replTest.ports.length-1],
priority:0,
slaveDelay:30});
master = reconfig(replTest, config);
master = master.getSisterDB(name);
// it should be all caught up now
// wait for the node to catch up
replTest.awaitReplication();
master.foo.insert({_id : 123, "x" : "foo"});
master.runCommand({getlasterror:1,w:2});
conn.setSlaveOk();
for (var i=0; i<8; i++) {
assert.eq(conn.getDB(name).foo.findOne({_id:123}), null);
sleep(1000);
@ -107,7 +82,7 @@ doTest = function( signal ) {
return z != null && z.x == "foo"
});
/************* Part 4 ******************/
/************* Part 3 ******************/
print("reconfigure slavedelay");
@ -120,6 +95,7 @@ doTest = function( signal ) {
return conn.getDB("local").system.replset.findOne().version == config.version;
});
// wait for node to become secondary
assert.soon(function() {
var result = conn.getDB("admin").isMaster();
printjson(result);
@ -130,12 +106,15 @@ doTest = function( signal ) {
master.foo.insert({_id : 124, "x" : "foo"});
assert(master.foo.findOne({_id:124}) != null);
for (var i=0; i<13; i++) {
for (var i=0; i<10; i++) {
assert.eq(conn.getDB(name).foo.findOne({_id:124}), null);
sleep(1000);
}
replTest.awaitReplication();
// the node should have the document in 15 seconds (20 for some safety against races)
assert.soon(function() {
return conn.getDB(name).foo.findOne({_id:124}) != null;
}, 10*1000);
replTest.stopSet();
}

View File

@ -73,6 +73,7 @@ catch (e) {
}
print("\nawait");
replTest.awaitSecondaryNodes(90000);
replTest.awaitReplication();
// 31000 may have just voted for 31001, preventing it from becoming primary for the first 30 seconds

View File

@ -0,0 +1,48 @@
// Test that GLE asserts when the primary steps down while we're waiting for w:
var replTest = new ReplSetTest({ name: 'testSet', nodes: 2 });
var nodes = replTest.startSet();
replTest.initiate();
var master = replTest.getMaster();
// do a write to allow stepping down of the primary;
// otherwise, the primary will refuse to step down
print("\ndo a write");
master.getDB("test").foo.insert({x:1});
replTest.awaitReplication();
// do another write, because the first one might be longer than 10 seconds ago
// on the secondary (due to starting up), and we need to be within 10 seconds
// to step down.
master.getDB("test").foo.insert({x:2});
master.getDB("test").runCommand({getLastError : 1, w : 2, wtimeout : 30000 });
// lock secondary, to pause replication
print("\nlock secondary");
var locked = replTest.liveNodes.slaves[0];
printjson( locked.getDB("admin").runCommand({fsync : 1, lock : 1}) );
// do a write
print("\ndo a write");
master.getDB("test").foo.insert({x:3});
// step down the primary asyncronously
print("stepdown");
var command = "sleep(4000); tojson(db.adminCommand( { replSetStepDown : 60, force : 1 } ));"
var waitfunc = startParallelShell(command, master.port);
print("getlasterror; should assert or return an error, depending on timing");
var gleFunction = function() {
var result = master.getDB("test").runCommand({getLastError : 1, w: 2 , wtimeout :30000 });
if (result.errmsg === "not master") {
throw new Error("satisfy assert.throws()");
}
print("failed to throw exception; GLE returned: ");
printjson(result);
};
var result = assert.throws(gleFunction);
print("result of gle:");
printjson(result);
// unlock and shut down
printjson(locked.getDB("admin").$cmd.sys.unlock.findOne());
replTest.stopSet();

View File

@ -21,22 +21,6 @@ replTest.awaitSecondaryNodes();
master.getDB("foo").bar.insert({x:1});
replTest.awaitReplication();
jsTestLog("Checking that currentOp for secondaries uses OpTime, not Date");
assert.soon(
function() {
var count = 0;
var currentOp = master.getDB("admin").currentOp({ns: 'local.oplog.rs'});
printjson(currentOp);
currentOp.inprog.forEach(
function(op) {
assert.eq(op.query.ts.$gte.constructor, Timestamp);
count++;
}
);
return count >= 4;
}
);
jsTestLog("Bridging replica set");
master = replTest.bridge();

View File

@ -0,0 +1,80 @@
// Test for SERVER-9333
// Previously, we were not clearing the cache of slaves in the primary at reconfig
// time. This would cause us to update stale items in the cache when secondaries
// reported their progress to a primary.
// Start a replica set with 3 nodes
var host = getHostName();
var replTest = new ReplSetTest( {name: "tags_with_reconfig", nodes: 3, startPort: 32000} );
var nodes = replTest.startSet();
var ports = replTest.ports;
// Set tags and getLastErrorModes
var conf = {_id : "tags_with_reconfig", version: 1, members : [
{_id : 0, host : host+":"+ports[0], tags : {"dc" : "bbb"}},
{_id : 1, host : host+":"+ports[1], tags : {"dc" : "bbb"}},
{_id : 2, host : host+":"+ports[2], tags : {"dc" : "ccc"}}],
settings : {getLastErrorModes : {
anydc : {dc : 1},
alldc : {dc : 2}, }} };
replTest.initiate( conf );
replTest.awaitReplication();
master = replTest.getMaster();
var db = master.getDB("test");
// Insert a document and getLastError with write concern : anydc
db.foo.insert( {x:1} );
var result = db.runCommand( {getLastError:1, w:"anydc", wtimeout:20000} );
printjson (result)
assert.eq (result.err, null);
// Insert a document and getLastError with write concern : alldc
db.foo.insert( {x:2} );
var result = db.runCommand( {getLastError:1, w:"alldc", wtimeout:20000} );
printjson (result)
assert.eq (result.err, null);
// Add a new tag to the replica set
var config = master.getDB("local").system.replset.findOne();
printjson(config);
var modes = config.settings.getLastErrorModes;
config.version++;
config.members[0].tags.newtag = "newtag";
try {
master.getDB("admin").runCommand({replSetReconfig : config});
}
catch(e) {
print(e);
}
replTest.awaitReplication();
// Print the new config for replica set
var config = master.getDB("local").system.replset.findOne();
printjson(config);
master = replTest.getMaster();
var db = master.getDB("test");
// Insert a document and getLastError with write concern : anydc
db.foo.insert( {x:3} );
var result = db.runCommand( {getLastError:1, w:"anydc", wtimeout:20000} );
printjson (result)
assert.eq (result.err, null);
// Insert a document and getLastError with write concern : alldc
db.foo.insert( {x:4} );
var result = db.runCommand( {getLastError:1, w:"alldc", wtimeout:20000} );
printjson (result)
assert.eq (result.err, null);
replTest.stopSet();

View File

@ -63,7 +63,7 @@ doTest = function (signal) {
// Add the second node.
// This runs the equivalent of rs.add(newNode);
replTest.reInitiate();
replTest.reInitiate(60000);
var b = second.getDB("admin");

16
jstests/server9385.js Normal file
View File

@ -0,0 +1,16 @@
// SERVER-9385 ensure saving a document derived from bson->js conversion doesn't lose it's _id
t = db.server9385;
t.drop();
t.insert( { _id : 1, x : 1 } );
x = t.findOne();
x._id = 2;
t.save( x );
t.find().forEach( printjson );
assert.eq( 2, t.find().count() );
assert.eq( 2, t.find().itcount() );
assert( t.findOne( { _id : 1 } ), "original insert missing" );
assert( t.findOne( { _id : 2 } ), "save didn't work?" );

View File

@ -71,7 +71,7 @@ assert.soon( function() {
var x = st.chunkDiff( "foo", "test" );
print( "chunk diff: " + x );
return x < 2 && configDB.locks.findOne({ _id : 'test.foo' }).state == 0;
}, "no balance happened", 60000 );
}, "no balance happened", 5 * 60 * 1000 );
assert.soon( function(){
print( "Waiting for migration cleanup to occur..." )

View File

@ -27,7 +27,8 @@ for ( j=0; j<30; j++ ){
}
assert.eq( i , j * 100 , "setup" );
s.adminCommand( "connpoolsync" );
// Until SERVER-9715 is fixed, the sync command must be run on a diff connection
new Mongo( s.s.host ).adminCommand( "connpoolsync" );
db.getLastError();
print( "done inserting data" );

View File

@ -54,7 +54,9 @@ assert.eq( 6 , db.foo.find().count() , "basic count" );
// part 2
s.adminCommand( { split : "test.foo" , find : { name : "joe" } } ); // [Minkey -> allan) , * [allan -> ..)
s.adminCommand( { split : "test.foo" , find : { name : "joe" } } ); // * [allan -> sara) , [sara -> Maxkey)
s.adminCommand( { split : "test.foo" , find : { name : "joe" } } ); // [alan -> joe) , [joe -> sara]
s.adminCommand( { split : "test.foo" , find : { name : "joe" } } ); // [alan -> eliot) , [eliot -> sara]
// MINKEY->allan,bob->eliot,joe,mark->sara,MAXKEY
s.printChunks()
@ -63,7 +65,7 @@ assert.eq( 6 , db.foo.find().count() , "basic count after split " );
assert.eq( 6 , db.foo.find().sort( { name : 1 } ).count() , "basic count after split sorted " );
// part 4
s.adminCommand( { movechunk : "test.foo" , find : { name : "allan" } , to : secondary.getMongo().name , _waitForDelete : true } );
s.adminCommand( { movechunk : "test.foo" , find : { name : "eliot" } , to : secondary.getMongo().name , _waitForDelete : true } );
assert.eq( 3 , primary.foo.find().toArray().length , "primary count" );
assert.eq( 3 , secondary.foo.find().toArray().length , "secondary count" );

View File

@ -0,0 +1,62 @@
//
// Tests cleanup of sharded and unsharded cursors
//
var st = new ShardingTest({ shards : 2, mongos : 1, other : { separateConfig : true } });
st.stopBalancer();
var mongos = st.s0;
var admin = mongos.getDB( "admin" );
var config = mongos.getDB( "config" );
var shards = config.shards.find().toArray();
var coll = mongos.getCollection( "foo.bar" );
var collUnsharded = mongos.getCollection( "foo.baz" );
// Shard collection
printjson(admin.runCommand({ enableSharding : coll.getDB() + "" }));
printjson(admin.runCommand({ movePrimary : coll.getDB() + "", to : shards[0]._id }));
printjson(admin.runCommand({ shardCollection : coll + "", key : { _id : 1 } }));
printjson(admin.runCommand({ split : coll + "", middle : { _id : 0 } }));
printjson(admin.runCommand({ moveChunk : coll + "", find : { _id : 0 }, to : shards[1]._id }));
jsTest.log("Collection set up...");
st.printShardingStatus(true);
jsTest.log("Insert enough data to overwhelm a query batch.");
for (var i = -150; i < 150; i++) {
coll.insert({ _id : i });
collUnsharded.insert({ _id : i });
}
assert.eq(null, coll.getDB().getLastError());
jsTest.log("Open a cursor to a sharded and unsharded collection.");
var shardedCursor = coll.find();
assert.neq(null, shardedCursor.next());
var unshardedCursor = collUnsharded.find();
assert.neq(null, unshardedCursor.next());
jsTest.log("Check whether the cursor is registered in the cursor info.");
var cursorInfo = admin.runCommand({ cursorInfo : true });
printjson(cursorInfo);
assert.eq(cursorInfo.sharded, 1);
assert.eq(cursorInfo.refs, 1);
jsTest.log("End the cursors.");
shardedCursor.itcount();
unshardedCursor.itcount();
var cursorInfo = admin.runCommand({ cursorInfo : true });
printjson(cursorInfo);
assert.eq(cursorInfo.sharded, 0);
assert.eq(cursorInfo.refs, 0);
jsTest.log("DONE!");
st.stop();

View File

@ -0,0 +1,38 @@
/**
* Test that split/move chunk update the dbhash on the config server
*/
st = new ShardingTest({ name: "dbhash", shards : 2, mongos : 2, verbose : 2, other: {separateConfig : 1 } });
st.stopBalancer();
var mongos = st.s0;
var shards = mongos.getCollection( "config.shards" ).find().toArray();
var admin = mongos.getDB( "admin" );
var configs = st._configServers
assert(admin.runCommand({ enablesharding : "test" }).ok);
printjson(admin.runCommand({ movePrimary : "test", to : shards[0]._id }));
assert(admin.runCommand({ shardcollection : "test.foo" , key : { x : 1 } }).ok);
mongos.getCollection("test.foo").insert({x:1});
assert.eq(1, st.config.chunks.count(), "there should only be 1 chunk")
var dbhash1 = configs[0].getDB("config").runCommand( "dbhash");
printjson("dbhash before split and move is " + dbhash1.collections.chunks);
// split the chunk and move one chunk to the non-primary shard
assert(admin.runCommand({ split : "test.foo", middle : { x : 0 } }).ok);
assert( admin.runCommand({ moveChunk : "test.foo",
find : { x : 0 },
to : shards[1]._id,
_waitForDelete : true }).ok );
st.printShardingStatus();
assert.eq(2, st.config.chunks.count(), "there should be 2 chunks")
var dbhash2 = configs[0].getDB("config").runCommand("dbhash");
printjson("dbhash after split and move is " + dbhash2.collections.chunks);
assert.neq(dbhash1.collections.chunks, dbhash2.collections.chunks, "The hash should be different after split and move." )
st.stop();

View File

@ -0,0 +1,39 @@
//
// Tests that a balancer round loads newly sharded collection data
//
var options = {separateConfig : true, mongosOptions : {verbose : 1}};
var st = new ShardingTest({shards : 2, mongos : 2, other : options});
// Stop balancer initially
st.stopBalancer();
var mongos = st.s0;
var staleMongos = st.s1;
var coll = mongos.getCollection("foo.bar");
// Stop first mongos from balancing
assert(mongos.adminCommand({configureFailPoint : "neverBalance", mode : "alwaysOn"}).ok);
// Shard collection through first mongos
assert(mongos.adminCommand({enableSharding : coll.getDB() + ""}).ok);
assert(mongos.adminCommand({shardCollection : coll + "", key : {_id : 1}}).ok);
// Create a bunch of chunks
var numSplits = 20;
for ( var i = 0; i < numSplits; i++) {
assert(mongos.adminCommand({split : coll + "", middle : {_id : i}}).ok);
}
// Start balancer, which lets the stale mongos balance
st.startBalancer();
// Make sure we eventually start moving chunks
assert.soon(function() {
return mongos.getCollection("config.changelog").count({what : /moveChunk/}) > 0;
}, "no balance happened", 5 * 60 * 1000);
jsTest.log("DONE!");
st.stop();

View File

@ -103,8 +103,8 @@ assert.soon(function() {
// mine = getMine(curOpState == 0 && i > 20);
i++;
// Wait for the queries to start
if (curOpState == 0 && mine.length > 0) {
// Wait for the queries to start (one per shard, so 2 total)
if (curOpState == 0 && mine.length == 2) {
// queries started
curOpState = 1;
// kill all $where

View File

@ -0,0 +1,46 @@
//
// Tests whether we forget M/R's temporary namespaces for sharded output
//
var options = { separateConfig : true };
var st = new ShardingTest({ shards : 1, mongos : 1, other : options });
var mongos = st.s0;
var admin = mongos.getDB( "admin" );
var coll = mongos.getCollection( "foo.bar" );
var outputColl = mongos.getCollection( (coll.getDB() + "") + ".mrOutput" );
for ( var i = 0; i < 10; i++ ) {
coll.insert({ _id : i, even : (i % 2 == 0) });
}
assert.eq( null, coll.getDB().getLastError() );
var map = function() { emit( this.even, 1 ); };
var reduce = function( key, values ) { return Array.sum(values); };
out = coll.mapReduce( map, reduce, { out: { reduce : outputColl.getName(), sharded: true } } );
printjson( out );
printjson( outputColl.find().toArray() );
var mongodThreadStats = st.shard0.getDB( "admin" ).runCommand({ shardConnPoolStats : 1 }).threads;
var mongosThreadStats = admin.runCommand({ shardConnPoolStats : 1 }).threads;
printjson( mongodThreadStats );
printjson( mongosThreadStats );
var checkForSeenNS = function( threadStats, regex ) {
for ( var i = 0; i < threadStats.length; i++ ) {
var seenNSes = threadStats[i].seenNS;
for ( var j = 0; j < seenNSes.length; j++ ) {
assert( !( regex.test( seenNSes ) ) );
}
}
}
checkForSeenNS( mongodThreadStats, /^foo.tmp/ );
checkForSeenNS( mongosThreadStats, /^foo.tmp/ );
st.stop();

View File

@ -10,6 +10,14 @@ function writeToConfigTest(){
var gleObj = confDB.runCommand({ getLastError: 1, w: 'majority' });
assert( gleObj.ok );
assert.eq("norepl", gleObj.err);
// w:1 should still work
confDB.settings.update({ _id: 'balancer' }, { $set: { stopped: true }});
var gleObj = confDB.runCommand({ getLastError: 1, w: 1 });
assert(gleObj.ok);
assert.eq(null, gleObj.err);
st.stop();
}

View File

@ -1,104 +0,0 @@
// Test that sharding a new collection with a hashed shard key pre-splits chunk ranges and
// distributes initial chunks evenly.
var s = new ShardingTest( { name : jsTestName() , shards : 3 , mongos : 1, verbose : 1 } );
var dbname = "test";
var coll = "foo";
var db = s.getDB( dbname );
db.adminCommand( { enablesharding : dbname } );
//for simplicity turn off balancer
s.stopBalancer();
// Test 1
// Using hashed shard key, but collection is non-empty, so should not pre-split.
print("****** Test 1 *******");
db.getCollection( coll ).drop();
db.getCollection( coll ).insert( { a : 1 } );
db.getCollection( coll ).ensureIndex( { a: "hashed"} );
var res = db.adminCommand( { shardcollection : dbname + "." + coll , key : { a : "hashed" } } );
assert.eq( res.ok , 1 , "shardcollection didn't work" );
db.printShardingStatus();
var numChunks = s.config.chunks.count();
assert.eq( numChunks , 1 , "sharding non-empty collection should not pre-split" );
// Test 2
// Using hashed shard key, collection is empty, and numInitialChunks specified.
print("****** Test 2 *******");
db.getCollection( coll ).drop();
var res = db.adminCommand( { shardcollection : dbname + "." + coll ,
key : { a : "hashed" } ,
numInitialChunks : 500 } );
assert.eq( res.ok , 1 , "shardcollection didn't work" );
db.printShardingStatus();
var numChunks = s.config.chunks.count();
assert.eq( numChunks , 500 , "should be exactly 500 chunks" );
var shards = s.config.shards.find();
shards.forEach(
// check that each shard has one third the numInitialChunks
function( shard ){
var numChunksOnShard = s.config.chunks.find( {"shard" : shard._id} ).count();
assert.gte( numChunksOnShard , Math.floor( 500/3 ) );
}
);
// Test 3
// Using hashed shard key, collection is empty, and using default numInitialChunks.
print("****** Test 3 *******");
db.getCollection( coll ).drop();
// create an unrelated index. later check that pre-splitting creates index on shards with chunks
db.getCollection( coll ).ensureIndex( { dummy : 1 } );
var res = db.adminCommand( { shardcollection : dbname + "." + coll , key : { a : "hashed" } } );
assert.eq( res.ok , 1 , "shardcollection didn't work" );
db.printShardingStatus();
var numChunks = s.config.chunks.count();
assert.gt( numChunks , 1 , "should be multiple chunks" );
var shards = s.config.shards.find();
shards.forEach(
function( shard ){
// check that each shard has one third of the chunks
var numChunksOnShard = s.config.chunks.find( { "shard" : shard._id } ).count();
assert.gte( numChunksOnShard , Math.floor( numChunks/3 ) );
// and the unrelated index
var conn = new Mongo ( shard.host );
printjson( conn.getDB( dbname ).getCollection( coll ).getIndexes() );
assert.eq( 1 , conn.getDB( dbname ).system.indexes.find( { key : { dummy : 1 } } ).count(),
"shard missing dummy index" );
}
);
// finally, check that the collection gets dropped correctly (which doesn't happen if pre-splitting
// fails to create the collection on all shards).
var res = db.runCommand( { "drop" : coll } );
assert.eq( res.ok , 1 , "couldn't drop empty, pre-split collection");
s.stop();
(function() {
jsTest.log('Test hashed presplit with 1 shard.');
var st = new ShardingTest({ shards: 1 });
var testDB = st.getDB('test');
//create hashed shard key and enable sharding
testDB.adminCommand({ enablesharding: "test" });
testDB.adminCommand({ shardCollection: "test.collection", key: { a: "hashed" }});
//check the number of initial chunks.
assert.eq(2, st.getDB('config').chunks.count(),
'Using hashed shard key but failing to do correct presplitting');
st.stop();
})();

View File

@ -0,0 +1,22 @@
// Hash sharding on a non empty collection should not pre-split.
var s = new ShardingTest({ name : jsTestName(), shards : 3, mongos : 1, verbose : 1 });
var dbname = "test";
var coll = "foo";
var db = s.getDB(dbname);
db.adminCommand({ enablesharding : dbname });
//for simplicity turn off balancer
s.stopBalancer();
db.getCollection(coll).insert({ a : 1 });
db.getCollection(coll).ensureIndex({ a: "hashed"});
var res = db.adminCommand({ shardcollection : dbname + "." + coll, key : { a : "hashed" } });
assert.eq(res.ok, 1, "shardcollection didn't work");
db.printShardingStatus();
var numChunks = s.config.chunks.count();
assert.eq(numChunks, 1 , "sharding non-empty collection should not pre-split");
s.stop();

View File

@ -0,0 +1,35 @@
// Hash sharding with initial chunk count set.
var s = new ShardingTest({ shards : 3, mongos : 1, verbose : 1 });
var dbname = "test";
var coll = "foo";
var db = s.getDB(dbname);
db.adminCommand({ enablesharding : dbname });
//for simplicity turn off balancer
s.stopBalancer();
var res = db.adminCommand({ shardcollection : dbname + "." + coll,
key : { a : "hashed" },
numInitialChunks : 500 });
assert.eq(res.ok, 1, "shardcollection didn't work");
db.printShardingStatus();
var numChunks = s.config.chunks.count();
assert.eq(numChunks, 500 , "should be exactly 500 chunks");
var shards = s.config.shards.find();
shards.forEach(
// check that each shard has one third the numInitialChunks
function (shard){
var numChunksOnShard = s.config.chunks.find({"shard" : shard._id}).count();
assert.gte(numChunksOnShard, Math.floor(500/3));
}
);
// Check that the collection gets dropped correctly (which doesn't happen if pre-splitting
// fails to create the collection on all shards).
res = db.runCommand({ "drop" : coll });
assert.eq(res.ok, 1, "couldn't drop empty, pre-split collection");
s.stop();

View File

@ -0,0 +1,14 @@
// Test hashed presplit with 1 shard.
var st = new ShardingTest({ shards: 1 });
var testDB = st.getDB('test');
//create hashed shard key and enable sharding
testDB.adminCommand({ enablesharding: "test" });
testDB.adminCommand({ shardCollection: "test.collection", key: { a: "hashed" }});
//check the number of initial chunks.
assert.eq(2, st.getDB('config').chunks.count(),
'Using hashed shard key but failing to do correct presplitting');
st.stop();

View File

@ -11,6 +11,7 @@ for ( var i = 0; i < 19; i++ ) {
for ( var j = 0; j < 300; j++ ) {
coll.insert( { num : j, x : 1 } )
}
assert.eq( null, coll.getDB().getLastError() );
if(i == 0) s.adminCommand( { enablesharding : "" + coll._db } );

View File

@ -98,7 +98,7 @@ for ( var i=0; i<types.length; i++ ){
s.adminCommand( { split : longName , find : makeObjectDotted( curT.values[3] ) } );
s.adminCommand( { split : longName , find : makeObjectDotted( curT.values[3] ) } );
s.adminCommand( { movechunk : longName , find : makeObjectDotted( curT.values[0] ) , to : secondary.getMongo().name, _waitForDelete : true } );
s.adminCommand( { movechunk : longName , find : makeObjectDotted( curT.values[2] ) , to : secondary.getMongo().name, _waitForDelete : true } );
s.printChunks();

View File

@ -24,7 +24,7 @@ s.adminCommand( { split : "test.foo" , find : { name : "joe" } } ); // [Minkey -
s.adminCommand( { split : "test.foo" , find : { name : "joe" } } ); // * [allan -> sara) , [sara -> Maxkey)
s.adminCommand( { split : "test.foo" , find : { name : "joe" } } ); // [alan -> joe) , [joe -> sara]
s.adminCommand( { movechunk : "test.foo" , find : { name : "allan" } , to : seconday.getMongo().name, _waitForDelete : true, _waitForDelete : true } );
s.adminCommand( { movechunk : "test.foo" , find : { name : "eliot" } , to : seconday.getMongo().name, _waitForDelete : true, _waitForDelete : true } );
s.printChunks();
@ -42,7 +42,7 @@ assert.eq( "sara,mark,joe,eliot,bob,allan" , db.foo.find().sort( { name : -1 }
// make sure we can't foce a split on an extreme key
// [allan->joe)
assert.throws( function(){ s.adminCommand( { split : "test.foo" , middle : { name : "allan" } } ) } );
assert.throws( function(){ s.adminCommand( { split : "test.foo" , middle : { name : "joe" } } ) } );
assert.throws( function(){ s.adminCommand( { split : "test.foo" , middle : { name : "eliot" } } ) } );
s.stop();

Some files were not shown because too many files have changed in this diff Show More