From 7f50e165b60c576d331b3d878ec54c13fd554fad Mon Sep 17 00:00:00 2001 From: Richard Kreuter Date: Mon, 17 May 2010 15:43:56 -0400 Subject: [PATCH 1/4] Fix typos in debian/mongo.1 for SERVER-1131 --- debian/mongo.1 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/debian/mongo.1 b/debian/mongo.1 index 2eeb6747cd2..89f48816a65 100644 --- a/debian/mongo.1 +++ b/debian/mongo.1 @@ -17,16 +17,16 @@ If JavaScript files are specified on the command line, the shell will run non\-i .B mongo start the shell, connecting to the server at localhost:27017 and using the test database .TP -.B mongod foo +.B mongo foo start the shell using the foo database at localhost:27017 .TP -.B mongod 192.169.0.5/foo +.B mongo 192.169.0.5/foo start the shell using the foo database at 192.169.0.5:27017 .TP -.B mongod 192.169.0.5:9999/foo +.B mongo 192.169.0.5:9999/foo start the shell using the foo database at 192.169.0.5:9999 .TP -.B mongod script1.js script2.js script3.js +.B mongo script1.js script2.js script3.js run three scripts and exit .SH "OPTIONS" .TP From cda4dc0772fbeddc934e3bf6a5e19ada5cf631e9 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Mon, 17 May 2010 16:50:33 -0400 Subject: [PATCH 2/4] better logging --- db/btree.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/btree.cpp b/db/btree.cpp index b41c3620138..fef7604b6f0 100644 --- a/db/btree.cpp +++ b/db/btree.cpp @@ -561,7 +561,7 @@ found: /* remove a key from the index */ bool BtreeBucket::unindex(const DiskLoc& thisLoc, IndexDetails& id, BSONObj& key, const DiskLoc& recordLoc ) { if ( key.objsize() > KeyMax ) { - OCCASIONALLY problem() << "unindex: key too large to index, skipping " << id.indexNamespace() << /* ' ' << key.toString() << */ '\n'; + OCCASIONALLY problem() << "unindex: key too large to index, skipping " << id.indexNamespace() << /* ' ' << key.toString() << */ endl; return false; } @@ -904,7 +904,7 @@ found: { if ( toplevel ) { if ( key.objsize() > KeyMax ) { - problem() << "Btree::insert: key too large to index, skipping " << idx.indexNamespace().c_str() << ' ' << key.objsize() << ' ' << key.toString() << '\n'; + problem() << "Btree::insert: key too large to index, skipping " << idx.indexNamespace().c_str() << ' ' << key.objsize() << ' ' << key.toString() << endl; return 3; } } @@ -1033,7 +1033,7 @@ namespace mongo { if ( ! b->_pushBack(loc, key, ordering, DiskLoc()) ){ // no room if ( key.objsize() > KeyMax ) { - problem() << "Btree::insert: key too large to index, skipping " << idx.indexNamespace().c_str() << ' ' << key.objsize() << ' ' << key.toString() << '\n'; + problem() << "Btree::insert: key too large to index, skipping " << idx.indexNamespace().c_str() << ' ' << key.objsize() << ' ' << key.toString() << endl; } else { // bucket was full From 0afdef1676fcc0e822540f0c1b8c701d4a27a670 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Mon, 17 May 2010 16:50:47 -0400 Subject: [PATCH 3/4] cruft/pack cleaning --- bson/bsonobj.h | 12 ------------ bson/oid.h | 1 - 2 files changed, 13 deletions(-) diff --git a/bson/bsonobj.h b/bson/bsonobj.h index 01a55998b3c..488c5f7eef4 100644 --- a/bson/bsonobj.h +++ b/bson/bsonobj.h @@ -378,18 +378,6 @@ private: massert( 10334 , s , 0 ); } } -/* -#pragma pack(1) - static struct EmptyObject { - EmptyObject() { - len = 5; - jstype = EOO; - } - int len; - char jstype; - } emptyObject; -#pragma pack() -*/ }; ostream& operator<<( ostream &s, const BSONObj &o ); ostream& operator<<( ostream &s, const BSONElement &e ); diff --git a/bson/oid.h b/bson/oid.h index 86105d9133f..d8eea84a2c6 100644 --- a/bson/oid.h +++ b/bson/oid.h @@ -20,7 +20,6 @@ namespace mongo { #pragma pack(1) - /** Object ID type. BSON objects typically have an _id field for the object id. This field should be the first member of the object when present. class OID is a special type that is a 12 byte id which From c0adf87b3c69ce9bb7d3ad62a65e9428d50bb5fc Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Mon, 17 May 2010 16:50:58 -0400 Subject: [PATCH 4/4] fix some pragma pack --- db/btree.h | 13 +++++++------ db/diskloc.h | 3 +-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/db/btree.h b/db/btree.h index 6e499337eb5..dbe6a14272a 100644 --- a/db/btree.h +++ b/db/btree.h @@ -26,7 +26,6 @@ namespace mongo { #pragma pack(1) - struct _KeyNode { DiskLoc prevChildBucket; // the lchild DiskLoc recordLoc; // location of the record associated with the key @@ -60,7 +59,6 @@ namespace mongo { return !isUnused(); } }; - #pragma pack() class BucketBasics; @@ -75,7 +73,6 @@ namespace mongo { }; #pragma pack(1) - /* this class is all about the storage management */ class BucketBasics { friend class BtreeBuilder; @@ -187,7 +184,9 @@ namespace mongo { } char data[4]; }; +#pragma pack() +#pragma pack(1) class BtreeBucket : public BucketBasics { friend class BtreeCursor; public: @@ -262,13 +261,15 @@ namespace mongo { // simply builds and returns a dup key error message string static string dupKeyError( const IndexDetails& idx , const BSONObj& key ); }; +#pragma pack() class BtreeCursor : public Cursor { public: BtreeCursor( NamespaceDetails *_d, int _idxNo, const IndexDetails&, const BSONObj &startKey, const BSONObj &endKey, bool endKeyInclusive, int direction ); BtreeCursor( NamespaceDetails *_d, int _idxNo, const IndexDetails& _id, const BoundList &_bounds, int _direction ); - + ~BtreeCursor(){ + } virtual bool ok() { return !bucket.isNull(); } @@ -287,7 +288,6 @@ namespace mongo { otherwise, marks loc as sent. @return true if the loc has not been seen */ - set dups; virtual bool getsetdup(DiskLoc loc) { if( multikey ) { pair::iterator, bool> p = dups.insert(loc); @@ -375,6 +375,7 @@ namespace mongo { void initInterval(); friend class BtreeBucket; + set dups; NamespaceDetails *d; int idxNo; BSONObj startKey; @@ -392,9 +393,9 @@ namespace mongo { BoundList bounds_; unsigned boundIndex_; const IndexSpec& _spec; + }; -#pragma pack() inline bool IndexDetails::hasKey(const BSONObj& key) { return head.btree()->exists(*this, head, key, Ordering::make(keyPattern())); diff --git a/db/diskloc.h b/db/diskloc.h index ece9df202e5..93ef78b7957 100644 --- a/db/diskloc.h +++ b/db/diskloc.h @@ -26,7 +26,6 @@ namespace mongo { -#pragma pack(1) class Record; class DeletedRecord; @@ -34,6 +33,7 @@ namespace mongo { class BtreeBucket; class MongoDataFile; +#pragma pack(1) class DiskLoc { int fileNo; /* this will be volume, file #, etc. */ int ofs; @@ -151,7 +151,6 @@ namespace mongo { MongoDataFile& pdf() const; }; - #pragma pack() const DiskLoc minDiskLoc(0, 1);