2d_access_method.h   2d_access_method.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/index/2d_common.h" #include "mongo/db/index/2d_common.h"
#include "mongo/db/index/btree_access_method_internal.h" #include "mongo/db/index/btree_access_method_internal.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 2d_common.h   2d_common.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/db/geo/hash.h" #include "mongo/db/geo/hash.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 2d_index_cursor.h   2d_index_cursor.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <vector> #include <vector>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/geo/geoquery.h" #include "mongo/db/geo/geoquery.h"
#include "mongo/db/index/2d_common.h" #include "mongo/db/index/2d_common.h"
#include "mongo/db/index/index_cursor.h" #include "mongo/db/index/index_cursor.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 accumulator.h   accumulator.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link th
e
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the GNU Affero General Public License in all respects f
or
* all of the code used other than as permitted herein. If you modify file(
s)
* with this exception, you may extend this exception to your version of th
e
* file(s), but you are not obligated to do so. If you do not wish to do so
,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also dele
te
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include <boost/unordered_set.hpp> #include <boost/unordered_set.hpp>
#include "mongo/bson/bsontypes.h" #include "mongo/bson/bsontypes.h"
#include "mongo/db/pipeline/value.h" #include "mongo/db/pipeline/value.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 18 lines changed or added


 action_set.h   action_set.h 
skipping to change at line 19 skipping to change at line 19
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
#include <bitset> #include <bitset>
#include <vector>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/auth/action_type.h" #include "mongo/db/auth/action_type.h"
namespace mongo { namespace mongo {
/* /*
* An ActionSet is a bitmask of ActionTypes that represents a set of a ctions. * An ActionSet is a bitmask of ActionTypes that represents a set of a ctions.
* These are the actions that a Privilege can grant a user to perform on a resource. * These are the actions that a Privilege can grant a user to perform on a resource.
*/ */
skipping to change at line 55 skipping to change at line 56
bool contains(const ActionType& action) const; bool contains(const ActionType& action) const;
// Returns true only if this ActionSet contains all the actions pre sent in the 'other' // Returns true only if this ActionSet contains all the actions pre sent in the 'other'
// ActionSet. // ActionSet.
bool isSupersetOf(const ActionSet& other) const; bool isSupersetOf(const ActionSet& other) const;
// Returns the string representation of this ActionSet // Returns the string representation of this ActionSet
std::string toString() const; std::string toString() const;
// Returns a vector of strings representing the actions in the Acti
onSet.
std::vector<std::string> getActionsAsStrings() const;
// Takes a comma-separated string of action type string representat ions and returns // Takes a comma-separated string of action type string representat ions and returns
// an int bitmask of the actions. // an int bitmask of the actions.
static Status parseActionSetFromString(const std::string& actionsSt ring, ActionSet* result); static Status parseActionSetFromString(const std::string& actionsSt ring, ActionSet* result);
private: private:
// bitmask of actions this privilege grants // bitmask of actions this privilege grants
std::bitset<ActionType::NUM_ACTION_TYPES> _actions; std::bitset<ActionType::NUM_ACTION_TYPES> _actions;
}; };
 End of changes. 2 change blocks. 
0 lines changed or deleted 5 lines changed or added


 action_type.h   action_type.h 
skipping to change at line 51 skipping to change at line 51
std::string toString() const; std::string toString() const;
// Takes the string representation of a single action type and retu rns the corresponding // Takes the string representation of a single action type and retu rns the corresponding
// ActionType enum. // ActionType enum.
static Status parseActionFromString(const std::string& actionString , ActionType* result); static Status parseActionFromString(const std::string& actionString , ActionType* result);
// Takes an ActionType and returns the string representation // Takes an ActionType and returns the string representation
static std::string actionToString(const ActionType& action); static std::string actionToString(const ActionType& action);
static const ActionType addShard; static const ActionType addShard;
static const ActionType applicationMessage;
static const ActionType auditLogRotate;
static const ActionType authCheck; static const ActionType authCheck;
static const ActionType authenticate; static const ActionType authenticate;
static const ActionType captrunc; static const ActionType captrunc;
static const ActionType changeAnyCustomData;
static const ActionType changeAnyPassword;
static const ActionType changeOwnPassword;
static const ActionType changeOwnCustomData;
static const ActionType clean; static const ActionType clean;
static const ActionType cleanupOrphaned; static const ActionType cleanupOrphaned;
static const ActionType clone; static const ActionType clone;
static const ActionType cloneCollectionLocalSource; static const ActionType cloneCollectionLocalSource;
static const ActionType cloneCollectionTarget; static const ActionType cloneCollectionTarget;
static const ActionType closeAllDatabases; static const ActionType closeAllDatabases;
static const ActionType collMod; static const ActionType collMod;
static const ActionType collStats; static const ActionType collStats;
static const ActionType compact; static const ActionType compact;
static const ActionType connPoolStats; static const ActionType connPoolStats;
static const ActionType connPoolSync; static const ActionType connPoolSync;
static const ActionType convertToCapped; static const ActionType convertToCapped;
static const ActionType copyDBTarget; static const ActionType copyDBTarget;
static const ActionType cpuProfiler; static const ActionType cpuProfiler;
static const ActionType createCollection; static const ActionType createCollection;
static const ActionType createDatabase;
static const ActionType createIndex;
static const ActionType createRole;
static const ActionType createUser;
static const ActionType cursorInfo; static const ActionType cursorInfo;
static const ActionType dbHash; static const ActionType dbHash;
static const ActionType dbStats; static const ActionType dbStats;
static const ActionType diagLogging; static const ActionType diagLogging;
static const ActionType dropAllRolesForDatabase;
static const ActionType dropAllUsersFromDatabase;
static const ActionType dropCollection; static const ActionType dropCollection;
static const ActionType dropDatabase; static const ActionType dropDatabase;
static const ActionType dropIndexes; static const ActionType dropIndex;
static const ActionType dropRole;
static const ActionType dropUser;
static const ActionType emptycapped; static const ActionType emptycapped;
static const ActionType enableSharding; static const ActionType enableSharding;
static const ActionType ensureIndex;
static const ActionType find; static const ActionType find;
static const ActionType flushRouterConfig; static const ActionType flushRouterConfig;
static const ActionType fsync; static const ActionType fsync;
static const ActionType getCmdLineOpts; static const ActionType getCmdLineOpts;
static const ActionType getLog; static const ActionType getLog;
static const ActionType getParameter; static const ActionType getParameter;
static const ActionType getShardMap; static const ActionType getShardMap;
static const ActionType getShardVersion; static const ActionType getShardVersion;
static const ActionType grantAnyRole;
static const ActionType grantPrivilegesToRole;
static const ActionType grantRolesToRole;
static const ActionType grantRolesToUser;
static const ActionType handshake; static const ActionType handshake;
static const ActionType hostInfo; static const ActionType hostInfo;
static const ActionType indexRead; static const ActionType indexRead;
static const ActionType indexStats; static const ActionType indexStats;
static const ActionType inprog; static const ActionType inprog;
static const ActionType insert; static const ActionType insert;
static const ActionType invalidateUserCache;
static const ActionType killCursors; static const ActionType killCursors;
static const ActionType killop; static const ActionType killop;
static const ActionType listDatabases; static const ActionType listDatabases;
static const ActionType listShards; static const ActionType listShards;
static const ActionType logRotate; static const ActionType logRotate;
static const ActionType mapReduceShardedFinish; static const ActionType mapReduceShardedFinish;
static const ActionType mergeChunks; static const ActionType mergeChunks;
static const ActionType moveChunk; static const ActionType moveChunk;
static const ActionType movePrimary; static const ActionType movePrimary;
static const ActionType netstat; static const ActionType netstat;
static const ActionType profileEnable; static const ActionType profileEnable;
static const ActionType profileRead; static const ActionType profileRead;
static const ActionType reIndex; static const ActionType reIndex;
static const ActionType remove; static const ActionType remove;
static const ActionType removeShard; static const ActionType removeShard;
static const ActionType renameCollection;
static const ActionType renameCollectionSameDB; static const ActionType renameCollectionSameDB;
static const ActionType repairDatabase; static const ActionType repairDatabase;
static const ActionType replSetElect; static const ActionType replSetElect;
static const ActionType replSetFreeze; static const ActionType replSetFreeze;
static const ActionType replSetFresh; static const ActionType replSetFresh;
static const ActionType replSetGetRBID; static const ActionType replSetGetRBID;
static const ActionType replSetGetStatus; static const ActionType replSetGetStatus;
static const ActionType replSetHeartbeat; static const ActionType replSetHeartbeat;
static const ActionType replSetInitiate; static const ActionType replSetInitiate;
static const ActionType replSetMaintenance; static const ActionType replSetMaintenance;
static const ActionType replSetReconfig; static const ActionType replSetReconfig;
static const ActionType replSetStepDown; static const ActionType replSetStepDown;
static const ActionType replSetSyncFrom; static const ActionType replSetSyncFrom;
static const ActionType replSetUpdatePosition; static const ActionType replSetUpdatePosition;
static const ActionType resync; static const ActionType resync;
static const ActionType revokeAnyRole;
static const ActionType revokePrivilegesFromRole;
static const ActionType revokeRolesFromRole;
static const ActionType revokeRolesFromUser;
static const ActionType serverStatus; static const ActionType serverStatus;
static const ActionType setParameter; static const ActionType setParameter;
static const ActionType setShardVersion; static const ActionType setShardVersion;
static const ActionType shardCollection; static const ActionType shardCollection;
static const ActionType shardingState; static const ActionType shardingState;
static const ActionType shutdown; static const ActionType shutdown;
static const ActionType split; static const ActionType split;
static const ActionType splitChunk; static const ActionType splitChunk;
static const ActionType splitVector; static const ActionType splitVector;
static const ActionType storageDetails; static const ActionType storageDetails;
static const ActionType top; static const ActionType top;
static const ActionType touch; static const ActionType touch;
static const ActionType unlock; static const ActionType unlock;
static const ActionType unsetSharding; static const ActionType unsetSharding;
static const ActionType update; static const ActionType update;
static const ActionType updateRole;
static const ActionType updateUser;
static const ActionType userAdmin; static const ActionType userAdmin;
static const ActionType userAdminV1; static const ActionType userAdminV1;
static const ActionType validate; static const ActionType validate;
static const ActionType viewRole;
static const ActionType viewUser;
static const ActionType writebacklisten; static const ActionType writebacklisten;
static const ActionType writeBacksQueued; static const ActionType writeBacksQueued;
static const ActionType _migrateClone; static const ActionType _migrateClone;
static const ActionType _recvChunkAbort; static const ActionType _recvChunkAbort;
static const ActionType _recvChunkCommit; static const ActionType _recvChunkCommit;
static const ActionType _recvChunkStart; static const ActionType _recvChunkStart;
static const ActionType _recvChunkStatus; static const ActionType _recvChunkStatus;
static const ActionType _transferMods; static const ActionType _transferMods;
enum ActionTypeIdentifier { enum ActionTypeIdentifier {
addShardValue, addShardValue,
applicationMessageValue,
auditLogRotateValue,
authCheckValue, authCheckValue,
authenticateValue, authenticateValue,
captruncValue, captruncValue,
changeAnyCustomDataValue,
changeAnyPasswordValue,
changeOwnPasswordValue,
changeOwnCustomDataValue,
cleanValue, cleanValue,
cleanupOrphanedValue, cleanupOrphanedValue,
cloneValue, cloneValue,
cloneCollectionLocalSourceValue, cloneCollectionLocalSourceValue,
cloneCollectionTargetValue, cloneCollectionTargetValue,
closeAllDatabasesValue, closeAllDatabasesValue,
collModValue, collModValue,
collStatsValue, collStatsValue,
compactValue, compactValue,
connPoolStatsValue, connPoolStatsValue,
connPoolSyncValue, connPoolSyncValue,
convertToCappedValue, convertToCappedValue,
copyDBTargetValue, copyDBTargetValue,
cpuProfilerValue, cpuProfilerValue,
createCollectionValue, createCollectionValue,
createDatabaseValue,
createIndexValue,
createRoleValue,
createUserValue,
cursorInfoValue, cursorInfoValue,
dbHashValue, dbHashValue,
dbStatsValue, dbStatsValue,
diagLoggingValue, diagLoggingValue,
dropAllRolesForDatabaseValue,
dropAllUsersFromDatabaseValue,
dropCollectionValue, dropCollectionValue,
dropDatabaseValue, dropDatabaseValue,
dropIndexesValue, dropIndexValue,
dropRoleValue,
dropUserValue,
emptycappedValue, emptycappedValue,
enableShardingValue, enableShardingValue,
ensureIndexValue,
findValue, findValue,
flushRouterConfigValue, flushRouterConfigValue,
fsyncValue, fsyncValue,
getCmdLineOptsValue, getCmdLineOptsValue,
getLogValue, getLogValue,
getParameterValue, getParameterValue,
getShardMapValue, getShardMapValue,
getShardVersionValue, getShardVersionValue,
grantAnyRoleValue,
grantPrivilegesToRoleValue,
grantRolesToRoleValue,
grantRolesToUserValue,
handshakeValue, handshakeValue,
hostInfoValue, hostInfoValue,
indexReadValue, indexReadValue,
indexStatsValue, indexStatsValue,
inprogValue, inprogValue,
insertValue, insertValue,
invalidateUserCacheValue,
killCursorsValue, killCursorsValue,
killopValue, killopValue,
listDatabasesValue, listDatabasesValue,
listShardsValue, listShardsValue,
logRotateValue, logRotateValue,
mapReduceShardedFinishValue, mapReduceShardedFinishValue,
mergeChunksValue, mergeChunksValue,
moveChunkValue, moveChunkValue,
movePrimaryValue, movePrimaryValue,
netstatValue, netstatValue,
profileEnableValue, profileEnableValue,
profileReadValue, profileReadValue,
reIndexValue, reIndexValue,
removeValue, removeValue,
removeShardValue, removeShardValue,
renameCollectionValue,
renameCollectionSameDBValue, renameCollectionSameDBValue,
repairDatabaseValue, repairDatabaseValue,
replSetElectValue, replSetElectValue,
replSetFreezeValue, replSetFreezeValue,
replSetFreshValue, replSetFreshValue,
replSetGetRBIDValue, replSetGetRBIDValue,
replSetGetStatusValue, replSetGetStatusValue,
replSetHeartbeatValue, replSetHeartbeatValue,
replSetInitiateValue, replSetInitiateValue,
replSetMaintenanceValue, replSetMaintenanceValue,
replSetReconfigValue, replSetReconfigValue,
replSetStepDownValue, replSetStepDownValue,
replSetSyncFromValue, replSetSyncFromValue,
replSetUpdatePositionValue, replSetUpdatePositionValue,
resyncValue, resyncValue,
revokeAnyRoleValue,
revokePrivilegesFromRoleValue,
revokeRolesFromRoleValue,
revokeRolesFromUserValue,
serverStatusValue, serverStatusValue,
setParameterValue, setParameterValue,
setShardVersionValue, setShardVersionValue,
shardCollectionValue, shardCollectionValue,
shardingStateValue, shardingStateValue,
shutdownValue, shutdownValue,
splitValue, splitValue,
splitChunkValue, splitChunkValue,
splitVectorValue, splitVectorValue,
storageDetailsValue, storageDetailsValue,
topValue, topValue,
touchValue, touchValue,
unlockValue, unlockValue,
unsetShardingValue, unsetShardingValue,
updateValue, updateValue,
updateRoleValue,
updateUserValue,
userAdminValue, userAdminValue,
userAdminV1Value, userAdminV1Value,
validateValue, validateValue,
viewRoleValue,
viewUserValue,
writebacklistenValue, writebacklistenValue,
writeBacksQueuedValue, writeBacksQueuedValue,
_migrateCloneValue, _migrateCloneValue,
_recvChunkAbortValue, _recvChunkAbortValue,
_recvChunkCommitValue, _recvChunkCommitValue,
_recvChunkStartValue, _recvChunkStartValue,
_recvChunkStatusValue, _recvChunkStatusValue,
_transferModsValue, _transferModsValue,
actionTypeEndValue, // Should always be last in this enum actionTypeEndValue, // Should always be last in this enum
 End of changes. 24 change blocks. 
4 lines changed or deleted 58 lines changed or added


 admin_access.h   admin_access.h 
skipping to change at line 18 skipping to change at line 18
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/auth/user_name.h" #include "mongo/db/auth/user_name.h"
namespace mongo { namespace mongo {
/* /*
skipping to change at line 40 skipping to change at line 52
* *
*/ */
class AdminAccess { class AdminAccess {
public: public:
virtual ~AdminAccess() { } virtual ~AdminAccess() { }
/** @return if there are any priviledge users. This should not /** @return if there are any priviledge users. This should not
* block for long and throw if can't get a lock if needed. * block for long and throw if can't get a lock if needed.
*/ */
virtual bool haveAdminUsers() const = 0; virtual bool haveAdminUsers() const = 0;
/** @return privileged user with this name. This should not block
* for long and throw if can't get a lock if needed
*/
virtual BSONObj getAdminUser(const UserName& username) const = 0;
}; };
class NoAdminAccess : public AdminAccess { class NoAdminAccess : public AdminAccess {
public: public:
virtual ~NoAdminAccess() { } virtual ~NoAdminAccess() { }
virtual bool haveAdminUsers() const { return false; } virtual bool haveAdminUsers() const { return false; }
virtual BSONObj getAdminUser(const UserName& username) const { retu rn BSONObj(); }
}; };
} // namespace mongo } // namespace mongo
 End of changes. 3 change blocks. 
6 lines changed or deleted 17 lines changed or added


 alignedbuilder.h   alignedbuilder.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
namespace mongo { namespace mongo {
/** a page-aligned BufBuilder. */ /** a page-aligned BufBuilder. */
class AlignedBuilder { class AlignedBuilder {
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 allocator.h   allocator.h 
skipping to change at line 39 skipping to change at line 39
if ( x == 0 ) printStackAndExit(0); if ( x == 0 ) printStackAndExit(0);
return x; return x;
} }
inline void * ourrealloc(void *ptr, size_t size) { inline void * ourrealloc(void *ptr, size_t size) {
void *x = realloc(ptr, size); void *x = realloc(ptr, size);
if ( x == 0 ) printStackAndExit(0); if ( x == 0 ) printStackAndExit(0);
return x; return x;
} }
#define MONGO_malloc mongo::ourmalloc #define MONGO_malloc ::mongo::ourmalloc
#define MONGO_realloc mongo::ourrealloc #define MONGO_realloc ::mongo::ourrealloc
// this redefines 'malloc' to 'MONGO_malloc', etc // this redefines 'malloc' to 'MONGO_malloc', etc
#include "mongo/client/redef_macros.h" #include "mongo/client/redef_macros.h"
} // namespace mongo } // namespace mongo
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 and_common-inl.h   and_common-inl.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
namespace mongo { namespace mongo {
class AndCommon { class AndCommon {
public: public:
/** /**
* If src has any data dest doesn't, add that data to dest. * If src has any data dest doesn't, add that data to dest.
*/ */
static void mergeFrom(WorkingSetMember* dest, WorkingSetMember* src ) { static void mergeFrom(WorkingSetMember* dest, WorkingSetMember* src ) {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 and_hash.h   and_hash.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <vector> #include <vector>
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/exec/plan_stage.h" #include "mongo/db/exec/plan_stage.h"
skipping to change at line 58 skipping to change at line 70
virtual StageState work(WorkingSetID* out); virtual StageState work(WorkingSetID* out);
virtual bool isEOF(); virtual bool isEOF();
virtual void prepareToYield(); virtual void prepareToYield();
virtual void recoverFromYield(); virtual void recoverFromYield();
virtual void invalidate(const DiskLoc& dl); virtual void invalidate(const DiskLoc& dl);
virtual PlanStageStats* getStats(); virtual PlanStageStats* getStats();
private: private:
StageState readFirstChild(); StageState readFirstChild(WorkingSetID* out);
StageState hashOtherChildren(); StageState hashOtherChildren(WorkingSetID* out);
// Not owned by us. // Not owned by us.
WorkingSet* _ws; WorkingSet* _ws;
// Not owned by us. // Not owned by us.
const MatchExpression* _filter; const MatchExpression* _filter;
// The stages we read from. Owned by us. // The stages we read from. Owned by us.
vector<PlanStage*> _children; vector<PlanStage*> _children;
 End of changes. 2 change blocks. 
2 lines changed or deleted 22 lines changed or added


 and_sorted.h   and_sorted.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <queue> #include <queue>
#include <vector> #include <vector>
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/exec/plan_stage.h" #include "mongo/db/exec/plan_stage.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
skipping to change at line 60 skipping to change at line 72
virtual bool isEOF(); virtual bool isEOF();
virtual void prepareToYield(); virtual void prepareToYield();
virtual void recoverFromYield(); virtual void recoverFromYield();
virtual void invalidate(const DiskLoc& dl); virtual void invalidate(const DiskLoc& dl);
virtual PlanStageStats* getStats(); virtual PlanStageStats* getStats();
private: private:
// Find a node to AND against. // Find a node to AND against.
PlanStage::StageState getTargetLoc(); PlanStage::StageState getTargetLoc(WorkingSetID* out);
// Move a child which hasn't advanced to the target node forward. // Move a child which hasn't advanced to the target node forward.
// Returns the target node in 'out' if all children successfully ad vance to it. // Returns the target node in 'out' if all children successfully ad vance to it.
PlanStage::StageState moveTowardTargetLoc(WorkingSetID* out); PlanStage::StageState moveTowardTargetLoc(WorkingSetID* out);
// Not owned by us. // Not owned by us.
WorkingSet* _ws; WorkingSet* _ws;
// Not owned by us. // Not owned by us.
const MatchExpression* _filter; const MatchExpression* _filter;
 End of changes. 2 change blocks. 
1 lines changed or deleted 21 lines changed or added


 assert_util.h   assert_util.h 
skipping to change at line 35 skipping to change at line 35
#include "mongo/bson/inline_decls.h" #include "mongo/bson/inline_decls.h"
#include "mongo/platform/compiler.h" #include "mongo/platform/compiler.h"
namespace mongo { namespace mongo {
enum CommonErrorCodes { enum CommonErrorCodes {
OkCode = 0, OkCode = 0,
DatabaseDifferCaseCode = 13297 , // uassert( 13297 ) DatabaseDifferCaseCode = 13297 , // uassert( 13297 )
SendStaleConfigCode = 13388 , // uassert( 13388 ) SendStaleConfigCode = 13388 , // uassert( 13388 )
RecvStaleConfigCode = 9996, // uassert( 9996 ) RecvStaleConfigCode = 9996, // uassert( 9996 )
PrepareConfigsFailedCode = 13104 // uassert( 13104 ) PrepareConfigsFailedCode = 13104, // uassert( 13104 )
NotMasterOrSecondaryCode = 13436, // uassert( 13436 )
NotMasterNoSlaveOkCode = 13435, // uassert( 13435 )
NotMaster = 10107 // uassert( 10107 )
}; };
class AssertionCount { class AssertionCount {
public: public:
AssertionCount(); AssertionCount();
void rollover(); void rollover();
void condrollover( int newValue ); void condrollover( int newValue );
int regular; int regular;
int warning; int warning;
skipping to change at line 145 skipping to change at line 148
AssertionException( const char * msg , int code ) : DBException(msg ,code) {} AssertionException( const char * msg , int code ) : DBException(msg ,code) {}
AssertionException( const std::string& msg , int code ) : DBExcepti on(msg,code) {} AssertionException( const std::string& msg , int code ) : DBExcepti on(msg,code) {}
virtual ~AssertionException() throw() { } virtual ~AssertionException() throw() { }
virtual bool severe() { return true; } virtual bool severe() { return true; }
virtual bool isUserAssertion() { return false; } virtual bool isUserAssertion() { return false; }
/* true if an interrupted exception - see KillCurrentOp */ /* true if an interrupted exception - see KillCurrentOp */
bool interrupted() { bool interrupted() {
return _ei.code == 11600 || _ei.code == 11601; return _ei.code == 11600 || _ei.code == 11601 ||
_ei.code == ErrorCodes::ExceededTimeLimit;
} }
}; };
/* UserExceptions are valid errors that a user can cause, like out of d isk space or duplicate key */ /* UserExceptions are valid errors that a user can cause, like out of d isk space or duplicate key */
class UserException : public AssertionException { class UserException : public AssertionException {
public: public:
UserException(int c , const std::string& m) : AssertionException( m , c ) {} UserException(int c , const std::string& m) : AssertionException( m , c ) {}
virtual bool severe() { return false; } virtual bool severe() { return false; }
virtual bool isUserAssertion() { return true; } virtual bool isUserAssertion() { return true; }
virtual void appendPrefix( std::stringstream& ss ) const; virtual void appendPrefix( std::stringstream& ss ) const;
skipping to change at line 170 skipping to change at line 174
MsgAssertionException( const ExceptionInfo& ei ) : AssertionExcepti on( ei ) {} MsgAssertionException( const ExceptionInfo& ei ) : AssertionExcepti on( ei ) {}
MsgAssertionException(int c, const std::string& m) : AssertionExcep tion( m , c ) {} MsgAssertionException(int c, const std::string& m) : AssertionExcep tion( m , c ) {}
virtual bool severe() { return false; } virtual bool severe() { return false; }
virtual void appendPrefix( std::stringstream& ss ) const; virtual void appendPrefix( std::stringstream& ss ) const;
}; };
MONGO_COMPILER_NORETURN void verifyFailed(const char *msg, const char * file, unsigned line); MONGO_COMPILER_NORETURN void verifyFailed(const char *msg, const char * file, unsigned line);
void wasserted(const char *msg, const char *file, unsigned line); void wasserted(const char *msg, const char *file, unsigned line);
MONGO_COMPILER_NORETURN void fassertFailed( int msgid ); MONGO_COMPILER_NORETURN void fassertFailed( int msgid );
MONGO_COMPILER_NORETURN void fassertFailedNoTrace( int msgid ); MONGO_COMPILER_NORETURN void fassertFailedNoTrace( int msgid );
MONGO_COMPILER_NORETURN void fassertFailedWithStatus(int msgid, const S tatus& status);
/** a "user assertion". throws UserAssertion. logs. typically used f or errors that a user /** a "user assertion". throws UserAssertion. logs. typically used f or errors that a user
could cause, such as duplicate key, disk full, etc. could cause, such as duplicate key, disk full, etc.
*/ */
MONGO_COMPILER_NORETURN void uasserted(int msgid, const char *msg); MONGO_COMPILER_NORETURN void uasserted(int msgid, const char *msg);
MONGO_COMPILER_NORETURN void uasserted(int msgid , const std::string &m sg); MONGO_COMPILER_NORETURN void uasserted(int msgid , const std::string &m sg);
/** msgassert and massert are for errors that are internal but have a w ell defined error text std::string. /** msgassert and massert are for errors that are internal but have a w ell defined error text std::string.
a stack trace is logged. a stack trace is logged.
*/ */
skipping to change at line 199 skipping to change at line 204
inline std::string causedBy( const DBException& e ){ return causedBy( e .toString().c_str() ); } inline std::string causedBy( const DBException& e ){ return causedBy( e .toString().c_str() ); }
inline std::string causedBy( const std::exception& e ){ return causedBy ( e.what() ); } inline std::string causedBy( const std::exception& e ){ return causedBy ( e.what() ); }
inline std::string causedBy( const std::string& e ){ return causedBy( e .c_str() ); } inline std::string causedBy( const std::string& e ){ return causedBy( e .c_str() ); }
inline std::string causedBy( const std::string* e ){ inline std::string causedBy( const std::string* e ){
return (e && *e != "") ? causedBy(*e) : ""; return (e && *e != "") ? causedBy(*e) : "";
} }
inline std::string causedBy( const Status& e ){ return causedBy( e.reas on() ); } inline std::string causedBy( const Status& e ){ return causedBy( e.reas on() ); }
/** aborts on condition failure */ /** aborts on condition failure */
inline void fassert(int msgid, bool testOK) {if (MONGO_unlikely(!testOK )) fassertFailed(msgid);} inline void fassert(int msgid, bool testOK) {if (MONGO_unlikely(!testOK )) fassertFailed(msgid);}
inline void fassert(int msgid, const Status& status) {
if (MONGO_unlikely(!status.isOK())) {
fassertFailedWithStatus(msgid, status);
}
}
/* "user assert". if asserts, user did something wrong, not our code * / /* "user assert". if asserts, user did something wrong, not our code * /
#define MONGO_uassert(msgid, msg, expr) (void)( MONGO_likely(!!(expr)) || ( mongo::uasserted(msgid, msg), 0) ) #define MONGO_uassert(msgid, msg, expr) (void)( MONGO_likely(!!(expr)) || ( ::mongo::uasserted(msgid, msg), 0) )
inline void uassertStatusOK(const Status& status) { inline void uassertStatusOK(const Status& status) {
if (MONGO_unlikely(!status.isOK())) { if (MONGO_unlikely(!status.isOK())) {
uasserted((status.location() != 0 ? status.location() : status. code()), uasserted((status.location() != 0 ? status.location() : status. code()),
status.reason()); status.reason());
} }
} }
/* warning only - keeps going */ /* warning only - keeps going */
#define MONGO_wassert(_Expression) (void)( MONGO_likely(!!(_Expression)) || (mongo::wasserted(#_Expression, __FILE__, __LINE__), 0) ) #define MONGO_wassert(_Expression) (void)( MONGO_likely(!!(_Expression)) || (::mongo::wasserted(#_Expression, __FILE__, __LINE__), 0) )
/* display a message, no context, and throw assertionexception /* display a message, no context, and throw assertionexception
easy way to throw an exception and log something without our stack t race easy way to throw an exception and log something without our stack t race
display happening. display happening.
*/ */
#define MONGO_massert(msgid, msg, expr) (void)( MONGO_likely(!!(expr)) || ( mongo::msgasserted(msgid, msg), 0) ) #define MONGO_massert(msgid, msg, expr) (void)( MONGO_likely(!!(expr)) || ( ::mongo::msgasserted(msgid, msg), 0) )
/* same as massert except no msgid */ /* same as massert except no msgid */
#define MONGO_verify(_Expression) (void)( MONGO_likely(!!(_Expression)) || (mongo::verifyFailed(#_Expression, __FILE__, __LINE__), 0) ) #define MONGO_verify(_Expression) (void)( MONGO_likely(!!(_Expression)) || (::mongo::verifyFailed(#_Expression, __FILE__, __LINE__), 0) )
/* dassert is 'debug assert' -- might want to turn off for production a s these /* dassert is 'debug assert' -- might want to turn off for production a s these
could be slow. could be slow.
*/ */
#if defined(_DEBUG) #if defined(_DEBUG)
# define MONGO_dassert(x) fassert(16199, (x)) # define MONGO_dassert(x) fassert(16199, (x))
#else #else
# define MONGO_dassert(x) # define MONGO_dassert(x)
#endif #endif
skipping to change at line 294 skipping to change at line 304
msgasserted( 14043 , ss.str() ); \ msgasserted( 14043 , ss.str() ); \
} catch ( ... ) { \ } catch ( ... ) { \
msgasserted( 14044 , std::string("unknown exception") + msg ); \ msgasserted( 14044 , std::string("unknown exception") + msg ); \
} }
#define DESTRUCTOR_GUARD MONGO_DESTRUCTOR_GUARD #define DESTRUCTOR_GUARD MONGO_DESTRUCTOR_GUARD
#define MONGO_DESTRUCTOR_GUARD( expression ) \ #define MONGO_DESTRUCTOR_GUARD( expression ) \
try { \ try { \
expression; \ expression; \
} catch ( const std::exception &e ) { \ } catch ( const std::exception &e ) { \
problem() << "caught exception (" << e.what() << ") in destructor ( problem() << "caught exception (" << e.what() << ") in destructor (
" << __FUNCTION__ << ")" << endl; \ " << __FUNCTION__ \
<< ")" << std::endl; \
} catch ( ... ) { \ } catch ( ... ) { \
problem() << "caught unknown exception in destructor (" << __FUNCTI problem() << "caught unknown exception in destructor (" << __FUNCTI
ON__ << ")" << endl; \ ON__ << ")" \
<< std::endl; \
} }
 End of changes. 10 change blocks. 
10 lines changed or deleted 22 lines changed or added


 audit.h   audit.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
/** /**
* This module describes free functions for logging various operations of i nterest to a * This module describes free functions for logging various operations of i nterest to a
* party interested in generating logs of user activity in a MongoDB server instance. * party interested in generating logs of user activity in a MongoDB server instance.
*/ */
#pragma once #pragma once
#include "mongo/base/error_codes.h" #include "mongo/base/error_codes.h"
#include "mongo/db/auth/privilege.h"
#include "mongo/db/auth/user.h"
namespace mongo { namespace mongo {
class BSONObj; class BSONObj;
class ClientBasic; class ClientBasic;
class NamespaceString; class NamespaceString;
class ReplSetConfig;
class StringData; class StringData;
class UserName; class UserName;
namespace mutablebson { namespace mutablebson {
class Document; class Document;
} // namespace mutablebson } // namespace mutablebson
namespace audit { namespace audit {
/** /**
skipping to change at line 144 skipping to change at line 159
*/ */
void logUpdateAuthzCheck( void logUpdateAuthzCheck(
ClientBasic* client, ClientBasic* client,
const NamespaceString& ns, const NamespaceString& ns,
const BSONObj& query, const BSONObj& query,
const BSONObj& updateObj, const BSONObj& updateObj,
bool isUpsert, bool isUpsert,
bool isMulti, bool isMulti,
ErrorCodes::Error result); ErrorCodes::Error result);
/**
* Logs the result of a createUser command.
*/
void logCreateUser(ClientBasic* client,
const UserName& username,
bool password,
const BSONObj* customData,
const std::vector<User::RoleData>& roles);
/**
* Logs the result of a dropUser command.
*/
void logDropUser(ClientBasic* client,
const UserName& username);
/**
* Logs the result of a dropAllUsersFromDatabase command.
*/
void logDropAllUsersFromDatabase(ClientBasic* client,
const StringData& dbname);
/**
* Logs the result of a updateUser command.
*/
void logUpdateUser(ClientBasic* client,
const UserName& username,
bool password,
const BSONObj* customData,
const std::vector<User::RoleData>* roles);
/**
* Logs the result of a grantRolesToUser command.
*/
void logGrantRolesToUser(ClientBasic* client,
const UserName& username,
const std::vector<RoleName>& roles);
/**
* Logs the result of a revokeRolesFromUser command.
*/
void logRevokeRolesFromUser(ClientBasic* client,
const UserName& username,
const std::vector<RoleName>& roles);
/**
* Logs the result of a createRole command.
*/
void logCreateRole(ClientBasic* client,
const RoleName& role,
const std::vector<RoleName>& roles,
const PrivilegeVector& privileges);
/**
* Logs the result of a updateRole command.
*/
void logUpdateRole(ClientBasic* client,
const RoleName& role,
const std::vector<RoleName>* roles,
const PrivilegeVector* privileges);
/**
* Logs the result of a dropRole command.
*/
void logDropRole(ClientBasic* client,
const RoleName& role);
/**
* Logs the result of a dropAllRolesForDatabase command.
*/
void logDropAllRolesForDatabase(ClientBasic* client,
const StringData& dbname);
/**
* Logs the result of a grantRolesToRole command.
*/
void logGrantRolesToRole(ClientBasic* client,
const RoleName& role,
const std::vector<RoleName>& roles);
/**
* Logs the result of a revokeRolesFromRole command.
*/
void logRevokeRolesFromRole(ClientBasic* client,
const RoleName& role,
const std::vector<RoleName>& roles);
/**
* Logs the result of a grantPrivilegesToRole command.
*/
void logGrantPrivilegesToRole(ClientBasic* client,
const RoleName& role,
const PrivilegeVector& privileges);
/**
* Logs the result of a revokePrivilegesFromRole command.
*/
void logRevokePrivilegesFromRole(ClientBasic* client,
const RoleName& role,
const PrivilegeVector& privileges);
/**
* Logs the result of a replSet(Re)config command.
*/
void logReplSetReconfig(ClientBasic* client,
const BSONObj* oldConfig,
const BSONObj* newConfig);
/**
* Logs the result of an ApplicationMessage command.
*/
void logApplicationMessage(ClientBasic* client,
const StringData& msg);
/**
* Logs the result of a shutdown command.
*/
void logShutdown(ClientBasic* client);
/**
* Logs the result of an AuditLogRotate command.
*/
void logAuditLogRotate(ClientBasic* client,
const StringData& file);
/**
* Logs the result of a createIndex command.
*/
void logCreateIndex(ClientBasic* client,
const BSONObj* indexSpec,
const StringData& indexname,
const StringData& nsname);
/**
* Logs the result of a createCollection command.
*/
void logCreateCollection(ClientBasic* client,
const StringData& nsname);
/**
* Logs the result of a createDatabase command.
*/
void logCreateDatabase(ClientBasic* client,
const StringData& dbname);
/**
* Logs the result of a dropIndex command.
*/
void logDropIndex(ClientBasic* client,
const StringData& indexname,
const StringData& nsname);
/**
* Logs the result of a dropCollection command.
*/
void logDropCollection(ClientBasic* client,
const StringData& nsname);
/**
* Logs the result of a dropDatabase command.
*/
void logDropDatabase(ClientBasic* client,
const StringData& dbname);
/**
* Logs a collection rename event.
*/
void logRenameCollection(ClientBasic* client,
const StringData& source,
const StringData& target);
} // namespace audit } // namespace audit
} // namespace mongo } // namespace mongo
 End of changes. 4 change blocks. 
0 lines changed or deleted 192 lines changed or added


 auth_index_d.h   auth_index_d.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/namespace_string.h" #include "mongo/db/namespace_string.h"
namespace mongo { namespace mongo {
namespace authindex { namespace authindex {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 authentication_commands.h   authentication_commands.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/auth/user_name.h" #include "mongo/db/auth/user_name.h"
#include "mongo/db/commands.h" #include "mongo/db/commands.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 authorization_manager.h   authorization_manager.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/function.hpp>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/thread/mutex.hpp> #include <boost/thread/mutex.hpp>
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/bson/mutable/element.h"
#include "mongo/db/auth/action_set.h" #include "mongo/db/auth/action_set.h"
#include "mongo/db/auth/authz_manager_external_state.h" #include "mongo/db/auth/resource_pattern.h"
#include "mongo/db/auth/role_graph.h"
#include "mongo/db/auth/user.h" #include "mongo/db/auth/user.h"
#include "mongo/db/auth/user_name.h" #include "mongo/db/auth/user_name.h"
#include "mongo/db/auth/user_name_hash.h" #include "mongo/db/auth/user_name_hash.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/namespace_string.h"
#include "mongo/platform/unordered_map.h" #include "mongo/platform/unordered_map.h"
namespace mongo { namespace mongo {
class AuthzManagerExternalState;
class UserDocumentParser;
/** /**
* Internal secret key info. * Internal secret key info.
*/ */
struct AuthInfo { struct AuthInfo {
User* user; User* user;
BSONObj authParams; BSONObj authParams;
}; };
extern AuthInfo internalSecurity; // set at startup and not changed aft er initialization. extern AuthInfo internalSecurity; // set at startup and not changed aft er initialization.
/** /**
skipping to change at line 56 skipping to change at line 76
*/ */
class AuthorizationManager { class AuthorizationManager {
MONGO_DISALLOW_COPYING(AuthorizationManager); MONGO_DISALLOW_COPYING(AuthorizationManager);
public: public:
// The newly constructed AuthorizationManager takes ownership of "e xternalState" // The newly constructed AuthorizationManager takes ownership of "e xternalState"
explicit AuthorizationManager(AuthzManagerExternalState* externalSt ate); explicit AuthorizationManager(AuthzManagerExternalState* externalSt ate);
~AuthorizationManager(); ~AuthorizationManager();
static const std::string SERVER_RESOURCE_NAME;
static const std::string CLUSTER_RESOURCE_NAME;
static const std::string WILDCARD_RESOURCE_NAME;
static const std::string USER_NAME_FIELD_NAME; static const std::string USER_NAME_FIELD_NAME;
static const std::string USER_SOURCE_FIELD_NAME; static const std::string USER_SOURCE_FIELD_NAME;
static const std::string ROLE_NAME_FIELD_NAME;
static const std::string ROLE_SOURCE_FIELD_NAME;
static const std::string PASSWORD_FIELD_NAME; static const std::string PASSWORD_FIELD_NAME;
static const std::string V1_USER_NAME_FIELD_NAME;
static const std::string V1_USER_SOURCE_FIELD_NAME;
static const NamespaceString adminCommandNamespace;
static const NamespaceString rolesCollectionNamespace;
static const NamespaceString usersCollectionNamespace;
static const NamespaceString versionCollectionNamespace;
// TODO: Make the following functions no longer static. // TODO: Make the following functions no longer static.
/** /**
* Sets whether or not we allow old style (pre v2.4) privilege docu ments for this whole * Sets whether or not we allow old style (pre v2.4) privilege docu ments for this whole
* server. * server.
*/ */
static void setSupportOldStylePrivilegeDocuments(bool enabled); static void setSupportOldStylePrivilegeDocuments(bool enabled);
/** /**
* Returns true if we allow old style privilege privilege documents for this whole server. * Returns true if we allow old style privilege privilege documents for this whole server.
*/ */
static bool getSupportOldStylePrivilegeDocuments(); static bool getSupportOldStylePrivilegeDocuments();
/** /**
* Sets whether or not access control enforcement is enabled for th * Takes a vector of privileges and fills the output param "resultA
is whole server. rray" with a BSON array
* representation of the privileges.
*/ */
static void setAuthEnabled(bool enabled); static Status getBSONForPrivileges(const PrivilegeVector& privilege
s,
mutablebson::Element resultArray
);
/** /**
* Returns true if access control is enabled on this server. * Takes a role name and a role graph and fills the output param "r
esult" with a BSON
* representation of the role object.
* This function does no locking - it is up to the caller to synchr
onize access to the
* role graph.
* Note: The passed in RoleGraph can't be marked const because some
of its accessors can
* actually modify it internally (to set up built-in roles).
*/ */
static bool isAuthEnabled(); static Status getBSONForRole(/*const*/ RoleGraph* graph,
const RoleName& roleName,
mutablebson::Element result);
AuthzManagerExternalState* getExternalState() const; /**
* Sets whether or not access control enforcement is enabled for th
is manager.
*/
void setAuthEnabled(bool enabled);
// Gets the privilege information document for "userName" on "dbnam /**
e". * Returns true if access control is enabled for this manager .
// */
// On success, returns Status::OK() and stores a shared-ownership c bool isAuthEnabled() const;
opy of the document into
// "result". /**
Status getPrivilegeDocument(const std::string& dbname, * Sets the version number of the authorization system. Returns an
const UserName& userName, invalid status if the
BSONObj* result) const; * version number is not recognized.
*/
// Returns true if there exists at least one privilege document in Status setAuthorizationVersion(int version);
the given database.
bool hasPrivilegeDocument(const std::string& dbname) const; /**
* Returns the version number of the authorization system.
*/
int getAuthorizationVersion();
// Returns true if there exists at least one privilege document in
the system.
bool hasAnyPrivilegeDocuments() const;
/**
* Creates the given user object in the given database.
* 'writeConcern' contains the arguments to be passed to getLastErr
or to block for
* successful completion of the write.
*/
Status insertPrivilegeDocument(const std::string& dbname,
const BSONObj& userObj,
const BSONObj& writeConcern) const;
/**
* Updates the given user object with the given update modifier.
* 'writeConcern' contains the arguments to be passed to getLastErr
or to block for
* successful completion of the write.
*/
Status updatePrivilegeDocument(const UserName& user,
const BSONObj& updateObj,
const BSONObj& writeConcern) const;
// Creates the given user object in the given database. /*
Status insertPrivilegeDocument(const std::string& dbname, const BSO * Removes users for the given database matching the given query.
NObj& userObj) const; * Writes into *numRemoved the number of user documents that were m
odified.
* 'writeConcern' contains the arguments to be passed to getLastErr
or to block for
* successful completion of the write.
*/
Status removePrivilegeDocuments(const BSONObj& query,
const BSONObj& writeConcern,
int* numRemoved) const;
// Updates the given user object with the given update modifier. /**
Status updatePrivilegeDocument(const UserName& user, const BSONObj& * Creates the given role object in the given database.
updateObj) const; * 'writeConcern' contains the arguments to be passed to getLastErr
or to block for
* successful completion of the write.
*/
Status insertRoleDocument(const BSONObj& roleObj, const BSONObj& wr
iteConcern) const;
// Removes users for the given database matching the given query. /**
Status removePrivilegeDocuments(const std::string& dbname, const BS * Updates the given role object with the given update modifier.
ONObj& query) const; * 'writeConcern' contains the arguments to be passed to getLastErr
or to block for
* successful completion of the write.
*/
Status updateRoleDocument(const RoleName& role,
const BSONObj& updateObj,
const BSONObj& writeConcern) const;
/**
* Updates documents matching "query" according to "updatePattern"
in "collectionName".
* Should only be called on collections with authorization document
s in them
* (ie admin.system.users and admin.system.roles).
*/
Status updateAuthzDocuments(const NamespaceString& collectionName,
const BSONObj& query,
const BSONObj& updatePattern,
bool upsert,
bool multi,
const BSONObj& writeConcern,
int* numUpdated) const;
/*
* Removes roles matching the given query.
* Writes into *numRemoved the number of role documents that were m
odified.
* 'writeConcern' contains the arguments to be passed to getLastErr
or to block for
* successful completion of the write.
*/
Status removeRoleDocuments(const BSONObj& query,
const BSONObj& writeConcern,
int* numRemoved) const;
/**
* Finds all documents matching "query" in "collectionName". For e
ach document returned,
* calls the function resultProcessor on it.
* Should only be called on collections with authorization document
s in them
* (ie admin.system.users and admin.system.roles).
*/
Status queryAuthzDocument(const NamespaceString& collectionName,
const BSONObj& query,
const BSONObj& projection,
const boost::function<void(const BSONObj&
)>& resultProcessor);
// Checks to see if "doc" is a valid privilege document, assuming i t is stored in the // Checks to see if "doc" is a valid privilege document, assuming i t is stored in the
// "system.users" collection of database "dbname". // "system.users" collection of database "dbname".
// //
// Returns Status::OK() if the document is good, or Status(ErrorCod es::BadValue), otherwise. // Returns Status::OK() if the document is good, or Status(ErrorCod es::BadValue), otherwise.
Status checkValidPrivilegeDocument(const StringData& dbname, const BSONObj& doc); Status checkValidPrivilegeDocument(const StringData& dbname, const BSONObj& doc);
// Given a database name and a readOnly flag return an ActionSet de scribing all the actions // Given a database name and a readOnly flag return an ActionSet de scribing all the actions
// that an old-style user with those attributes should be given. // that an old-style user with those attributes should be given.
ActionSet getActionsForOldStyleUser(const std::string& dbname, bool readOnly) const; ActionSet getActionsForOldStyleUser(const std::string& dbname, bool readOnly) const;
// Returns an ActionSet of all actions that can be be granted to us /**
ers. This does not * Writes into "result" a document describing the named user and re
// include internal-only actions. turns Status::OK(). The
ActionSet getAllUserActions() const; * description includes the user credentials and customData, if pre
sent, the user's role
* membership and delegation information, a full list of the user's
privileges, and a full
* list of the user's roles, including those roles held implicitly
through other roles
* (indirect roles). In the event that some of this information is
inconsistent, the
* document will contain a "warnings" array, with string messages d
escribing
* inconsistencies.
*
* If the user does not exist, returns ErrorCodes::UserNotFound.
*/
Status getUserDescription(const UserName& userName, BSONObj* result
);
/**
* Writes into "result" a document describing the named role and re
turns Status::OK(). The
* description includes the role's in which the named role has memb
ership, a full list of
* the role's privileges, and a full list of the roles of which the
named role is a member,
* including those roles memberships held implicitly through other
roles (indirect roles).
* In the event that some of this information is inconsistent, the
document will contain a
* "warnings" array, with string messages describing inconsistencie
s.
*
* If the role does not exist, returns ErrorCodes::RoleNotFound.
*/
Status getRoleDescription(const RoleName& roleName, BSONObj* result
);
/** /**
* Returns the User object for the given userName in the out param eter "acquiredUser". * Returns the User object for the given userName in the out param eter "acquiredUser".
* If the user cache already has a user object for this user, it i ncrements the refcount * If the user cache already has a user object for this user, it i ncrements the refcount
* on that object and gives out a pointer to it. If no user objec t for this user name * on that object and gives out a pointer to it. If no user objec t for this user name
* exists yet in the cache, reads the user's privilege document fr om disk, builds up * exists yet in the cache, reads the user's privilege document fr om disk, builds up
* a User object, sets the refcount to 1, and gives that out. The returned user may * a User object, sets the refcount to 1, and gives that out. The returned user may
* be invalid by the time the caller gets access to it. * be invalid by the time the caller gets access to it.
* The AuthorizationManager retains ownership of the returned User object. * The AuthorizationManager retains ownership of the returned User object.
* On non-OK Status return values, acquiredUser will not be modifi ed. * On non-OK Status return values, acquiredUser will not be modifi ed.
skipping to change at line 144 skipping to change at line 279
/** /**
* Decrements the refcount of the given User object. If the refcou nt has gone to zero, * Decrements the refcount of the given User object. If the refcou nt has gone to zero,
* deletes the User. Caller must stop using its pointer to "user" after calling this. * deletes the User. Caller must stop using its pointer to "user" after calling this.
*/ */
void releaseUser(User* user); void releaseUser(User* user);
/** /**
* Marks the given user as invalid and removes it from the user cac he. * Marks the given user as invalid and removes it from the user cac he.
*/ */
void invalidateUser(User* user); void invalidateUserByName(const UserName& user);
/**
* Invalidates all users who's source is "dbname" and removes them
from the user cache.
*/
void invalidateUsersFromDB(const std::string& dbname);
/** /**
* Inserts the given user directly into the _userCache. Used to ad d the internalSecurity * Inserts the given user directly into the _userCache. Used to ad d the internalSecurity
* user into the cache at process startup. * user into the cache at process startup.
*/ */
void addInternalUser(User* user); void addInternalUser(User* user);
/** /**
* Initializes the user cache with User objects for every v0 and v1 * Initializes the authorization manager. Depending on what versio
user document in the n the authorization
* system, by reading the system.users collection of every database * system is at, this may involve building up the user cache and/or
. If this function the roles graph.
* returns a non-ok Status, the _userCache should be considered cor * This function should be called once at startup and never again a
rupt and must be fter that.
* discarded. This function should be called once at startup (only */
if the system hasn't yet Status initialize();
* been upgraded to V2 user data format) and never again after that
. /**
* TODO(spencer): This function will temporarily be called every ti * Invalidates all of the contents of the user cache.
me user data is changed
* as part of the transition period to the new User data structures
. This should be changed
* once we have all the code necessary to upgrade to the V2 user da
ta format, as at that
* point we'll only be able to user V1 user data as read-only.
*/ */
Status initializeAllV1UserData(); void invalidateUserCache();
/** /**
* Parses privDoc and initializes the user object with the informat * Parses privDoc and fully initializes the user object (credential
ion extracted from the s, roles, and privileges)
* privilege document. * with the information extracted from the privilege document.
* This should never be called from outside the AuthorizationManage r - the only reason it's * This should never be called from outside the AuthorizationManage r - the only reason it's
* public instead of private is so it can be unit tested. * public instead of private is so it can be unit tested.
*/ */
Status _initializeUserFromPrivilegeDocument(User* user, Status _initializeUserFromPrivilegeDocument(User* user, const BSONO
const BSONObj& privDoc) bj& privDoc);
const;
/**
* Tries to acquire the global lock guarding modifications to all p
ersistent data related
* to authorization, namely the admin.system.users, admin.system.ro
les, and
* admin.system.version collections. This serializes all writers t
o the authorization
* documents, but does not impact readers.
*/
bool tryAcquireAuthzUpdateLock(const StringData& why);
/**
* Releases the lock guarding modifications to persistent authoriza
tion data, which must
* already be held.
*/
void releaseAuthzUpdateLock();
/**
* Upgrades authorization data stored in collections from the v1 fo
rm (one system.users
* collection per database) to the v2 form (a single admin.system.u
sers collection).
*
* Returns Status::OK() if the AuthorizationManager and the admin.s
ystem.version collection
* agree that the system is already upgraded, or if the upgrade com
pletes successfully.
*
* This method will create and destroy an admin._newusers collectio
n in addition to writing
* to admin.system.users and admin.system.version.
*
* User information is taken from the in-memory user cache, constru
cted at start-up. This
* is safe to do because MongoD and MongoS build complete copies of
the data stored in
* *.system.users at start-up if they detect that the upgrade has n
ot yet completed.
*/
Status upgradeAuthCollections();
/**
* Hook called by replication code to let the AuthorizationManager
observe changes
* to relevant collections.
*/
void logOp(const char* opstr,
const char* ns,
const BSONObj& obj,
BSONObj* patt,
bool* b,
bool fromMigrate,
const BSONObj* fullObj);
private: private:
/**
* Type used to guard accesses and updates to the user cache.
*/
class CacheGuard;
friend class AuthorizationManager::CacheGuard;
/**
* Returns the current version number of the authorization system.
Should only be called
* when holding _userCacheMutex.
*/
int _getVersion_inlock() const { return _version; }
/** /**
* Invalidates all User objects in the cache and removes them from the cache. * Invalidates all User objects in the cache and removes them from the cache.
* Should only be called when already holding _lock. * Should only be called when already holding _userCacheMutex.
* TODO(spencer): This only exists because we're currently calling
initializeAllV1UserData
* every time user data is changed. Once we only call that once at
startup, this function
* should be removed.
*/ */
void _invalidateUserCache_inlock(); void _invalidateUserCache_inlock();
/**
* Initializes the user cache with User objects for every v0 and v1
user document in the
* system, by reading the system.users collection of every database
. If this function
* returns a non-ok Status, the _userCache should be considered cor
rupt and must be
* discarded. This function should be called once at startup (only
if the system hasn't yet
* been upgraded to V2 user data format) and never again after that
.
*/
Status _initializeAllV1UserData();
static bool _doesSupportOldStylePrivileges; static bool _doesSupportOldStylePrivileges;
// True if access control enforcement is enabled on this node (ie i /**
t was started with * True if access control enforcement is enabled in this Authorizat
// --auth or --keyFile). ionManager.
// This is a config setting, set at startup and not changing after *
initialization. * Defaults to false. Changes to its value are not synchronized, s
static bool _authEnabled; o it should only be set
* at initalization-time.
// Integer that represents what format version the privilege docume */
nts in the system are. bool _authEnabled;
// The current version is 2. When upgrading to v2.6 or later from
v2.4 or prior, the /**
// version is 1. After running the upgrade process to upgrade to t * Integer that represents what format version the privilege docume
he new privilege document nts in the system are.
// format, the version will be 2. * The current version is 2. When upgrading to v2.6 or later from
v2.4 or prior, the
* version is 1. After running the upgrade process to upgrade to t
he new privilege document
* format, the version will be 2.
* All reads/writes to _version must be done within _userCacheMutex
.
*/
int _version; int _version;
scoped_ptr<AuthzManagerExternalState> _externalState; scoped_ptr<AuthzManagerExternalState> _externalState;
/** /**
* Caches User objects with information about user privileges, to a void the need to * Caches User objects with information about user privileges, to a void the need to
* go to disk to read user privilege documents whenever possible. Every User object * go to disk to read user privilege documents whenever possible. Every User object
* has a reference count - the AuthorizationManager must not delete a User object in the * has a reference count - the AuthorizationManager must not delete a User object in the
* cache unless its reference count is zero. * cache unless its reference count is zero.
*/ */
unordered_map<UserName, User*> _userCache; unordered_map<UserName, User*> _userCache;
/** /**
* Protects _userCache. * True if there is an update to the _userCache in progress, and th
at update is currently in
* the "fetch phase", during which it does not hold the _userCacheM
utex.
*
* Manipulated via CacheGuard.
*/
bool _isFetchPhaseBusy;
/**
* Protects _userCache, _version and _isFetchPhaseBusy. Manipulate
d via CacheGuard.
*/
boost::mutex _userCacheMutex;
/**
* Condition used to signal that it is OK for another CacheGuard to
enter a fetch phase.
* Manipulated via CacheGuard.
*/ */
boost::mutex _lock; boost::condition_variable _fetchPhaseIsReady;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 31 change blocks. 
84 lines changed or deleted 356 lines changed or added


 authorization_manager_global.h   authorization_manager_global.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/authorization_manager.h"
namespace mongo { namespace mongo {
// Gets the singleton AuthorizationManager object for this server proce ss. // Gets the singleton AuthorizationManager object for this server proce ss.
AuthorizationManager* getGlobalAuthorizationManager(); AuthorizationManager* getGlobalAuthorizationManager();
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 authorization_session.h   authorization_session.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/auth/action_set.h" #include "mongo/db/auth/action_set.h"
#include "mongo/db/auth/action_type.h" #include "mongo/db/auth/action_type.h"
#include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/authorization_manager.h"
#include "mongo/db/auth/authz_session_external_state.h" #include "mongo/db/auth/authz_session_external_state.h"
#include "mongo/db/auth/privilege.h" #include "mongo/db/auth/privilege.h"
#include "mongo/db/auth/user_name.h" #include "mongo/db/auth/user_name.h"
#include "mongo/db/auth/user_set.h" #include "mongo/db/auth/user_set.h"
#include "mongo/db/namespace_string.h"
namespace mongo { namespace mongo {
/** /**
* Contains all the authorization logic for a single client connection. It contains a set of * Contains all the authorization logic for a single client connection. It contains a set of
* the principals which have been authenticated, as well as a set of pr * the users which have been authenticated, as well as a set of privile
ivileges that have been ges that have been
* granted by those principals to perform various actions. * granted to those users to perform various actions.
* An AuthorizationSession object is present within every mongo::Client *
object, therefore there * An AuthorizationSession object is present within every mongo::Client
* is one per thread that corresponds to an incoming client connection. Basic object.
*
* Predicate methods for checking authorization may in the worst case a
cquire read locks
* on the admin database.
*/ */
class AuthorizationSession { class AuthorizationSession {
MONGO_DISALLOW_COPYING(AuthorizationSession); MONGO_DISALLOW_COPYING(AuthorizationSession);
public: public:
// Takes ownership of the externalState. // Takes ownership of the externalState.
explicit AuthorizationSession(AuthzSessionExternalState* externalSt ate); explicit AuthorizationSession(AuthzSessionExternalState* externalSt ate);
~AuthorizationSession(); ~AuthorizationSession();
AuthorizationManager& getAuthorizationManager(); AuthorizationManager& getAuthorizationManager();
skipping to change at line 68 skipping to change at line 84
* for it in the process. * for it in the process.
*/ */
Status addAndAuthorizeUser(const UserName& userName); Status addAndAuthorizeUser(const UserName& userName);
// Returns the authenticated user with the given name. Returns NUL L // Returns the authenticated user with the given name. Returns NUL L
// if no such user is found. // if no such user is found.
// The user remains in the _authenticatedUsers set for this Authori zationSession, // The user remains in the _authenticatedUsers set for this Authori zationSession,
// and ownership of the user stays with the AuthorizationManager // and ownership of the user stays with the AuthorizationManager
User* lookupUser(const UserName& name); User* lookupUser(const UserName& name);
// Returns the number of authenticated users in this session.
size_t getNumAuthenticatedUsers();
// Gets an iterator over the names of all authenticated users store d in this manager. // Gets an iterator over the names of all authenticated users store d in this manager.
UserSet::NameIterator getAuthenticatedUserNames(); UserSet::NameIterator getAuthenticatedUserNames();
// Returns a string representing all logged-in users on the current
session.
// WARNING: this string will contain NUL bytes so don't call c_str(
)!
std::string getAuthenticatedUserNamesToken();
// Removes any authenticated principals whose authorization credent ials came from the given // Removes any authenticated principals whose authorization credent ials came from the given
// database, and revokes any privileges that were granted via that principal. // database, and revokes any privileges that were granted via that principal.
void logoutDatabase(const std::string& dbname); void logoutDatabase(const std::string& dbname);
// Adds the internalSecurity user to the set of authenticated users . // Adds the internalSecurity user to the set of authenticated users .
// Used to grant internal threads full access. // Used to grant internal threads full access.
void grantInternalAuthorization(); void grantInternalAuthorization();
// Checks if this connection has been authenticated as an internal
user.
bool hasInternalAuthorization();
// Checks if this connection has the privileges required to perform
the given action
// on the given resource. Contains all the authorization logic inc
luding handling things
// like the localhost exception. Returns true if the action may pr
oceed on the resource.
// Note: this may acquire a database read lock (for automatic privi
lege acquisition).
bool checkAuthorization(const std::string& resource, ActionType act
ion);
// Same as above but takes an ActionSet instead of a single ActionT
ype. Returns true if
// all of the actions may proceed on the resource.
bool checkAuthorization(const std::string& resource, ActionSet acti
ons);
// Checks if this connection has the privileges necessary to perfor m the given query on the // Checks if this connection has the privileges necessary to perfor m the given query on the
// given namespace. // given namespace.
Status checkAuthForQuery(const std::string& ns, const BSONObj& quer y); Status checkAuthForQuery(const NamespaceString& ns, const BSONObj& query);
// Checks if this connection has the privileges necessary to perfor m a getMore on the given // Checks if this connection has the privileges necessary to perfor m a getMore on the given
// cursor in the given namespace. // cursor in the given namespace.
Status checkAuthForGetMore(const std::string& ns, long long cursorI D); Status checkAuthForGetMore(const NamespaceString& ns, long long cur sorID);
// Checks if this connection has the privileges necessary to perfor m the given update on the // Checks if this connection has the privileges necessary to perfor m the given update on the
// given namespace. // given namespace.
Status checkAuthForUpdate(const std::string& ns, Status checkAuthForUpdate(const NamespaceString& ns,
const BSONObj& query, const BSONObj& query,
const BSONObj& update, const BSONObj& update,
bool upsert); bool upsert);
// Checks if this connection has the privileges necessary to insert the given document // Checks if this connection has the privileges necessary to insert the given document
// to the given namespace. Correctly interprets inserts to system. indexes and performs // to the given namespace. Correctly interprets inserts to system. indexes and performs
// the proper auth checks for index building. // the proper auth checks for index building.
Status checkAuthForInsert(const std::string& ns, const BSONObj& doc ument); Status checkAuthForInsert(const NamespaceString& ns, const BSONObj& document);
// Checks if this connection has the privileges necessary to perfor m a delete on the given // Checks if this connection has the privileges necessary to perfor m a delete on the given
// namespace. // namespace.
Status checkAuthForDelete(const std::string& ns, const BSONObj& que Status checkAuthForDelete(const NamespaceString& ns, const BSONObj&
ry); query);
// Checks if this connection is authorized for the given Privilege.
Status checkAuthForPrivilege(const Privilege& privilege);
// Checks if this connection is authorized for all the given Privil // Checks if this connection has the privileges necessary to grant
eges. the given privilege
Status checkAuthForPrivileges(const vector<Privilege>& privileges); // to a role.
Status checkAuthorizedToGrantPrivilege(const Privilege& privilege);
// Checks if this connection has the privileges necessary to revoke
the given privilege
// from a role.
Status checkAuthorizedToRevokePrivilege(const Privilege& privilege)
;
// Utility function for isAuthorizedForActionsOnResource(
// ResourcePattern::forDatabaseName(role.getDB()), ActionTy
pe::grantAnyRole)
bool isAuthorizedToGrantRole(const RoleName& role);
// Utility function for isAuthorizedForActionsOnResource(
// ResourcePattern::forDatabaseName(role.getDB()), ActionTy
pe::grantAnyRole)
bool isAuthorizedToRevokeRole(const RoleName& role);
// Returns true if the current session is authenticated as the give
n user and that user
// is allowed to change his/her own password
bool isAuthorizedToChangeOwnPasswordAsUser(const UserName& userName
);
// Returns true if the current session is authenticated as the give
n user and that user
// is allowed to change his/her own customData.
bool isAuthorizedToChangeOwnCustomDataAsUser(const UserName& userNa
me);
// Returns true if any of the authenticated users on this session h
ave the given role.
// NOTE: this does not refresh any of the users even if they are ma
rked as invalid.
bool isAuthenticatedAsUserWithRole(const RoleName& roleName);
// Returns true if this session is authorized for the given Privile
ge.
//
// Contains all the authorization logic including handling things l
ike the localhost
// exception.
bool isAuthorizedForPrivilege(const Privilege& privilege);
// Like isAuthorizedForPrivilege, above, except returns true if the
session is authorized
// for all of the listed privileges.
bool isAuthorizedForPrivileges(const vector<Privilege>& privileges)
;
// Utility function for isAuthorizedForPrivilege(Privilege(resource
, action)).
bool isAuthorizedForActionsOnResource(const ResourcePattern& resour
ce, ActionType action);
// Utility function for isAuthorizedForPrivilege(Privilege(resource
, actions)).
bool isAuthorizedForActionsOnResource(const ResourcePattern& resour
ce,
const ActionSet& actions);
// Utility function for
// isAuthorizedForActionsOnResource(ResourcePattern::forExactNamesp
ace(ns), action).
bool isAuthorizedForActionsOnNamespace(const NamespaceString& ns, A
ctionType action);
// Utility function for
// isAuthorizedForActionsOnResource(ResourcePattern::forExactNamesp
ace(ns), actions).
bool isAuthorizedForActionsOnNamespace(const NamespaceString& ns, c
onst ActionSet& actions);
private: private:
// Checks if this connection is authorized for the given Privilege, ignoring whether or not // Checks if this connection is authorized for the given Privilege, ignoring whether or not
// we should even be doing authorization checks in general. // we should even be doing authorization checks in general. Note:
Status _checkAuthForPrivilegeHelper(const Privilege& privilege); this may acquire a read
// lock on the admin database (to update out-of-date user privilege
// Returns a new privilege that has replaced the actions needed to information).
handle special casing bool _isAuthorizedForPrivilege(const Privilege& privilege);
// certain namespaces like system.users and system.profile. Note t
hat the special handling
// of system.indexes takes place in checkAuthForInsert, not here.
Privilege _modifyPrivilegeForSpecialCases(const Privilege& privileg
e);
scoped_ptr<AuthzSessionExternalState> _externalState; scoped_ptr<AuthzSessionExternalState> _externalState;
// All Users who have been authenticated on this connection // All Users who have been authenticated on this connection
UserSet _authenticatedUsers; UserSet _authenticatedUsers;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 13 change blocks. 
49 lines changed or deleted 126 lines changed or added


 authz_manager_external_state.h   authz_manager_external_state.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/function.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/auth/role_name.h"
#include "mongo/db/auth/user_name.h" #include "mongo/db/auth/user_name.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/namespace_string.h"
namespace mongo { namespace mongo {
/** /**
* Public interface for a class that encapsulates all the information r elated to system * Public interface for a class that encapsulates all the information r elated to system
* state not stored in AuthorizationManager. This is primarily to make AuthorizationManager * state not stored in AuthorizationManager. This is primarily to make AuthorizationManager
* easier to test as well as to allow different implementations for mon gos and mongod. * easier to test as well as to allow different implementations for mon gos and mongod.
*/ */
class AuthzManagerExternalState { class AuthzManagerExternalState {
MONGO_DISALLOW_COPYING(AuthzManagerExternalState); MONGO_DISALLOW_COPYING(AuthzManagerExternalState);
public: public:
virtual ~AuthzManagerExternalState(); virtual ~AuthzManagerExternalState();
// Gets the privilege information document for "userName" on "dbnam /**
e". * Initializes the external state object. Must be called after con
// struction and before
// On success, returns Status::OK() and stores a shared-ownership c * calling other methods. Object may not be used after this method
opy of the document into returns something other
// "result". * than Status::OK().
Status getPrivilegeDocument(const std::string& dbname, */
const UserName& userName, virtual Status initialize() = 0;
BSONObj* result) const;
/**
* Writes into "result" a document describing the named user and re
turns Status::OK(). The
* description includes the user credentials, if present, the user'
s role membership and
* delegation information, a full list of the user's privileges, an
d a full list of the
* user's roles, including those roles held implicitly through othe
r roles (indirect roles).
* In the event that some of this information is inconsistent, the
document will contain a
* "warnings" array, with string messages describing inconsistencie
s.
*
* If the user does not exist, returns ErrorCodes::UserNotFound.
*/
virtual Status getUserDescription(const UserName& userName, BSONObj
* result) = 0;
/**
* Writes into "result" a document describing the named role and re
turns Status::OK(). The
* description includes the role's in which the named role has memb
ership, a full list of
* the role's privileges, and a full list of the roles of which the
named role is a member,
* including those roles memberships held implicitly through other
roles (indirect roles).
* In the event that some of this information is inconsistent, the
document will contain a
* "warnings" array, with string messages describing inconsistencie
s.
*
* If the role does not exist, returns ErrorCodes::RoleNotFound.
*/
virtual Status getRoleDescription(const RoleName& roleName, BSONObj
* result) = 0;
/**
* Gets the privilege information document for "userName". authzVe
rsion indicates what
* version of the privilege document format is being used, which is
needed to know how to
* query for the user's privilege document.
*
*
* On success, returns Status::OK() and stores a shared-ownership c
opy of the document into
* "result".
*/
Status getPrivilegeDocument(const UserName& userName,
int authzVersion,
BSONObj* result);
// Returns true if there exists at least one privilege document in /**
the given database. * Returns true if there exists at least one privilege document in
bool hasPrivilegeDocument(const std::string& dbname) const; the system.
*/
bool hasAnyPrivilegeDocuments();
// Creates the given user object in the given database. /**
* Creates the given user object in the given database.
*
* TODO(spencer): remove dbname argument once users are only writte
n into the admin db
*/
virtual Status insertPrivilegeDocument(const std::string& dbname, virtual Status insertPrivilegeDocument(const std::string& dbname,
const BSONObj& userObj) cons const BSONObj& userObj,
t = 0; const BSONObj& writeConcern)
;
// Updates the given user object with the given update modifier. /**
* Updates the given user object with the given update modifier.
*/
virtual Status updatePrivilegeDocument(const UserName& user, virtual Status updatePrivilegeDocument(const UserName& user,
const BSONObj& updateObj) co const BSONObj& updateObj,
nst = 0; const BSONObj& writeConcern)
;
// Removes users for the given database matching the given query. /**
virtual Status removePrivilegeDocuments(const std::string& dbname, * Removes users for the given database matching the given query.
const BSONObj& query) const * Writes into *numRemoved the number of user documents that were m
= 0; odified.
*/
virtual Status removePrivilegeDocuments(const BSONObj& query,
const BSONObj& writeConcern
,
int* numRemoved);
/** /**
* Puts into the *dbnames vector the name of every database in the cluster. * Puts into the *dbnames vector the name of every database in the cluster.
* May take a global lock, so should only be called during startup.
*/ */
virtual Status getAllDatabaseNames(std::vector<std::string>* dbname s) const = 0; virtual Status getAllDatabaseNames(std::vector<std::string>* dbname s) = 0;
/** /**
* Puts into the *privDocs vector every privilege document from the given database's * Puts into the *privDocs vector every privilege document from the given database's
* system.users collection. * system.users collection.
*/ */
virtual Status getAllV1PrivilegeDocsForDB(const std::string& dbname , virtual Status getAllV1PrivilegeDocsForDB(const std::string& dbname ,
std::vector<BSONObj>* pri std::vector<BSONObj>* pri
vDocs) const = 0; vDocs) = 0;
/**
* Finds a document matching "query" in "collectionName", and store
a shared-ownership
* copy into "result".
*
* Returns Status::OK() on success. If no match is found, returns
* ErrorCodes::NoMatchingDocument. Other errors returned as approp
riate.
*/
virtual Status findOne(const NamespaceString& collectionName,
const BSONObj& query,
BSONObj* result) = 0;
/**
* Finds all documents matching "query" in "collectionName". For e
ach document returned,
* calls the function resultProcessor on it.
*/
virtual Status query(const NamespaceString& collectionName,
const BSONObj& query,
const BSONObj& projection,
const boost::function<void(const BSONObj&)>& r
esultProcessor) = 0;
/**
* Inserts "document" into "collectionName".
* If there is a duplicate key error, returns a Status with code Du
plicateKey.
*/
virtual Status insert(const NamespaceString& collectionName,
const BSONObj& document,
const BSONObj& writeConcern) = 0;
/**
* Update one document matching "query" according to "updatePattern
" in "collectionName".
*
* If "upsert" is true and no document matches "query", inserts one
using "query" as a
* template.
* If "upsert" is false and no document matches "query", return a S
tatus with the code
* NoMatchingDocument. The Status message in that case is not very
descriptive and should
* not be displayed to the end user.
*/
virtual Status updateOne(const NamespaceString& collectionName,
const BSONObj& query,
const BSONObj& updatePattern,
bool upsert,
const BSONObj& writeConcern);
/**
* Updates documents matching "query" according to "updatePattern"
in "collectionName".
*/
virtual Status update(const NamespaceString& collectionName,
const BSONObj& query,
const BSONObj& updatePattern,
bool upsert,
bool multi,
const BSONObj& writeConcern,
int* numUpdated) = 0;
/**
* Removes all documents matching "query" from "collectionName".
*/
virtual Status remove(const NamespaceString& collectionName,
const BSONObj& query,
const BSONObj& writeConcern,
int* numRemoved) = 0;
/**
* Creates an index with the given pattern on "collectionName".
*/
virtual Status createIndex(const NamespaceString& collectionName,
const BSONObj& pattern,
bool unique,
const BSONObj& writeConcern) = 0;
/**
* Drops the named collection.
*/
virtual Status dropCollection(const NamespaceString& collectionName
,
const BSONObj& writeConcern) = 0;
/**
* Renames collection "oldName" to "newName", possibly dropping the
previous
* collection named "newName".
*/
virtual Status renameCollection(const NamespaceString& oldName,
const NamespaceString& newName,
const BSONObj& writeConcern) = 0;
/**
* Copies the contents of collection "fromName" into "toName". Fai
ls
* if "toName" is already a collection.
*/
virtual Status copyCollection(const NamespaceString& fromName,
const NamespaceString& toName,
const BSONObj& writeConcern) = 0;
/**
* Tries to acquire the global lock guarding modifications to all p
ersistent data related
* to authorization, namely the admin.system.users, admin.system.ro
les, and
* admin.system.version collections. This serializes all writers t
o the authorization
* documents, but does not impact readers.
*/
virtual bool tryAcquireAuthzUpdateLock(const StringData& why) = 0;
/**
* Releases the lock guarding modifications to persistent authoriza
tion data, which must
* already be held.
*/
virtual void releaseAuthzUpdateLock() = 0;
virtual void logOp(
const char* op,
const char* ns,
const BSONObj& o,
BSONObj* o2,
bool* b,
bool fromMigrateUnused,
const BSONObj* fullObjUnused) {}
protected: protected:
AuthzManagerExternalState(); // This class should never be instanti ated directly. AuthzManagerExternalState(); // This class should never be instanti ated directly.
// Queries the userNamespace with the given query and returns the p /**
rivilegeDocument found * Queries the userNamespace with the given query and returns the p
// in *result. Returns Status::OK if it finds a document matching rivilegeDocument found
the query. If it doesn't * in *result. Returns Status::OK if it finds a document matching
// find a document matching the query, returns a Status with code U the query. If it doesn't
serNotFound. Other * find a document matching the query, returns a Status with code U
// errors may return other Status codes. serNotFound. Other
* errors may return other Status codes.
*/
virtual Status _findUser(const std::string& usersNamespace, virtual Status _findUser(const std::string& usersNamespace,
const BSONObj& query, const BSONObj& query,
BSONObj* result) const = 0; BSONObj* result) = 0;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 16 change blocks. 
34 lines changed or deleted 260 lines changed or added


 authz_manager_external_state_d.h   authz_manager_external_state_d.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/function.hpp>
#include <boost/thread/mutex.hpp>
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/auth/authz_manager_external_state.h" #include "mongo/db/auth/authz_manager_external_state.h"
#include "mongo/db/auth/role_graph.h"
#include "mongo/db/auth/user_name.h" #include "mongo/db/auth/user_name.h"
namespace mongo { namespace mongo {
/** /**
* The implementation of AuthzManagerExternalState functionality for mo ngod. * The implementation of AuthzManagerExternalState functionality for mo ngod.
*/ */
class AuthzManagerExternalStateMongod : public AuthzManagerExternalStat e { class AuthzManagerExternalStateMongod : public AuthzManagerExternalStat e {
MONGO_DISALLOW_COPYING(AuthzManagerExternalStateMongod); MONGO_DISALLOW_COPYING(AuthzManagerExternalStateMongod);
public: public:
AuthzManagerExternalStateMongod(); AuthzManagerExternalStateMongod();
virtual ~AuthzManagerExternalStateMongod(); virtual ~AuthzManagerExternalStateMongod();
virtual Status insertPrivilegeDocument(const std::string& dbname, virtual Status initialize();
const BSONObj& userObj) cons
t;
virtual Status updatePrivilegeDocument(const UserName& user,
const BSONObj& updateObj) co
nst;
virtual Status removePrivilegeDocuments(const std::string& dbname, virtual Status getUserDescription(const UserName& userName, BSONObj
const BSONObj& query) const * result);
; virtual Status getRoleDescription(const RoleName& roleName, BSONObj
* result);
virtual Status getAllDatabaseNames(std::vector<std::string>* dbname s) const; virtual Status getAllDatabaseNames(std::vector<std::string>* dbname s);
virtual Status getAllV1PrivilegeDocsForDB(const std::string& dbname , virtual Status getAllV1PrivilegeDocsForDB(const std::string& dbname ,
std::vector<BSONObj>* pri std::vector<BSONObj>* pri
vDocs) const; vDocs);
virtual Status findOne(const NamespaceString& collectionName,
const BSONObj& query,
BSONObj* result);
virtual Status query(const NamespaceString& collectionName,
const BSONObj& query,
const BSONObj& projection,
const boost::function<void(const BSONObj&)>& r
esultProcessor);
virtual Status insert(const NamespaceString& collectionName,
const BSONObj& document,
const BSONObj& writeConcern);
virtual Status update(const NamespaceString& collectionName,
const BSONObj& query,
const BSONObj& updatePattern,
bool upsert,
bool multi,
const BSONObj& writeConcern,
int* numUpdated);
virtual Status remove(const NamespaceString& collectionName,
const BSONObj& query,
const BSONObj& writeConcern,
int* numRemoved);
virtual Status createIndex(const NamespaceString& collectionName,
const BSONObj& pattern,
bool unique,
const BSONObj& writeConcern);
virtual Status dropCollection(const NamespaceString& collectionName
,
const BSONObj& writeConcern);
virtual Status renameCollection(const NamespaceString& oldName,
const NamespaceString& newName,
const BSONObj& writeConcern);
virtual Status copyCollection(const NamespaceString& fromName,
const NamespaceString& toName,
const BSONObj& writeConcern);
virtual bool tryAcquireAuthzUpdateLock(const StringData& why);
virtual void releaseAuthzUpdateLock();
virtual void logOp(
const char* op,
const char* ns,
const BSONObj& o,
BSONObj* o2,
bool* b,
bool fromMigrateUnused,
const BSONObj* fullObjUnused);
protected: protected:
virtual Status _findUser(const string& usersNamespace, virtual Status _findUser(const string& usersNamespace,
const BSONObj& query, const BSONObj& query,
BSONObj* result) const; BSONObj* result);
private:
enum RoleGraphState {
roleGraphStateInitial = 0,
roleGraphStateConsistent,
roleGraphStateHasCycle
};
/**
* Initializes the role graph from the contents of the admin.system
.roles collection.
*/
Status _initializeRoleGraph();
/**
* Eventually consistent, in-memory representation of all roles in
the system (both
* user-defined and built-in). Synchronized via _roleGraphMutex.
*/
RoleGraph _roleGraph;
/**
* State of _roleGraph, one of "initial", "consistent" and "has cyc
le". Synchronized via
* _roleGraphMutex.
*/
RoleGraphState _roleGraphState;
/**
* Guards _roleGraphState and _roleGraph.
*/
boost::mutex _roleGraphMutex;
boost::mutex _authzDataUpdateLock;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 8 change blocks. 
14 lines changed or deleted 114 lines changed or added


 authz_manager_external_state_mock.h   authz_manager_external_state_mock.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/function.hpp>
#include <string> #include <string>
#include <map>
#include <vector> #include <vector>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/auth/authz_manager_external_state.h" #include "mongo/db/auth/authz_manager_external_state.h"
#include "mongo/db/auth/role_graph.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/platform/unordered_map.h" #include "mongo/db/namespace_string.h"
namespace mongo { namespace mongo {
/** /**
* Mock of the AuthzManagerExternalState class used only for testing. * Mock of the AuthzManagerExternalState class used only for testing.
*/ */
class AuthzManagerExternalStateMock : public AuthzManagerExternalState { class AuthzManagerExternalStateMock : public AuthzManagerExternalState {
MONGO_DISALLOW_COPYING(AuthzManagerExternalStateMock); MONGO_DISALLOW_COPYING(AuthzManagerExternalStateMock);
public: public:
AuthzManagerExternalStateMock() {}; AuthzManagerExternalStateMock() {};
// no-op for the mock virtual Status initialize();
virtual Status getUserDescription(const UserName& userName, BSONObj
* result);
virtual Status getRoleDescription(const RoleName& roleName, BSONObj
* result);
virtual Status insertPrivilegeDocument(const std::string& dbname, virtual Status insertPrivilegeDocument(const std::string& dbname,
const BSONObj& userObj) cons const BSONObj& userObj,
t; const BSONObj& writeConcern)
;
// no-op for the mock
virtual Status updatePrivilegeDocument(const UserName& user, virtual Status updatePrivilegeDocument(const UserName& user,
const BSONObj& updateObj) co const BSONObj& updateObj,
nst; const BSONObj& writeConcern)
;
// no-op for the mock // no-op for the mock
virtual Status removePrivilegeDocuments(const std::string& dbname, virtual Status removePrivilegeDocuments(const BSONObj& query,
const BSONObj& query) const const BSONObj& writeConcern
; ,
int* numRemoved);
// Non-const version that puts document into a vector that can be a
ccessed later
Status insertPrivilegeDocument(const std::string& dbname, const BSO
NObj& userObj);
void clearPrivilegeDocuments(); void clearPrivilegeDocuments();
virtual Status getAllDatabaseNames(std::vector<std::string>* dbname s) const; virtual Status getAllDatabaseNames(std::vector<std::string>* dbname s);
virtual Status getAllV1PrivilegeDocsForDB(const std::string& dbname , virtual Status getAllV1PrivilegeDocsForDB(const std::string& dbname ,
std::vector<BSONObj>* pri vDocs) const; std::vector<BSONObj>* pri vDocs);
virtual Status _findUser(const std::string& usersNamespace, virtual Status _findUser(const std::string& usersNamespace,
const BSONObj& query, const BSONObj& query,
BSONObj* result) const; BSONObj* result);
virtual Status findOne(const NamespaceString& collectionName,
const BSONObj& query,
BSONObj* result);
virtual Status query(const NamespaceString& collectionName,
const BSONObj& query,
const BSONObj& projection, // Currently unused
in mock
const boost::function<void(const BSONObj&)>& r
esultProcessor);
// This implementation does not understand uniqueness constraints.
virtual Status insert(const NamespaceString& collectionName,
const BSONObj& document,
const BSONObj& writeConcern);
// This implementation does not understand uniqueness constraints,
ignores writeConcern,
// and only correctly handles some upsert behaviors.
virtual Status updateOne(const NamespaceString& collectionName,
const BSONObj& query,
const BSONObj& updatePattern,
bool upsert,
const BSONObj& writeConcern);
virtual Status update(const NamespaceString& collectionName,
const BSONObj& query,
const BSONObj& updatePattern,
bool upsert,
bool multi,
const BSONObj& writeConcern,
int* numUpdated);
virtual Status remove(const NamespaceString& collectionName,
const BSONObj& query,
const BSONObj& writeConcern,
int* numRemoved);
virtual Status createIndex(const NamespaceString& collectionName,
const BSONObj& pattern,
bool unique,
const BSONObj& writeConcern);
virtual Status dropCollection(const NamespaceString& collectionName
,
const BSONObj& writeConcern);
virtual Status renameCollection(const NamespaceString& oldName,
const NamespaceString& newName,
const BSONObj& writeConcern);
virtual Status copyCollection(const NamespaceString& fromName,
const NamespaceString& toName,
const BSONObj& writeConcern);
virtual bool tryAcquireAuthzUpdateLock(const StringData& why);
virtual void releaseAuthzUpdateLock();
std::vector<BSONObj> getCollectionContents(const NamespaceString& c
ollectionName);
private: private:
unordered_map<std::string, std::vector<BSONObj> > _userDocuments; / typedef std::vector<BSONObj> BSONObjCollection;
/ dbname to user docs typedef std::map<NamespaceString, BSONObjCollection> NamespaceDocum
entMap;
Status _findOneIter(const NamespaceString& collectionName,
const BSONObj& query,
BSONObjCollection::iterator* result);
Status _queryVector(const NamespaceString& collectionName,
const BSONObj& query,
std::vector<BSONObjCollection::iterator>* resul
t);
NamespaceDocumentMap _documents; // Mock database.
RoleGraph _roleGraph;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 14 change blocks. 
20 lines changed or deleted 112 lines changed or added


 authz_manager_external_state_s.h   authz_manager_external_state_s.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/function.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/scoped_ptr.hpp>
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/client/distlock.h"
#include "mongo/db/auth/authz_manager_external_state.h" #include "mongo/db/auth/authz_manager_external_state.h"
#include "mongo/db/auth/user_name.h" #include "mongo/db/auth/user_name.h"
namespace mongo { namespace mongo {
/** /**
* The implementation of AuthzManagerExternalState functionality for mo ngos. * The implementation of AuthzManagerExternalState functionality for mo ngos.
*/ */
class AuthzManagerExternalStateMongos : public AuthzManagerExternalStat e{ class AuthzManagerExternalStateMongos : public AuthzManagerExternalStat e{
MONGO_DISALLOW_COPYING(AuthzManagerExternalStateMongos); MONGO_DISALLOW_COPYING(AuthzManagerExternalStateMongos);
public: public:
AuthzManagerExternalStateMongos(); AuthzManagerExternalStateMongos();
virtual ~AuthzManagerExternalStateMongos(); virtual ~AuthzManagerExternalStateMongos();
virtual Status insertPrivilegeDocument(const std::string& dbname, virtual Status initialize();
const BSONObj& userObj) cons
t;
virtual Status updatePrivilegeDocument(const UserName& user,
const BSONObj& updateObj) co
nst;
virtual Status removePrivilegeDocuments(const std::string& dbname, virtual Status getUserDescription(const UserName& userName, BSONObj
const BSONObj& query) const * result);
; virtual Status getRoleDescription(const RoleName& roleName, BSONObj
* result);
virtual Status getAllDatabaseNames(std::vector<std::string>* dbname s) const; virtual Status getAllDatabaseNames(std::vector<std::string>* dbname s);
virtual Status getAllV1PrivilegeDocsForDB(const std::string& dbname , virtual Status getAllV1PrivilegeDocsForDB(const std::string& dbname ,
std::vector<BSONObj>* pri std::vector<BSONObj>* pri
vDocs) const; vDocs);
virtual Status findOne(const NamespaceString& collectionName,
const BSONObj& query,
BSONObj* result);
virtual Status query(const NamespaceString& collectionName,
const BSONObj& query,
const BSONObj& projection,
const boost::function<void(const BSONObj&)>& r
esultProcessor);
virtual Status insert(const NamespaceString& collectionName,
const BSONObj& document,
const BSONObj& writeConcern);
virtual Status update(const NamespaceString& collectionName,
const BSONObj& query,
const BSONObj& updatePattern,
bool upsert,
bool multi,
const BSONObj& writeConcern,
int* numUpdated);
virtual Status remove(const NamespaceString& collectionName,
const BSONObj& query,
const BSONObj& writeConcern,
int* numRemoved);
virtual Status createIndex(const NamespaceString& collectionName,
const BSONObj& pattern,
bool unique,
const BSONObj& writeConcern);
virtual Status dropCollection(const NamespaceString& collectionName
,
const BSONObj& writeConcern);
virtual Status renameCollection(const NamespaceString& oldName,
const NamespaceString& newName,
const BSONObj& writeConcern);
virtual Status copyCollection(const NamespaceString& fromName,
const NamespaceString& toName,
const BSONObj& writeConcern);
virtual bool tryAcquireAuthzUpdateLock(const StringData& why);
virtual void releaseAuthzUpdateLock();
protected: protected:
virtual Status _findUser(const string& usersNamespace, virtual Status _findUser(const string& usersNamespace,
const BSONObj& query, const BSONObj& query,
BSONObj* result) const; BSONObj* result);
private:
boost::mutex _distLockGuard; // Guards access to _authzDataUpdateLo
ck
scoped_ptr<ScopedDistributedLock> _authzDataUpdateLock;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 8 change blocks. 
14 lines changed or deleted 76 lines changed or added


 authz_session_external_state.h   authz_session_external_state.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/client/dbclientinterface.h" #include "mongo/client/dbclientinterface.h"
#include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/authorization_manager.h"
skipping to change at line 57 skipping to change at line 69
// are that auth isn't enabled, the connection is from localhost an d there are no admin // are that auth isn't enabled, the connection is from localhost an d there are no admin
// users, or the connection is a "god" connection. // users, or the connection is a "god" connection.
// NOTE: _checkShouldAllowLocalhost MUST be called at least once be fore any call to // NOTE: _checkShouldAllowLocalhost MUST be called at least once be fore any call to
// shouldIgnoreAuthChecks or we could ignore auth checks incorrectl y. // shouldIgnoreAuthChecks or we could ignore auth checks incorrectl y.
virtual bool shouldIgnoreAuthChecks() const = 0; virtual bool shouldIgnoreAuthChecks() const = 0;
// Should be called at the beginning of every new request. This pe rforms the checks // Should be called at the beginning of every new request. This pe rforms the checks
// necessary to determine if localhost connections should be given full access. // necessary to determine if localhost connections should be given full access.
virtual void startRequest() = 0; virtual void startRequest() = 0;
// Authorization event hooks
// Handle any global state which needs to be updated when a new use
r has been authorized
virtual void onAddAuthorizedUser() = 0;
// Handle any global state which needs to be updated when a user lo
gs out
virtual void onLogoutDatabase(const std::string& dbname) = 0;
protected: protected:
// This class should never be instantiated directly. // This class should never be instantiated directly.
AuthzSessionExternalState(AuthorizationManager* authzManager); AuthzSessionExternalState(AuthorizationManager* authzManager);
AuthorizationManager* _authzManager; AuthorizationManager* _authzManager;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 2 change blocks. 
10 lines changed or deleted 20 lines changed or added


 authz_session_external_state_d.h   authz_session_external_state_d.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/authorization_manager.h"
#include "mongo/db/auth/authz_session_external_state_server_common.h" #include "mongo/db/auth/authz_session_external_state_server_common.h"
namespace mongo { namespace mongo {
skipping to change at line 39 skipping to change at line 51
class AuthzSessionExternalStateMongod : public AuthzSessionExternalStat eServerCommon { class AuthzSessionExternalStateMongod : public AuthzSessionExternalStat eServerCommon {
MONGO_DISALLOW_COPYING(AuthzSessionExternalStateMongod); MONGO_DISALLOW_COPYING(AuthzSessionExternalStateMongod);
public: public:
AuthzSessionExternalStateMongod(AuthorizationManager* authzManager) ; AuthzSessionExternalStateMongod(AuthorizationManager* authzManager) ;
virtual ~AuthzSessionExternalStateMongod(); virtual ~AuthzSessionExternalStateMongod();
virtual bool shouldIgnoreAuthChecks() const; virtual bool shouldIgnoreAuthChecks() const;
virtual void startRequest(); virtual void startRequest();
virtual void onAddAuthorizedUser();
virtual void onLogoutDatabase(const std::string&);
}; };
} // namespace mongo } // namespace mongo
 End of changes. 2 change blocks. 
5 lines changed or deleted 20 lines changed or added


 authz_session_external_state_mock.h   authz_session_external_state_mock.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/authorization_manager.h"
#include "mongo/db/auth/authz_session_external_state.h" #include "mongo/db/auth/authz_session_external_state.h"
namespace mongo { namespace mongo {
skipping to change at line 52 skipping to change at line 64
} }
virtual Status _findUser(const std::string& usersNamespace, virtual Status _findUser(const std::string& usersNamespace,
const BSONObj& query, const BSONObj& query,
BSONObj* result) const { BSONObj* result) const {
return Status(ErrorCodes::UserNotFound, "User not found"); return Status(ErrorCodes::UserNotFound, "User not found");
} }
virtual void startRequest() {} virtual void startRequest() {}
virtual void onAddAuthorizedUser() {}
virtual void onLogoutDatabase(const std::string& dbname) {}
private: private:
bool _returnValue; bool _returnValue;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 2 change blocks. 
4 lines changed or deleted 20 lines changed or added


 authz_session_external_state_s.h   authz_session_external_state_s.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/authorization_manager.h"
#include "mongo/db/auth/authz_session_external_state_server_common.h" #include "mongo/db/auth/authz_session_external_state_server_common.h"
namespace mongo { namespace mongo {
skipping to change at line 37 skipping to change at line 49
* The implementation of AuthzSessionExternalState functionality for mo ngos. * The implementation of AuthzSessionExternalState functionality for mo ngos.
*/ */
class AuthzSessionExternalStateMongos : public AuthzSessionExternalStat eServerCommon { class AuthzSessionExternalStateMongos : public AuthzSessionExternalStat eServerCommon {
MONGO_DISALLOW_COPYING(AuthzSessionExternalStateMongos); MONGO_DISALLOW_COPYING(AuthzSessionExternalStateMongos);
public: public:
AuthzSessionExternalStateMongos(AuthorizationManager* authzManager) ; AuthzSessionExternalStateMongos(AuthorizationManager* authzManager) ;
virtual ~AuthzSessionExternalStateMongos(); virtual ~AuthzSessionExternalStateMongos();
virtual void startRequest(); virtual void startRequest();
virtual void onAddAuthorizedUser();
virtual void onLogoutDatabase(const std::string&);
}; };
} // namespace mongo } // namespace mongo
 End of changes. 2 change blocks. 
5 lines changed or deleted 20 lines changed or added


 authz_session_external_state_server_common.h   authz_session_external_state_server_common.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/authorization_manager.h"
#include "mongo/db/auth/authz_session_external_state.h" #include "mongo/db/auth/authz_session_external_state.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 background.h   background.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
/* background.h /* background.h
Concurrency coordination for administrative operations. Concurrency coordination for administrative operations.
*/ */
#pragma once #pragma once
#include <map> #include <map>
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 balance.h   balance.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/client/dbclientinterface.h" #include "mongo/client/dbclientinterface.h"
#include "mongo/s/balancer_policy.h" #include "mongo/s/balancer_policy.h"
#include "mongo/util/background.h" #include "mongo/util/background.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 balancer_policy.h   balancer_policy.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#ifndef S_BALANCER_POLICY_HEADER #ifndef S_BALANCER_POLICY_HEADER
#define S_BALANCER_POLICY_HEADER #define S_BALANCER_POLICY_HEADER
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/s/type_chunk.h" #include "mongo/s/type_chunk.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 batch_executor.h   batch_executor.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/db/commands/write_commands/batch.h" #include "mongo/s/batched_command_request.h"
#include "mongo/s/batched_command_response.h"
#include "mongo/s/batched_delete_document.h"
#include "mongo/s/batched_update_document.h"
namespace mongo { namespace mongo {
class BSONObjBuilder; class BSONObjBuilder;
class Client; class Client;
class CurOp; class CurOp;
class OpCounters; class OpCounters;
class OpDebug; class OpDebug;
struct LastError; struct LastError;
/** /**
* An instance of WriteBatchExecutor is an object capable of issuing a write batch. * An instance of WriteBatchExecutor is an object capable of issuing a write batch.
*/ */
class WriteBatchExecutor { class WriteBatchExecutor {
MONGO_DISALLOW_COPYING(WriteBatchExecutor); MONGO_DISALLOW_COPYING(WriteBatchExecutor);
public: public:
WriteBatchExecutor(Client* client, OpCounters* opCounters, LastErro r* le); WriteBatchExecutor( Client* client, OpCounters* opCounters, LastErr or* le );
/** /**
* Issues writes with requested write concern. * Issues writes with requested write concern. Fills response with
* Returns true (and fills "result") if request properly formatted. errors if problems
* Returns false (and fills "errMsg") if not. * occur.
*/ */
bool executeBatch(const WriteBatch& writeBatch, string* errMsg, BSO NObjBuilder* result); void executeBatch( const BatchedCommandRequest& request, BatchedCom mandResponse* response );
private: private:
/**
* Issues writes in batch. Fills "resultsArray" with write results // TODO: This will change in the near future, but keep like this fo
. r now
* Returns true iff all items in batch were issued successfully. struct WriteStats {
*/
bool applyWriteBatch(const WriteBatch& writeBatch, BSONArrayBuilder WriteStats() :
* resultsArray); numInserted( 0 ), numUpdated( 0 ), numUpserted( 0 ), nu
mDeleted( 0 ) {
}
int numInserted;
int numUpdated;
int numUpserted;
int numDeleted;
};
/** /**
* Issues a single write. Fills "results" with write result. * Issues a single write. Fills "results" with write result.
* Returns true iff write item was issued sucessfully. * Returns true iff write item was issued sucessfully and increment
s stats, populates error
* if not successful.
*/ */
bool applyWriteItem(const string& ns, bool applyWriteItem( const BatchItemRef& itemRef,
const WriteBatch::WriteItem& writeItem, WriteStats* stats,
BSONObjBuilder* results); BatchedErrorDetail* error );
// //
// Helpers to issue underlying write. // Helpers to issue underlying write.
// Returns true iff write item was issued sucessfully. // Returns true iff write item was issued sucessfully and increment
s stats, populates error
// if not successful.
// //
bool applyInsert(const string& ns, bool doWrite( const string& ns,
const WriteBatch::WriteItem& writeItem, const BatchItemRef& itemRef,
CurOp* currentOp); CurOp* currentOp,
WriteStats* stats,
bool applyUpdate(const string& ns, BatchedErrorDetail* error );
const WriteBatch::WriteItem& writeItem,
CurOp* currentOp); bool doInsert( const std::string& ns,
const BSONObj& insertOp,
bool applyDelete(const string& ns, CurOp* currentOp,
const WriteBatch::WriteItem& writeItem, WriteStats* stats,
CurOp* currentOp); BatchedErrorDetail* error );
bool doUpdate( const std::string& ns,
const BatchedUpdateDocument& updateOp,
CurOp* currentOp,
WriteStats* stats,
BatchedErrorDetail* error );
bool doDelete( const std::string& ns,
const BatchedDeleteDocument& deleteOp,
CurOp* currentOp,
WriteStats* stats,
BatchedErrorDetail* error );
// Client object to issue writes on behalf of. // Client object to issue writes on behalf of.
// Not owned here. // Not owned here.
Client* _client; Client* _client;
// OpCounters object to update. // OpCounters object to update.
// Not owned here. // Not owned here.
OpCounters* _opCounters; OpCounters* _opCounters;
// LastError object to use for preparing write results. // LastError object to use for preparing write results.
 End of changes. 10 change blocks. 
29 lines changed or deleted 76 lines changed or added


 bgsync.h   bgsync.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/thread/mutex.hpp> #include <boost/thread/mutex.hpp>
#include "mongo/util/queue.h" #include "mongo/util/queue.h"
#include "mongo/db/repl/oplogreader.h" #include "mongo/db/repl/oplogreader.h"
#include "mongo/db/repl/rs.h" #include "mongo/db/repl/rs.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 bson_field.h   bson_field.h 
skipping to change at line 81 skipping to change at line 81
T _t; T _t;
}; };
template<typename T> template<typename T>
class BSONField { class BSONField {
public: public:
BSONField(const std::string& name) BSONField(const std::string& name)
: _name(name), _defaultSet(false) {} : _name(name), _defaultSet(false) {}
BSONField(const std::string& name, const T& defaultVal) BSONField(const std::string& name, const T& defaultVal)
: _name(name), _default(defaultVal), _defaultSet(true) {} : _name(name), _default(defaultVal) , _defaultSet(true) {}
BSONFieldValue<T> make(const T& t) const { BSONFieldValue<T> make(const T& t) const {
return BSONFieldValue<T>(_name, t); return BSONFieldValue<T>(_name, t);
} }
BSONFieldValue<T> operator()(const T& t) const { BSONFieldValue<T> operator()(const T& t) const {
return BSONFieldValue<T>(_name, t); return BSONFieldValue<T>(_name, t);
} }
const std::string& name() const { const std::string& name() const {
return _name; return _name;
} }
const T& getDefault() const { const T& getDefault() const {
dassert(_defaultSet);
return _default; return _default;
} }
const bool hasDefault() const { const bool hasDefault() const {
return _defaultSet; return _defaultSet;
} }
std::string operator()() const { std::string operator()() const {
return _name; return _name;
} }
 End of changes. 2 change blocks. 
1 lines changed or deleted 2 lines changed or added


 bson_serializable.h   bson_serializable.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 bsonmisc.h   bsonmisc.h 
skipping to change at line 72 skipping to change at line 72
BSON( "name" << "joe" << "age" << 33 ) BSON( "name" << "joe" << "age" << 33 )
with auto-generated object id: with auto-generated object id:
BSON( GENOID << "name" << "joe" << "age" << 33 ) BSON( GENOID << "name" << "joe" << "age" << 33 )
The labels GT, GTE, LT, LTE, NE can be helpful for stream-oriented construction The labels GT, GTE, LT, LTE, NE can be helpful for stream-oriented construction
of a BSONObj, particularly when assembling a Query. For example, of a BSONObj, particularly when assembling a Query. For example,
BSON( "a" << GT << 23.4 << NE << 30 << "b" << 2 ) produces the obje ct BSON( "a" << GT << 23.4 << NE << 30 << "b" << 2 ) produces the obje ct
{ a: { \$gt: 23.4, \$ne: 30 }, b: 2 }. { a: { \$gt: 23.4, \$ne: 30 }, b: 2 }.
*/ */
#define BSON(x) (( mongo::BSONObjBuilder(64) << x ).obj()) #define BSON(x) (( ::mongo::BSONObjBuilder(64) << x ).obj())
/** Use BSON_ARRAY macro like BSON macro, but without keys /** Use BSON_ARRAY macro like BSON macro, but without keys
BSONArray arr = BSON_ARRAY( "hello" << 1 << BSON( "foo" << BSON_ARR AY( "bar" << "baz" << "qux" ) ) ); BSONArray arr = BSON_ARRAY( "hello" << 1 << BSON( "foo" << BSON_ARR AY( "bar" << "baz" << "qux" ) ) );
*/ */
#define BSON_ARRAY(x) (( mongo::BSONArrayBuilder() << x ).arr()) #define BSON_ARRAY(x) (( ::mongo::BSONArrayBuilder() << x ).arr())
/* Utility class to auto assign object IDs. /* Utility class to auto assign object IDs.
Example: Example:
std::cout << BSON( GENOID << "z" << 3 ); // { _id : ..., z : 3 } std::cout << BSON( GENOID << "z" << 3 ); // { _id : ..., z : 3 }
*/ */
extern struct GENOIDLabeler { } GENOID; extern struct GENOIDLabeler { } GENOID;
/* Utility class to add a Date element with the current time /* Utility class to add a Date element with the current time
Example: Example:
std::cout << BSON( "created" << DATENOW ); // { created : "2009-10 -09 11:41:42" } std::cout << BSON( "created" << DATENOW ); // { created : "2009-10 -09 11:41:42" }
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 bsonobj.h   bsonobj.h 
skipping to change at line 283 skipping to change at line 283
/** performs a cursory check on the object's size only. */ /** performs a cursory check on the object's size only. */
bool isValid() const; bool isValid() const;
/** @return ok if it can be stored as a valid embedded doc. /** @return ok if it can be stored as a valid embedded doc.
* Not valid if any field name: * Not valid if any field name:
* - contains a "." * - contains a "."
* - starts with "$" * - starts with "$"
* -- unless it is a dbref ($ref/$id/[$db]/...) * -- unless it is a dbref ($ref/$id/[$db]/...)
*/ */
inline bool okForStorage() const { inline bool okForStorage() const {
return _okForStorage(false); return _okForStorage(false).isOK();
} }
/** Same as above with the following extra restrictions /** Same as above with the following extra restrictions
* Not valid if: * Not valid if:
* - "_id" field is a * - "_id" field is a
* -- Regex * -- Regex
* -- Array * -- Array
*/ */
inline bool okForStorageAsRoot() const { inline bool okForStorageAsRoot() const {
return _okForStorage(true).isOK();
}
/**
* Validates that this can be stored as an embedded document
* See details above in okForStorage
*
* If not valid a user readable status message is returned.
*/
inline Status storageValidEmbedded() const {
return _okForStorage(false);
}
/**
* Validates that this can be stored as a document (in a collection
)
* See details above in okForStorageAsRoot
*
* If not valid a user readable status message is returned.
*/
inline Status storageValid() const {
return _okForStorage(true); return _okForStorage(true);
} }
/** @return true if object is empty -- i.e., {} */ /** @return true if object is empty -- i.e., {} */
bool isEmpty() const { return objsize() <= 5; } bool isEmpty() const { return objsize() <= 5; }
void dump() const; void dump() const;
/** Alternative output format */ /** Alternative output format */
std::string hexDump() const; std::string hexDump() const;
skipping to change at line 546 skipping to change at line 566
void init(Holder *holder) { void init(Holder *holder) {
_holder = holder; // holder is now managed by intrusive_ptr _holder = holder; // holder is now managed by intrusive_ptr
init(holder->data); init(holder->data);
} }
void init(const char *data) { void init(const char *data) {
_objdata = data; _objdata = data;
if ( !isValid() ) if ( !isValid() )
_assertInvalid(); _assertInvalid();
} }
bool _okForStorage(bool root) const; Status _okForStorage(bool root) const;
}; };
std::ostream& operator<<( std::ostream &s, const BSONObj &o ); std::ostream& operator<<( std::ostream &s, const BSONObj &o );
std::ostream& operator<<( std::ostream &s, const BSONElement &e ); std::ostream& operator<<( std::ostream &s, const BSONElement &e );
StringBuilder& operator<<( StringBuilder &s, const BSONObj &o ); StringBuilder& operator<<( StringBuilder &s, const BSONObj &o );
StringBuilder& operator<<( StringBuilder &s, const BSONElement &e ); StringBuilder& operator<<( StringBuilder &s, const BSONElement &e );
struct BSONArray : BSONObj { struct BSONArray : BSONObj {
// Don't add anything other than forwarding constructors!!! // Don't add anything other than forwarding constructors!!!
 End of changes. 3 change blocks. 
2 lines changed or deleted 23 lines changed or added


 bsonobjbuilder.h   bsonobjbuilder.h 
skipping to change at line 806 skipping to change at line 806
fill( name ); fill( name );
append( e ); append( e );
return *this; return *this;
} }
BSONArrayBuilder& appendTimestamp(unsigned int sec, unsigned int in c) { BSONArrayBuilder& appendTimestamp(unsigned int sec, unsigned int in c) {
_b.appendTimestamp(num(), sec, inc); _b.appendTimestamp(num(), sec, inc);
return *this; return *this;
} }
BSONArrayBuilder& appendTimestamp(unsigned long long ts) {
_b.appendTimestamp(num(), ts);
return *this;
}
BSONArrayBuilder& append(const StringData& s) { BSONArrayBuilder& append(const StringData& s) {
_b.append(num(), s); _b.append(num(), s);
return *this; return *this;
} }
bool isArray() const { bool isArray() const {
return true; return true;
} }
int len() const { return _b.len(); } int len() const { return _b.len(); }
 End of changes. 1 change blocks. 
0 lines changed or deleted 5 lines changed or added


 btree.h   btree.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/dur.h" #include "mongo/db/dur.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/key.h" #include "mongo/db/key.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 btree_access_method.h   btree_access_method.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/btree.h" #include "mongo/db/btree.h"
#include "mongo/db/index/index_access_method.h" #include "mongo/db/index/index_access_method.h"
#include "mongo/db/index/btree_key_generator.h" #include "mongo/db/index/btree_key_generator.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 btree_access_method_internal.h   btree_access_method_internal.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <vector> #include <vector>
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/index/btree_interface.h" #include "mongo/db/index/btree_interface.h"
#include "mongo/db/index/index_access_method.h" #include "mongo/db/index/index_access_method.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 btree_based_builder.h   btree_based_builder.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <set> #include <set>
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/pdfile.h" #include "mongo/db/pdfile.h"
namespace IndexUpdateTests { namespace IndexUpdateTests {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 btree_index_cursor.h   btree_index_cursor.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <vector> #include <vector>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/index/btree_interface.h" #include "mongo/db/index/btree_interface.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 btree_interface.h   btree_interface.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/btree.h" #include "mongo/db/btree.h"
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 btree_key_generator.h   btree_key_generator.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <vector> #include <vector>
#include <set> #include <set>
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 btree_stats.h   btree_stats.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/commands/server_status.h" #include "mongo/db/commands/server_status.h"
#include "mongo/db/pdfile.h" #include "mongo/db/pdfile.h"
#include "mongo/db/storage/record.h" #include "mongo/db/storage/record.h"
#include "mongo/util/processinfo.h" #include "mongo/util/processinfo.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 btreebuilder.h   btreebuilder.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/btree.h" #include "mongo/db/btree.h"
namespace mongo { namespace mongo {
/** /**
* build btree from the bottom up * build btree from the bottom up
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 btreecursor.h   btreecursor.h 
skipping to change at line 16 skipping to change at line 16
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <set> #include <set>
#include <vector> #include <vector>
#include "mongo/db/cursor.h" #include "mongo/db/cursor.h"
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 btreeposition.h   btreeposition.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/platform/cstdint.h" #include "mongo/platform/cstdint.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 bufreader.h   bufreader.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include "mongo/bson/util/builder.h" #include "mongo/bson/util/builder.h"
#include "mongo/util/assert_util.h" #include "mongo/util/assert_util.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 cached_plan_runner.h   cached_plan_runner.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/query/canonical_query.h" #include <boost/scoped_ptr.hpp>
#include "mongo/db/query/lite_parsed_query.h" #include <string>
#include "mongo/db/query/plan_cache.h"
#include "mongo/db/query/plan_executor.h" #include "mongo/base/status.h"
#include "mongo/db/query/runner.h" #include "mongo/db/query/runner.h"
#include "mongo/db/query/stage_builder.h"
namespace mongo { namespace mongo {
class BSONObj;
struct CachedSolution;
class CanonicalQuery;
class DiskLoc;
class PlanExecutor;
class PlanStage;
class TypeExplain;
class WorkingSet;
/** /**
* CachedPlanRunner runs a plan retrieved from the cache. * CachedPlanRunner runs a plan retrieved from the cache.
* *
* Cached plans are bundled with information describing why the plan is in the cache. * Cached plans are bundled with information describing why the plan is in the cache.
* *
* If we run a plan from the cache and behavior wildly deviates from ex pected behavior, we may * If we run a plan from the cache and behavior wildly deviates from ex pected behavior, we may
* remove the plan from the cache. See plan_cache.h. * remove the plan from the cache. See plan_cache.h.
*/ */
class CachedPlanRunner : public Runner { class CachedPlanRunner : public Runner {
public: public:
/**
* Takes ownership of both arguments. /** Takes ownership of all arguments. */
*/
CachedPlanRunner(CanonicalQuery* canonicalQuery, CachedSolution* ca ched, CachedPlanRunner(CanonicalQuery* canonicalQuery, CachedSolution* ca ched,
PlanStage* root, WorkingSet* ws) PlanStage* root, WorkingSet* ws);
: _canonicalQuery(canonicalQuery), _cachedQuery(cached),
_exec(new PlanExecutor(ws, root)), _updatedCache(false) { }
Runner::RunnerState getNext(BSONObj* objOut, DiskLoc* dlOut) { virtual ~CachedPlanRunner();
Runner::RunnerState state = _exec->getNext(objOut, dlOut);
if (Runner::RUNNER_EOF == state && !_updatedCache) { Runner::RunnerState getNext(BSONObj* objOut, DiskLoc* dlOut);
updateCache();
}
return state; virtual bool isEOF();
}
virtual bool isEOF() { return _exec->isEOF(); } virtual void saveState();
virtual void saveState() { _exec->saveState(); } virtual bool restoreState();
virtual bool restoreState() { return _exec->restoreState(); } virtual void invalidate(const DiskLoc& dl);
virtual void invalidate(const DiskLoc& dl) { _exec->invalidate(dl); } virtual void setYieldPolicy(Runner::YieldPolicy policy);
virtual void setYieldPolicy(Runner::YieldPolicy policy) { virtual const std::string& ns();
_exec->setYieldPolicy(policy);
}
virtual const string& ns() { return _canonicalQuery->getParsed().ns (); } virtual void kill();
virtual void kill() { _exec->kill(); } /**
* Returns OK, allocating and filling in '*explain' with details of
the cached
* plan. Caller takes ownership of '*explain'. Otherwise, return a
status describing
* the error.
*/
virtual Status getExplainPlan(TypeExplain** explain) const;
private: private:
void updateCache() { void updateCache();
_updatedCache = true;
// We're done. Update the cache.
PlanCache* cache = PlanCache::get(_canonicalQuery->ns());
// TODO: Is this an error?
if (NULL == cache) { return; }
// TODO: How do we decide this? boost::scoped_ptr<CanonicalQuery> _canonicalQuery;
bool shouldRemovePlan = false; boost::scoped_ptr<CachedSolution> _cachedQuery;
boost::scoped_ptr<PlanExecutor> _exec;
if (shouldRemovePlan) {
if (!cache->remove(*_canonicalQuery, *_cachedQuery->solutio
n)) {
warning() << "Cached plan runner couldn't remove plan f
rom cache. Maybe"
" somebody else did already?";
return;
}
}
// We're done running. Update cache.
auto_ptr<CachedSolutionFeedback> feedback(new CachedSolutionFee
dback());
feedback->stats = _exec->getStats();
cache->feedback(*_canonicalQuery, *_cachedQuery->solution, feed
back.release());
}
scoped_ptr<CanonicalQuery> _canonicalQuery;
scoped_ptr<CachedSolution> _cachedQuery;
scoped_ptr<PlanExecutor> _exec;
// Have we updated the cache with our plan stats yet? // Have we updated the cache with our plan stats yet?
bool _updatedCache; bool _updatedCache;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 18 change blocks. 
59 lines changed or deleted 57 lines changed or added


 canonical_query.h   canonical_query.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/dbmessage.h" #include "mongo/db/dbmessage.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/matcher/expression.h" #include "mongo/db/matcher/expression.h"
#include "mongo/db/query/lite_parsed_query.h" #include "mongo/db/query/lite_parsed_query.h"
#include "mongo/db/query/parsed_projection.h"
namespace mongo { namespace mongo {
class CanonicalQuery { class CanonicalQuery {
public: public:
static Status canonicalize(const QueryMessage& qm, CanonicalQuery** out); static Status canonicalize(const QueryMessage& qm, CanonicalQuery** out);
// This is for testing, when we don't have a QueryMessage. // These are for testing, when we don't have a QueryMessage.
static Status canonicalize(const string& ns, const BSONObj& query, CanonicalQuery** out); static Status canonicalize(const string& ns, const BSONObj& query, CanonicalQuery** out);
static Status canonicalize(const string& ns, const BSONObj& query,
// TODO: Make this more legit and useful const BSONObj& sort,
// Get a dummy query for internal use or testing. Accessing any of const BSONObj& proj, CanonicalQuery** ou
it will crash. t);
static CanonicalQuery* getInternalQuery() { return new CanonicalQue
ry(); }
// What namespace is this query over? // What namespace is this query over?
const string& ns() const { return _pq->ns(); } const string& ns() const { return _pq->ns(); }
// //
// Accessors for the query // Accessors for the query
// //
MatchExpression* root() const { return _root.get(); } MatchExpression* root() const { return _root.get(); }
BSONObj getQueryObj() const { return _pq->getFilter(); } BSONObj getQueryObj() const { return _pq->getFilter(); }
const LiteParsedQuery& getParsed() const { return *_pq; } const LiteParsedQuery& getParsed() const { return *_pq; }
ParsedProjection* getProj() const { return _proj.get(); }
string toString() const; string toString() const;
private: private:
// You must go through canonicalize to create a CanonicalQuery. // You must go through canonicalize to create a CanonicalQuery.
CanonicalQuery() { } CanonicalQuery() { }
// Takes ownership of lpq
Status init(LiteParsedQuery* lpq);
scoped_ptr<LiteParsedQuery> _pq; scoped_ptr<LiteParsedQuery> _pq;
scoped_ptr<ParsedProjection> _proj;
// _root points into _pq->getFilter() // _root points into _pq->getFilter()
scoped_ptr<MatchExpression> _root; scoped_ptr<MatchExpression> _root;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 7 change blocks. 
7 lines changed or deleted 32 lines changed or added


 catalog_hack.h   catalog_hack.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/index/2d_access_method.h" #include "mongo/db/index/2d_access_method.h"
#include "mongo/db/index/btree_access_method.h" #include "mongo/db/index/btree_access_method.h"
#include "mongo/db/index/btree_access_method_internal.h" #include "mongo/db/index/btree_access_method_internal.h"
#include "mongo/db/index/fts_access_method.h" #include "mongo/db/index/fts_access_method.h"
#include "mongo/db/index/hash_access_method.h" #include "mongo/db/index/hash_access_method.h"
#include "mongo/db/index/haystack_access_method.h" #include "mongo/db/index/haystack_access_method.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 cc_by_loc.h   cc_by_loc.h 
skipping to change at line 14 skipping to change at line 14
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
/** /**
* Defines CursorId and defines ByLocKey, which pairs up a DiskLoc * Defines CursorId and defines ByLocKey, which pairs up a DiskLoc
* and a CursorId and provides a comparison operation. * and a CursorId and provides a comparison operation.
*/ */
#pragma once #pragma once
#include <limits> #include <limits>
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 checksum.h   checksum.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
namespace mongo { namespace mongo {
/** a simple, rather dumb, but very fast checksum. see perftests.cpp f or unit tests. */ /** a simple, rather dumb, but very fast checksum. see perftests.cpp f or unit tests. */
struct Checksum { struct Checksum {
union { union {
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 chunk.h   chunk.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/bson/util/atomic_int.h" #include "mongo/bson/util/atomic_int.h"
#include "mongo/client/distlock.h" #include "mongo/client/distlock.h"
#include "mongo/s/chunk_version.h" #include "mongo/s/chunk_version.h"
#include "mongo/s/shard.h" #include "mongo/s/shard.h"
#include "mongo/s/shardkey.h" #include "mongo/s/shardkey.h"
#include "mongo/util/concurrency/ticketholder.h" #include "mongo/util/concurrency/ticketholder.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 chunk_diff.h   chunk_diff.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonobj.h"
#include "mongo/client/dbclientcursor.h" #include "mongo/client/dbclientcursor.h"
#include "mongo/client/connpool.h" #include "mongo/client/connpool.h"
#include "mongo/s/chunk.h" #include "mongo/s/chunk.h"
#include "mongo/s/chunk_version.h" #include "mongo/s/chunk_version.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 chunk_version.h   chunk_version.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/s/bson_serializable.h"
namespace mongo { namespace mongo {
// /**
// ChunkVersions consist of a major/minor version scoped to a version e * ChunkVersions consist of a major/minor version scoped to a version e
poch poch
// *
struct ChunkVersion { * Version configurations (format: major version, epoch):
*
* 1. (0, 0) - collection is dropped.
* 2. (0, n), n > 0 - applicable only to shardVersion; shard has no chu
nk.
* 3. (n, 0), n > 0 - invalid configuration.
* 4. (n, m), n > 0, m > 0 - normal sharded collection version.
*
* TODO: This is a "manual type" but, even so, still needs to comform t
o what's
* expected from types.
*/
struct ChunkVersion : public BSONSerializable {
union { union {
struct { struct {
int _minor; int _minor;
int _major; int _major;
}; };
unsigned long long _combined; unsigned long long _combined;
}; };
OID _epoch; OID _epoch;
ChunkVersion() : _minor(0), _major(0), _epoch(OID()) {} ChunkVersion() : _minor(0), _major(0), _epoch(OID()) {}
skipping to change at line 51 skipping to change at line 75
// //
ChunkVersion( int major, int minor, const OID& epoch ) ChunkVersion( int major, int minor, const OID& epoch )
: _minor(minor),_major(major), _epoch(epoch) { : _minor(minor),_major(major), _epoch(epoch) {
} }
ChunkVersion( unsigned long long ll, const OID& epoch ) ChunkVersion( unsigned long long ll, const OID& epoch )
: _combined( ll ), _epoch(epoch) { : _combined( ll ), _epoch(epoch) {
} }
static ChunkVersion DROPPED() {
return ChunkVersion( 0, 0, OID() ); // dropped OID is zero time
, zero machineId/inc
}
static ChunkVersion UNSHARDED() {
// TODO: Distinguish between these cases
return DROPPED();
}
static ChunkVersion IGNORED() {
ChunkVersion version = ChunkVersion();
version._epoch.init( 0, true ); // ignored OID is zero time, ma
x machineId/inc
return version;
}
static bool isDroppedVersion( const ChunkVersion& version ) {
return version.majorVersion() == 0 && version.minorVersion() ==
0
&& version.epoch() == DROPPED().epoch();
}
static bool isUnshardedVersion( const ChunkVersion& version ) {
return isDroppedVersion( version );
}
static bool isIgnoredVersion( const ChunkVersion& version ) {
return version.majorVersion() == 0 && version.minorVersion() ==
0
&& version.epoch() == IGNORED().epoch();
}
void inc( bool major ) { void inc( bool major ) {
if ( major ) if ( major )
incMajor(); incMajor();
else else
incMinor(); incMinor();
} }
void incMajor() { void incMajor() {
_major++; _major++;
_minor = 0; _minor = 0;
skipping to change at line 338 skipping to change at line 391
// We're now sure we're installing a new epoch and the epoch di dn't change during reload // We're now sure we're installing a new epoch and the epoch di dn't change during reload
dassert( prevEpoch == localEpoch && localEpoch != remoteEpoch ) ; dassert( prevEpoch == localEpoch && localEpoch != remoteEpoch ) ;
return VersionChoice_Remote; return VersionChoice_Remote;
} }
// //
// Currently our BSON output is to two different fields, to cleanly work with older // Currently our BSON output is to two different fields, to cleanly work with older
// versions that know nothing about epochs. // versions that know nothing about epochs.
// //
BSONObj toBSON( const string& prefixIn="" ) const { BSONObj toBSONWithPrefix( const string& prefixIn ) const {
BSONObjBuilder b; BSONObjBuilder b;
string prefix = prefixIn; string prefix = prefixIn;
if( prefix == "" ) prefix = "version"; if( prefix == "" ) prefix = "version";
b.appendTimestamp( prefix, _combined ); b.appendTimestamp( prefix, _combined );
b.append( prefix + "Epoch", _epoch ); b.append( prefix + "Epoch", _epoch );
return b.obj(); return b.obj();
} }
void addToBSON( BSONObjBuilder& b, const string& prefix="" ) const { void addToBSON( BSONObjBuilder& b, const string& prefix="" ) const {
b.appendElements( toBSON( prefix ) ); b.appendElements( toBSONWithPrefix( prefix ) );
} }
void addEpochToBSON( BSONObjBuilder& b, const string& prefix="" ) c onst { void addEpochToBSON( BSONObjBuilder& b, const string& prefix="" ) c onst {
b.append( prefix + "Epoch", _epoch ); b.append( prefix + "Epoch", _epoch );
} }
//
// bson serializable interface implementation
// (toBSON and toString were implemented above)
//
virtual bool isValid(std::string* errMsg) const {
// TODO is there any check we want to do here?
return true;
}
virtual BSONObj toBSON() const {
// ChunkVersion wants to be an array.
BSONArrayBuilder b;
b.appendTimestamp(_combined);
b.append(_epoch);
return b.arr();
}
virtual bool parseBSON(const BSONObj& source, std::string* errMsg)
{
// ChunkVersion wants to be an array.
BSONArray arrSource = static_cast<BSONArray>(source);
bool canParse;
ChunkVersion version = fromBSON(arrSource, &canParse);
if (!canParse) {
*errMsg = "Could not parse version structure";
return false;
}
_minor = version._minor;
_major = version._major;
_epoch = version._epoch;
return true;
}
virtual void clear() {
_minor = 0;
_major = 0;
_epoch = OID();
}
void cloneTo(ChunkVersion* other) const {
other->clear();
other->_minor = _minor;
other->_major = _major;
other->_epoch = _epoch;
}
}; };
inline ostream& operator<<( ostream &s , const ChunkVersion& v) { inline ostream& operator<<( ostream &s , const ChunkVersion& v) {
s << v.toString(); s << v.toString();
return s; return s;
} }
} // namespace mongo } // namespace mongo
 End of changes. 7 change blocks. 
7 lines changed or deleted 120 lines changed or added


 client.h   client.h 
skipping to change at line 23 skipping to change at line 23
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/db/client_basic.h" #include "mongo/db/client_basic.h"
#include "mongo/db/d_concurrency.h" #include "mongo/db/d_concurrency.h"
#include "mongo/db/lasterror.h" #include "mongo/db/lasterror.h"
#include "mongo/db/lockstate.h" #include "mongo/db/lockstate.h"
#include "mongo/db/stats/top.h" #include "mongo/db/stats/top.h"
#include "mongo/db/storage_options.h"
#include "mongo/util/concurrency/rwlock.h" #include "mongo/util/concurrency/rwlock.h"
#include "mongo/util/concurrency/threadlocal.h" #include "mongo/util/concurrency/threadlocal.h"
#include "mongo/util/paths.h" #include "mongo/util/paths.h"
namespace mongo { namespace mongo {
extern class ReplSet *theReplSet; extern class ReplSet *theReplSet;
class AuthenticationInfo; class AuthenticationInfo;
class Database; class Database;
class CurOp; class CurOp;
skipping to change at line 151 skipping to change at line 164
public: public:
/* set _god=true temporarily, safely */ /* set _god=true temporarily, safely */
class GodScope { class GodScope {
bool _prev; bool _prev;
public: public:
GodScope(); GodScope();
~GodScope(); ~GodScope();
}; };
//static void assureDatabaseIsOpen(const string& ns, string path=db
path);
/** "read lock, and set my context, all in one operation" /** "read lock, and set my context, all in one operation"
* This handles (if not recursively locked) opening an unopened da tabase. * This handles (if not recursively locked) opening an unopened da tabase.
*/ */
class ReadContext : boost::noncopyable { class ReadContext : boost::noncopyable {
public: public:
ReadContext(const std::string& ns, const std::string& path=dbpa th); ReadContext(const std::string& ns, const std::string& path=stor ageGlobalParams.dbpath);
Context& ctx() { return *c.get(); } Context& ctx() { return *c.get(); }
private: private:
scoped_ptr<Lock::DBRead> lk; scoped_ptr<Lock::DBRead> lk;
scoped_ptr<Context> c; scoped_ptr<Context> c;
}; };
/* Set database we want to use, then, restores when we finish (are out of scope) /* Set database we want to use, then, restores when we finish (are out of scope)
Note this is also helpful if an exception happens as the state i f fixed up. Note this is also helpful if an exception happens as the state i f fixed up.
*/ */
class Context : boost::noncopyable { class Context : boost::noncopyable {
public: public:
/** this is probably what you want */ /** this is probably what you want */
Context(const string& ns, const std::string& path=dbpath, bool Context(const string& ns, const std::string& path=storageGlobal
doVersion=true); Params.dbpath,
bool doVersion=true);
/** note: this does not call finishInit -- i.e., does not call /** note: this does not call finishInit -- i.e., does not call
shardVersionOk() for example. shardVersionOk() for example.
see also: reset(). see also: reset().
*/ */
Context(const std::string& ns , Database * db); Context(const std::string& ns , Database * db);
// used by ReadContext // used by ReadContext
Context(const string& path, const string& ns, Database *db); Context(const string& path, const string& ns, Database *db);
~Context(); ~Context();
Client* getClient() const { return _client; } Client* getClient() const { return _client; }
Database* db() const { return _db; } Database* db() const { return _db; }
const char * ns() const { return _ns.c_str(); } const char * ns() const { return _ns.c_str(); }
bool equals( const string& ns , const string& path=dbpath ) con bool equals(const string& ns, const string& path=storageGlobalP
st { return _ns == ns && _path == path; } arams.dbpath) const {
return _ns == ns && _path == path;
}
/** @return if the db was created by this Context */ /** @return if the db was created by this Context */
bool justCreated() const { return _justCreated; } bool justCreated() const { return _justCreated; }
/** @return true iff the current Context is using db/path */ /** @return true iff the current Context is using db/path */
bool inDB( const string& db , const string& path=dbpath ) const ; bool inDB(const string& db, const string& path=storageGlobalPar ams.dbpath) const;
void _clear() { // this is sort of an "early destruct" indicati on, _ns can never be uncleared void _clear() { // this is sort of an "early destruct" indicati on, _ns can never be uncleared
const_cast<string&>(_ns).clear(); const_cast<string&>(_ns).clear();
_db = 0; _db = 0;
} }
/** call before unlocking, so clear any non-thread safe state /** call before unlocking, so clear any non-thread safe state
* _db gets restored on the relock * _db gets restored on the relock
*/ */
void unlocked() { _db = 0; } void unlocked() { _db = 0; }
skipping to change at line 226 skipping to change at line 240
bool _justCreated; bool _justCreated;
bool _doVersion; bool _doVersion;
const string _ns; const string _ns;
Database * _db; Database * _db;
Timer _timer; Timer _timer;
}; // class Client::Context }; // class Client::Context
class WriteContext : boost::noncopyable { class WriteContext : boost::noncopyable {
public: public:
WriteContext(const string& ns, const std::string& path=dbpath); WriteContext(const string& ns, const std::string& path=storageG lobalParams.dbpath);
Context& ctx() { return _c; } Context& ctx() { return _c; }
private: private:
Lock::DBWrite _lk; Lock::DBWrite _lk;
Context _c; Context _c;
}; };
}; // class Client }; // class Client
/** get the Client object for this thread. */ /** get the Client object for this thread. */
inline Client& cc() { inline Client& cc() {
 End of changes. 8 change blocks. 
10 lines changed or deleted 31 lines changed or added


 client_basic.h   client_basic.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include "mongo/util/net/hostandport.h" #include "mongo/util/net/hostandport.h"
#include "mongo/util/net/message_port.h" #include "mongo/util/net/message_port.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 client_info.h   client_info.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/db/client_basic.h" #include "mongo/db/client_basic.h"
#include "mongo/s/chunk.h" #include "mongo/s/chunk.h"
#include "mongo/s/writeback_listener.h" #include "mongo/s/writeback_listener.h"
#include "mongo/util/net/hostandport.h" #include "mongo/util/net/hostandport.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 clientcursor.h   clientcursor.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include <boost/thread/recursive_mutex.hpp> #include <boost/thread/recursive_mutex.hpp>
#include "mongo/db/cc_by_loc.h" #include "mongo/db/cc_by_loc.h"
#include "mongo/db/cursor.h" #include "mongo/db/cursor.h"
skipping to change at line 49 skipping to change at line 61
typedef boost::recursive_mutex::scoped_lock recursive_scoped_lock; typedef boost::recursive_mutex::scoped_lock recursive_scoped_lock;
class ClientCursor; class ClientCursor;
class ParsedQuery; class ParsedQuery;
/** /**
* ClientCursor is a wrapper that represents a cursorid from our databa se application's * ClientCursor is a wrapper that represents a cursorid from our databa se application's
* perspective. * perspective.
*/ */
class ClientCursor : private boost::noncopyable { class ClientCursor : private boost::noncopyable {
public: public:
ClientCursor(int qopts, const shared_ptr<Cursor>& c, const string& ns, ClientCursor(int qopts, const shared_ptr<Cursor>& c, const StringDa ta& ns,
BSONObj query = BSONObj()); BSONObj query = BSONObj());
ClientCursor(Runner* runner, int qopts = 0, const BSONObj query = B SONObj()); ClientCursor(Runner* runner, int qopts = 0, const BSONObj query = B SONObj());
~ClientCursor(); ~ClientCursor();
/** /**
* Assert that there are no open cursors. * Assert that there are no open cursors.
* Called from DatabaseHolder::closeAll. * Called from DatabaseHolder::closeAll.
*/ */
skipping to change at line 78 skipping to change at line 90
Database * db() const { return _db; } Database * db() const { return _db; }
// //
// Invalidation of DiskLocs and dropping of namespaces // Invalidation of DiskLocs and dropping of namespaces
// //
/** /**
* Get rid of cursors for namespaces 'ns'. When dropping a db, ns i s "dbname." Used by drop, * Get rid of cursors for namespaces 'ns'. When dropping a db, ns i s "dbname." Used by drop,
* dropIndexes, dropDatabase. * dropIndexes, dropDatabase.
*/ */
static void invalidate(const char *ns); static void invalidate(const StringData& ns);
/** /**
* Called when the provided DiskLoc is about to change state via a deletion or an update. * Called when the provided DiskLoc is about to change state via a deletion or an update.
* All runners/cursors that might be using that DiskLoc must adapt. * All runners/cursors that might be using that DiskLoc must adapt.
*/ */
static void aboutToDelete(const StringData& ns, static void aboutToDelete(const StringData& ns,
const NamespaceDetails* nsd, const NamespaceDetails* nsd,
const DiskLoc& dl); const DiskLoc& dl);
/** /**
 End of changes. 3 change blocks. 
2 lines changed or deleted 22 lines changed or added


 cloner.h   cloner.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
struct CloneOptions; struct CloneOptions;
class DBClientBase; class DBClientBase;
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 cluster_client_internal.h   cluster_client_internal.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
/** /**
* Useful utilities for clients working on a cluster. Safe wrapping of ope rations useful in * Useful utilities for clients working on a cluster. Safe wrapping of ope rations useful in
* general for clients using cluster metadata. * general for clients using cluster metadata.
* *
* TODO: See if this stuff is more generally useful, distribute if so. * TODO: See if this stuff is more generally useful, distribute if so.
*/ */
#pragma once #pragma once
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 collection.h   collection.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/exec/collection_scan_common.h" #include "mongo/db/exec/collection_scan_common.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/storage/record_store.h"
#include "mongo/db/structure/collection_info_cache.h"
#include "mongo/platform/cstdint.h"
namespace mongo { namespace mongo {
class Database; class Database;
class ExtentManager; class ExtentManager;
class NamespaceDetails; class NamespaceDetails;
class CollectionIterator; class CollectionIterator;
class FlatIterator; class FlatIterator;
class CappedIterator; class CappedIterator;
/** /**
* this is NOT safe through a yield right now * this is NOT safe through a yield right now
* not sure if it will be, or what yet * not sure if it will be, or what yet
*/ */
class CollectionTemp { class Collection {
public: public:
CollectionTemp( const StringData& fullNS, Collection( const StringData& fullNS,
NamespaceDetails* details, NamespaceDetails* details,
Database* database ); Database* database );
~CollectionTemp(); ~Collection();
bool ok() const { return _magic == 1357924; } bool ok() const { return _magic == 1357924; }
StringData ns() const { return _ns; } NamespaceDetails* details() { return _details; } // TODO: remove
const NamespaceDetails* details() const { return _details; }
CollectionInfoCache* infoCache() { return &_infoCache; }
const CollectionInfoCache* infoCache() const { return &_infoCache;
}
const NamespaceString& ns() const { return _ns; }
BSONObj docFor( const DiskLoc& loc );
CollectionIterator* getIterator( const DiskLoc& start, bool tailabl e, CollectionIterator* getIterator( const DiskLoc& start, bool tailabl e,
const CollectionScanParams::Direct ion& dir) const; const CollectionScanParams::Direct ion& dir) const;
void deleteDocument( const DiskLoc& loc,
bool cappedOK = false,
bool noWarn = false,
BSONObj* deletedId = 0 );
// this is temporary, moving up from DB for now
// this will add a new extent the collection
// the new extent will be returned
// it will have been added to the linked list already
Extent* increaseStorageSize( int size, bool enforceQuota );
//
// Stats
//
uint64_t numRecords() const;
private: private:
// @return 0 for inf., otherwise a number of files
int largestFileNumberInQuota() const;
ExtentManager* getExtentManager(); ExtentManager* getExtentManager();
const ExtentManager* getExtentManager() const; const ExtentManager* getExtentManager() const;
int _magic; int _magic;
std::string _ns; NamespaceString _ns;
NamespaceDetails* _details; NamespaceDetails* _details;
Database* _database; Database* _database;
RecordStore _recordStore;
CollectionInfoCache _infoCache;
friend class Database; friend class Database;
friend class FlatIterator; friend class FlatIterator;
friend class CappedIterator; friend class CappedIterator;
}; };
} }
 End of changes. 10 change blocks. 
5 lines changed or deleted 60 lines changed or added


 collection_iterator.h   collection_iterator.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/exec/collection_scan_common.h" #include "mongo/db/exec/collection_scan_common.h"
namespace mongo { namespace mongo {
class CollectionTemp; class Collection;
class DiskLoc; class DiskLoc;
class ExtentManager; class ExtentManager;
class NamespaceDetails; class NamespaceDetails;
/** /**
* A CollectionIterator provides an interface for walking over a collec tion. * A CollectionIterator provides an interface for walking over a collec tion.
* The details of navigating the collection's structure are below this interface. * The details of navigating the collection's structure are below this interface.
*/ */
class CollectionIterator { class CollectionIterator {
public: public:
skipping to change at line 61 skipping to change at line 73
}; };
/** /**
* This class iterates over a non-capped collection identified by 'ns'. * This class iterates over a non-capped collection identified by 'ns'.
* The collection must exist when the constructor is called. * The collection must exist when the constructor is called.
* *
* If start is not DiskLoc(), the iteration begins at that DiskLoc. * If start is not DiskLoc(), the iteration begins at that DiskLoc.
*/ */
class FlatIterator : public CollectionIterator { class FlatIterator : public CollectionIterator {
public: public:
FlatIterator(const CollectionTemp* collection, const DiskLoc& start , FlatIterator(const Collection* collection, const DiskLoc& start,
const CollectionScanParams::Direction& dir); const CollectionScanParams::Direction& dir);
virtual ~FlatIterator() { } virtual ~FlatIterator() { }
virtual bool isEOF(); virtual bool isEOF();
virtual DiskLoc getNext(); virtual DiskLoc getNext();
virtual void invalidate(const DiskLoc& dl); virtual void invalidate(const DiskLoc& dl);
virtual void prepareToYield(); virtual void prepareToYield();
virtual bool recoverFromYield(); virtual bool recoverFromYield();
private: private:
// The result returned on the next call to getNext(). // The result returned on the next call to getNext().
DiskLoc _curr; DiskLoc _curr;
const CollectionTemp* _collection; const Collection* _collection;
CollectionScanParams::Direction _direction; CollectionScanParams::Direction _direction;
}; };
/** /**
* This class iterates over a capped collection identified by 'ns'. * This class iterates over a capped collection identified by 'ns'.
* The collection must exist when the constructor is called. * The collection must exist when the constructor is called.
* *
* If start is not DiskLoc(), the iteration begins at that DiskLoc. * If start is not DiskLoc(), the iteration begins at that DiskLoc.
* *
* If tailable is true, getNext() can be called after isEOF. It will u se the last valid * If tailable is true, getNext() can be called after isEOF. It will u se the last valid
* returned DiskLoc and try to find the next record from that. * returned DiskLoc and try to find the next record from that.
*/ */
class CappedIterator : public CollectionIterator { class CappedIterator : public CollectionIterator {
public: public:
CappedIterator(const CollectionTemp* collection, const DiskLoc& sta rt, bool tailable, CappedIterator(const Collection* collection, const DiskLoc& start, bool tailable,
const CollectionScanParams::Direction& dir); const CollectionScanParams::Direction& dir);
virtual ~CappedIterator() { } virtual ~CappedIterator() { }
// If this is a tailable cursor, isEOF could change its mind after a call to getNext(). // If this is a tailable cursor, isEOF could change its mind after a call to getNext().
virtual bool isEOF(); virtual bool isEOF();
virtual DiskLoc getNext(); virtual DiskLoc getNext();
virtual void invalidate(const DiskLoc& dl); virtual void invalidate(const DiskLoc& dl);
virtual void prepareToYield(); virtual void prepareToYield();
virtual bool recoverFromYield(); virtual bool recoverFromYield();
skipping to change at line 116 skipping to change at line 128
* Internal collection navigation helper methods. * Internal collection navigation helper methods.
*/ */
static DiskLoc getNextCapped(const NamespaceDetails* nsd, const Ext entManager* em, static DiskLoc getNextCapped(const NamespaceDetails* nsd, const Ext entManager* em,
const DiskLoc& dl, CollectionScanParam s::Direction direction ); const DiskLoc& dl, CollectionScanParam s::Direction direction );
static DiskLoc prevLoop(const NamespaceDetails* nsd, const ExtentMa nager* em, static DiskLoc prevLoop(const NamespaceDetails* nsd, const ExtentMa nager* em,
const DiskLoc& curr); const DiskLoc& curr);
static DiskLoc nextLoop(const NamespaceDetails* nsd, const ExtentMa nager* em, static DiskLoc nextLoop(const NamespaceDetails* nsd, const ExtentMa nager* em,
const DiskLoc& prev); const DiskLoc& prev);
// The collection we're iterating over. // The collection we're iterating over.
const CollectionTemp* _collection; const Collection* _collection;
// The result returned on the next call to getNext(). // The result returned on the next call to getNext().
DiskLoc _curr; DiskLoc _curr;
// If we're tailable, we try to progress from the last valid result when we hit the end. // If we're tailable, we try to progress from the last valid result when we hit the end.
DiskLoc _prev; DiskLoc _prev;
bool _tailable; bool _tailable;
CollectionScanParams::Direction _direction; CollectionScanParams::Direction _direction;
 End of changes. 6 change blocks. 
5 lines changed or deleted 25 lines changed or added


 collection_metadata.h   collection_metadata.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/s/chunk_version.h" #include "mongo/s/chunk_version.h"
#include "mongo/s/range_arithmetic.h" #include "mongo/s/range_arithmetic.h"
#include "mongo/s/type_chunk.h" #include "mongo/s/type_chunk.h"
skipping to change at line 56 skipping to change at line 68
MONGO_DISALLOW_COPYING(CollectionMetadata); MONGO_DISALLOW_COPYING(CollectionMetadata);
public: public:
~CollectionMetadata(); ~CollectionMetadata();
// //
// cloning support // cloning support
// //
/** /**
* Returns a new metadata's instance based on 'this's state by remo
ving 'chunk'.
* When cloning away the last chunk, 'newShardVersion' must be zero
. In any case,
* the caller owns the new metadata when the cloning is successful.
*
* If a new metadata can't be created, returns NULL and fills in 'e
rrMsg', if it was
* provided.
*/
CollectionMetadata* cloneMinusChunk( const ChunkType& chunk,
const ChunkVersion& newShardVe
rsion,
string* errMsg ) const;
/**
* Returns a new metadata's instance based on 'this's state by addi
ng 'chunk'. The new
* metadata can never be zero, though (see cloneMinus). The caller
owns the new metadata.
*
* If a new metadata can't be created, returns NULL and fills in 'e
rrMsg', if it was
* provided.
*/
CollectionMetadata* clonePlusChunk( const ChunkType& chunk,
const ChunkVersion& newShardVer
sion,
string* errMsg ) const;
/**
* Returns a new metadata's instance based on 'this's state by remo ving a 'pending' chunk. * Returns a new metadata's instance based on 'this's state by remo ving a 'pending' chunk.
* *
* The shard and collection version of the new metadata are unaffec ted. The caller owns the * The shard and collection version of the new metadata are unaffec ted. The caller owns the
* new metadata. * new metadata.
* *
* If a new metadata can't be created, returns NULL and fills in 'e rrMsg', if it was * If a new metadata can't be created, returns NULL and fills in 'e rrMsg', if it was
* provided. * provided.
*/ */
CollectionMetadata* cloneMinusPending( const ChunkType& pending, st ring* errMsg ) const; CollectionMetadata* cloneMinusPending( const ChunkType& pending, st ring* errMsg ) const;
skipping to change at line 101 skipping to change at line 90
* *
* The shard and collection version of the new metadata are unaffec ted. The caller owns the * The shard and collection version of the new metadata are unaffec ted. The caller owns the
* new metadata. * new metadata.
* *
* If a new metadata can't be created, returns NULL and fills in 'e rrMsg', if it was * If a new metadata can't be created, returns NULL and fills in 'e rrMsg', if it was
* provided. * provided.
*/ */
CollectionMetadata* clonePlusPending( const ChunkType& pending, str ing* errMsg ) const; CollectionMetadata* clonePlusPending( const ChunkType& pending, str ing* errMsg ) const;
/** /**
* Returns a new metadata's instance based on 'this's state by remo
ving 'chunk'.
* When cloning away the last chunk, 'newShardVersion' must be zero
. In any case,
* the caller owns the new metadata when the cloning is successful.
*
* If a new metadata can't be created, returns NULL and fills in 'e
rrMsg', if it was
* provided.
*/
CollectionMetadata* cloneMigrate( const ChunkType& chunk,
const ChunkVersion& newShardVersi
on,
string* errMsg ) const;
/**
* Returns a new metadata's instance by splitting an existing 'chun k' at the points * Returns a new metadata's instance by splitting an existing 'chun k' at the points
* describe by 'splitKeys'. The first resulting chunk will have 'ne wShardVersion' and * describe by 'splitKeys'. The first resulting chunk will have 'ne wShardVersion' and
* subsequent one would have that with the minor version incremente d at each chunk. The * subsequent one would have that with the minor version incremente d at each chunk. The
* caller owns the metadata. * caller owns the metadata.
* *
* If a new metadata can't be created, returns NULL and fills in 'e rrMsg', if it was * If a new metadata can't be created, returns NULL and fills in 'e rrMsg', if it was
* provided. * provided.
*/ */
CollectionMetadata* cloneSplit( const ChunkType& chunk, CollectionMetadata* cloneSplit( const ChunkType& chunk,
const vector<BSONObj>& splitKeys, const vector<BSONObj>& splitKeys,
skipping to change at line 241 skipping to change at line 242
/** /**
* Use the MetadataLoader to fill the empty metadata from the confi g server, or use * Use the MetadataLoader to fill the empty metadata from the confi g server, or use
* clone*() methods to use existing metadatas to build new ones. * clone*() methods to use existing metadatas to build new ones.
* *
* Unless you are the MetadataLoader or a test you should probably not be using this * Unless you are the MetadataLoader or a test you should probably not be using this
* directly. * directly.
*/ */
CollectionMetadata(); CollectionMetadata();
/**
* TESTING ONLY
*
* Returns a new metadata's instance based on 'this's state by addi
ng 'chunk'. The new
* metadata can never be zero, though (see cloneMinus). The caller
owns the new metadata.
*
* If a new metadata can't be created, returns NULL and fills in 'e
rrMsg', if it was
* provided.
*/
CollectionMetadata* clonePlusChunk( const ChunkType& chunk,
const ChunkVersion& newShardVer
sion,
string* errMsg ) const;
private: private:
// Effectively, the MetadataLoader is this class's builder. So we o pen an exception // Effectively, the MetadataLoader is this class's builder. So we o pen an exception
// and grant it friendship. // and grant it friendship.
friend class MetadataLoader; friend class MetadataLoader;
// a version for this collection that identifies the collection inc arnation (ie, a // a version for this collection that identifies the collection inc arnation (ie, a
// dropped and recreated collection with the same name would have a different version) // dropped and recreated collection with the same name would have a different version)
ChunkVersion _collVersion; ChunkVersion _collVersion;
// //
 End of changes. 4 change blocks. 
31 lines changed or deleted 52 lines changed or added


 collection_scan.h   collection_scan.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/exec/collection_scan_common.h" #include "mongo/db/exec/collection_scan_common.h"
#include "mongo/db/exec/plan_stage.h" #include "mongo/db/exec/plan_stage.h"
#include "mongo/db/matcher/expression.h" #include "mongo/db/matcher/expression.h"
#include "mongo/db/structure/collection_iterator.h" #include "mongo/db/structure/collection_iterator.h"
skipping to change at line 65 skipping to change at line 77
scoped_ptr<CollectionIterator> _iter; scoped_ptr<CollectionIterator> _iter;
CollectionScanParams _params; CollectionScanParams _params;
// True if nsdetails(_ns) == NULL on our first call to work. // True if nsdetails(_ns) == NULL on our first call to work.
bool _nsDropped; bool _nsDropped;
// Stats // Stats
CommonStats _commonStats; CommonStats _commonStats;
CollectionScanStats _specificStats;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 2 change blocks. 
0 lines changed or deleted 21 lines changed or added


 collection_scan_common.h   collection_scan_common.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
namespace mongo { namespace mongo {
struct CollectionScanParams { struct CollectionScanParams {
enum Direction { enum Direction {
FORWARD, FORWARD = 1,
BACKWARD, BACKWARD = -1,
}; };
CollectionScanParams() : start(DiskLoc()), CollectionScanParams() : start(DiskLoc()),
direction(FORWARD), direction(FORWARD),
tailable(false) { } tailable(false) { }
// What collection? // What collection?
string ns; string ns;
// isNull by default. If you specify any value for this, you're re sponsible for the DiskLoc // isNull by default. If you specify any value for this, you're re sponsible for the DiskLoc
 End of changes. 2 change blocks. 
2 lines changed or deleted 22 lines changed or added


 commands.h   commands.h 
skipping to change at line 20 skipping to change at line 20
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
#include <string>
#include <vector> #include <vector>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/auth/privilege.h" #include "mongo/db/auth/privilege.h"
#include "mongo/db/auth/resource_pattern.h"
#include "mongo/db/client_basic.h" #include "mongo/db/client_basic.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
class BSONObj; class BSONObj;
class BSONObjBuilder; class BSONObjBuilder;
class Client; class Client;
class Timer; class Timer;
skipping to change at line 54 skipping to change at line 56
// interpreted as a collection name. // interpreted as a collection name.
string parseNsFullyQualified(const string& dbname, const BSONObj& c mdObj) const; string parseNsFullyQualified(const string& dbname, const BSONObj& c mdObj) const;
public: public:
// Return the namespace for the command. If the first field in 'cmd Obj' is of type // Return the namespace for the command. If the first field in 'cmd Obj' is of type
// mongo::String, then that field is interpreted as the collection name, and is // mongo::String, then that field is interpreted as the collection name, and is
// appended to 'dbname' after a '.' character. If the first field i s not of type // appended to 'dbname' after a '.' character. If the first field i s not of type
// mongo::String, then 'dbname' is returned unmodified. // mongo::String, then 'dbname' is returned unmodified.
virtual string parseNs(const string& dbname, const BSONObj& cmdObj) const; virtual string parseNs(const string& dbname, const BSONObj& cmdObj) const;
// Utility that returns a ResourcePattern for the namespace returne
d from
// parseNs(dbname, cmdObj). This will be either an exact namespace
resource pattern
// or a database resource pattern, depending on whether parseNs ret
urns a fully qualifed
// collection name or just a database name.
ResourcePattern parseResourcePattern(const std::string& dbname,
const BSONObj& cmdObj) const;
// warning: isAuthorized uses the lockType() return values, and val ues are being passed // warning: isAuthorized uses the lockType() return values, and val ues are being passed
// around as ints so be careful as it isn't really typesafe and wil l need cleanup later // around as ints so be careful as it isn't really typesafe and wil l need cleanup later
enum LockType { READ = -1 , NONE = 0 , WRITE = 1 }; enum LockType { READ = -1 , NONE = 0 , WRITE = 1 };
const string name; const string name;
/* run the given command /* run the given command
implement this... implement this...
fromRepl - command is being invoked as part of replication synci ng. In this situation you fromRepl - command is being invoked as part of replication synci ng. In this situation you
 End of changes. 3 change blocks. 
0 lines changed or deleted 12 lines changed or added


 compiler.h   compiler.h 
// Copyright 2012 the V8 project authors. All rights reserved. // @file mongo/platform/compiler.h
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef V8_COMPILER_H_ /*
#define V8_COMPILER_H_ * Copyright 2012 10gen Inc.
*
#include "allocation.h" * Licensed under the Apache License, Version 2.0 (the "License");
#include "ast.h" * you may not use this file except in compliance with the License.
#include "zone.h" * You may obtain a copy of the License at
*
namespace v8 { * http://www.apache.org/licenses/LICENSE-2.0
namespace internal { *
* Unless required by applicable law or agreed to in writing, software
class ScriptDataImpl; * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// CompilationInfo encapsulates some information known at compile time. It * See the License for the specific language governing permissions and
// is constructed based on the resources available at compile-time. * limitations under the License.
class CompilationInfo { */
public:
CompilationInfo(Handle<Script> script, Zone* zone); #pragma once
CompilationInfo(Handle<SharedFunctionInfo> shared_info, Zone* zone);
CompilationInfo(Handle<JSFunction> closure, Zone* zone); /**
* Include "mongo/platform/compiler.h" to get compiler-specific macro defin
virtual ~CompilationInfo(); itions and utilities.
*/
Isolate* isolate() {
ASSERT(Isolate::Current() == isolate_); #if defined(_MSC_VER)
return isolate_; #include "mongo/platform/compiler_msvc.h"
} #elif defined(__GNUC__)
Zone* zone() { #include "mongo/platform/compiler_gcc.h"
return zone_; #else
} #error "Unsupported compiler family"
bool is_lazy() const { return IsLazy::decode(flags_); }
bool is_eval() const { return IsEval::decode(flags_); }
bool is_global() const { return IsGlobal::decode(flags_); }
bool is_classic_mode() const { return language_mode() == CLASSIC_MODE; }
bool is_extended_mode() const { return language_mode() == EXTENDED_MODE;
}
LanguageMode language_mode() const {
return LanguageModeField::decode(flags_);
}
bool is_in_loop() const { return IsInLoop::decode(flags_); }
FunctionLiteral* function() const { return function_; }
Scope* scope() const { return scope_; }
Scope* global_scope() const { return global_scope_; }
Handle<Code> code() const { return code_; }
Handle<JSFunction> closure() const { return closure_; }
Handle<SharedFunctionInfo> shared_info() const { return shared_info_; }
Handle<Script> script() const { return script_; }
v8::Extension* extension() const { return extension_; }
ScriptDataImpl* pre_parse_data() const { return pre_parse_data_; }
Handle<Context> calling_context() const { return calling_context_; }
int osr_ast_id() const { return osr_ast_id_; }
void MarkAsEval() {
ASSERT(!is_lazy());
flags_ |= IsEval::encode(true);
}
void MarkAsGlobal() {
ASSERT(!is_lazy());
flags_ |= IsGlobal::encode(true);
}
void SetLanguageMode(LanguageMode language_mode) {
ASSERT(this->language_mode() == CLASSIC_MODE ||
this->language_mode() == language_mode ||
language_mode == EXTENDED_MODE);
flags_ = LanguageModeField::update(flags_, language_mode);
}
void MarkAsInLoop() {
ASSERT(is_lazy());
flags_ |= IsInLoop::encode(true);
}
void MarkAsNative() {
flags_ |= IsNative::encode(true);
}
bool is_native() const {
return IsNative::decode(flags_);
}
void SetFunction(FunctionLiteral* literal) {
ASSERT(function_ == NULL);
function_ = literal;
}
void SetScope(Scope* scope) {
ASSERT(scope_ == NULL);
scope_ = scope;
}
void SetGlobalScope(Scope* global_scope) {
ASSERT(global_scope_ == NULL);
global_scope_ = global_scope;
}
void SetCode(Handle<Code> code) { code_ = code; }
void SetExtension(v8::Extension* extension) {
ASSERT(!is_lazy());
extension_ = extension;
}
void SetPreParseData(ScriptDataImpl* pre_parse_data) {
ASSERT(!is_lazy());
pre_parse_data_ = pre_parse_data;
}
void SetCallingContext(Handle<Context> context) {
ASSERT(is_eval());
calling_context_ = context;
}
void SetOsrAstId(int osr_ast_id) {
ASSERT(IsOptimizing());
osr_ast_id_ = osr_ast_id;
}
void MarkCompilingForDebugging(Handle<Code> current_code) {
ASSERT(mode_ != OPTIMIZE);
ASSERT(current_code->kind() == Code::FUNCTION);
flags_ |= IsCompilingForDebugging::encode(true);
if (current_code->is_compiled_optimizable()) {
EnableDeoptimizationSupport();
} else {
mode_ = CompilationInfo::NONOPT;
}
}
bool IsCompilingForDebugging() {
return IsCompilingForDebugging::decode(flags_);
}
bool has_global_object() const {
return !closure().is_null() && (closure()->context()->global() != NULL)
;
}
GlobalObject* global_object() const {
return has_global_object() ? closure()->context()->global() : NULL;
}
// Accessors for the different compilation modes.
bool IsOptimizing() const { return mode_ == OPTIMIZE; }
bool IsOptimizable() const { return mode_ == BASE; }
void SetOptimizing(int osr_ast_id) {
SetMode(OPTIMIZE);
osr_ast_id_ = osr_ast_id;
}
void DisableOptimization();
// Deoptimization support.
bool HasDeoptimizationSupport() const {
return SupportsDeoptimization::decode(flags_);
}
void EnableDeoptimizationSupport() {
ASSERT(IsOptimizable());
flags_ |= SupportsDeoptimization::encode(true);
}
// Determines whether or not to insert a self-optimization header.
bool ShouldSelfOptimize();
// Disable all optimization attempts of this info for the rest of the
// current compilation pipeline.
void AbortOptimization();
void set_deferred_handles(DeferredHandles* deferred_handles) {
ASSERT(deferred_handles_ == NULL);
deferred_handles_ = deferred_handles;
}
void SaveHandles() {
SaveHandle(&closure_);
SaveHandle(&shared_info_);
SaveHandle(&calling_context_);
SaveHandle(&script_);
}
private:
Isolate* isolate_;
// Compilation mode.
// BASE is generated by the full codegen, optionally prepared for bailout
s.
// OPTIMIZE is optimized code generated by the Hydrogen-based backend.
// NONOPT is generated by the full codegen and is not prepared for
// recompilation/bailouts. These functions are never recompiled.
enum Mode {
BASE,
OPTIMIZE,
NONOPT
};
void Initialize(Mode mode) {
mode_ = V8::UseCrankshaft() ? mode : NONOPT;
ASSERT(!script_.is_null());
if (script_->type()->value() == Script::TYPE_NATIVE) {
MarkAsNative();
}
if (!shared_info_.is_null()) {
ASSERT(language_mode() == CLASSIC_MODE);
SetLanguageMode(shared_info_->language_mode());
}
}
void SetMode(Mode mode) {
ASSERT(V8::UseCrankshaft());
mode_ = mode;
}
// Flags using template class BitField<type, start, length>. All are
// false by default.
//
// Compilation is either eager or lazy.
class IsLazy: public BitField<bool, 0, 1> {};
// Flags that can be set for eager compilation.
class IsEval: public BitField<bool, 1, 1> {};
class IsGlobal: public BitField<bool, 2, 1> {};
// Flags that can be set for lazy compilation.
class IsInLoop: public BitField<bool, 3, 1> {};
// Strict mode - used in eager compilation.
class LanguageModeField: public BitField<LanguageMode, 4, 2> {};
// Is this a function from our natives.
class IsNative: public BitField<bool, 6, 1> {};
// Is this code being compiled with support for deoptimization..
class SupportsDeoptimization: public BitField<bool, 7, 1> {};
// If compiling for debugging produce just full code matching the
// initial mode setting.
class IsCompilingForDebugging: public BitField<bool, 8, 1> {};
unsigned flags_;
// Fields filled in by the compilation pipeline.
// AST filled in by the parser.
FunctionLiteral* function_;
// The scope of the function literal as a convenience. Set to indicate
// that scopes have been analyzed.
Scope* scope_;
// The global scope provided as a convenience.
Scope* global_scope_;
// The compiled code.
Handle<Code> code_;
// Possible initial inputs to the compilation process.
Handle<JSFunction> closure_;
Handle<SharedFunctionInfo> shared_info_;
Handle<Script> script_;
// Fields possibly needed for eager compilation, NULL by default.
v8::Extension* extension_;
ScriptDataImpl* pre_parse_data_;
// The context of the caller is needed for eval code, and will be a null
// handle otherwise.
Handle<Context> calling_context_;
// Compilation mode flag and whether deoptimization is allowed.
Mode mode_;
int osr_ast_id_;
// The zone from which the compilation pipeline working on this
// CompilationInfo allocates.
Zone* zone_;
DeferredHandles* deferred_handles_;
template<typename T>
void SaveHandle(Handle<T> *object) {
if (!object->is_null()) {
Handle<T> handle(*(*object));
*object = handle;
}
}
DISALLOW_COPY_AND_ASSIGN(CompilationInfo);
};
// Exactly like a CompilationInfo, except also creates and enters a
// Zone on construction and deallocates it on exit.
class CompilationInfoWithZone: public CompilationInfo {
public:
explicit CompilationInfoWithZone(Handle<Script> script)
: CompilationInfo(script, &zone_),
zone_(script->GetIsolate()),
zone_scope_(&zone_, DELETE_ON_EXIT) {}
explicit CompilationInfoWithZone(Handle<SharedFunctionInfo> shared_info)
: CompilationInfo(shared_info, &zone_),
zone_(shared_info->GetIsolate()),
zone_scope_(&zone_, DELETE_ON_EXIT) {}
explicit CompilationInfoWithZone(Handle<JSFunction> closure)
: CompilationInfo(closure, &zone_),
zone_(closure->GetIsolate()),
zone_scope_(&zone_, DELETE_ON_EXIT) {}
private:
Zone zone_;
ZoneScope zone_scope_;
};
// A wrapper around a CompilationInfo that detaches the Handles from
// the underlying DeferredHandleScope and stores them in info_ on
// destruction.
class CompilationHandleScope BASE_EMBEDDED {
public:
explicit CompilationHandleScope(CompilationInfo* info)
: deferred_(info->isolate()), info_(info) {}
~CompilationHandleScope() {
info_->set_deferred_handles(deferred_.Detach());
}
private:
DeferredHandleScope deferred_;
CompilationInfo* info_;
};
class HGraph;
class HGraphBuilder;
class LChunk;
// A helper class that calls the three compilation phases in
// Crankshaft and keeps track of its state. The three phases
// CreateGraph, OptimizeGraph and GenerateAndInstallCode can either
// fail, bail-out to the full code generator or succeed. Apart from
// their return value, the status of the phase last run can be checked
// using last_status().
class OptimizingCompiler: public ZoneObject {
public:
explicit OptimizingCompiler(CompilationInfo* info)
: info_(info),
oracle_(NULL),
graph_builder_(NULL),
graph_(NULL),
chunk_(NULL),
time_taken_to_create_graph_(0),
time_taken_to_optimize_(0),
time_taken_to_codegen_(0),
last_status_(FAILED) { }
enum Status {
FAILED, BAILED_OUT, SUCCEEDED
};
MUST_USE_RESULT Status CreateGraph();
MUST_USE_RESULT Status OptimizeGraph();
MUST_USE_RESULT Status GenerateAndInstallCode();
Status last_status() const { return last_status_; }
CompilationInfo* info() const { return info_; }
MUST_USE_RESULT Status AbortOptimization() {
info_->AbortOptimization();
info_->shared_info()->DisableOptimization();
return SetLastStatus(BAILED_OUT);
}
private:
CompilationInfo* info_;
TypeFeedbackOracle* oracle_;
HGraphBuilder* graph_builder_;
HGraph* graph_;
LChunk* chunk_;
int64_t time_taken_to_create_graph_;
int64_t time_taken_to_optimize_;
int64_t time_taken_to_codegen_;
Status last_status_;
MUST_USE_RESULT Status SetLastStatus(Status status) {
last_status_ = status;
return last_status_;
}
void RecordOptimizationStats();
struct Timer {
Timer(OptimizingCompiler* compiler, int64_t* location)
: compiler_(compiler),
start_(OS::Ticks()),
location_(location) { }
~Timer() {
*location_ += (OS::Ticks() - start_);
}
OptimizingCompiler* compiler_;
int64_t start_;
int64_t* location_;
};
};
// The V8 compiler
//
// General strategy: Source code is translated into an anonymous function w
/o
// parameters which then can be executed. If the source code contains other
// functions, they will be compiled and allocated as part of the compilatio
n
// of the source code.
// Please note this interface returns shared function infos. This means yo
u
// need to call Factory::NewFunctionFromSharedFunctionInfo before you have
a
// real function with a context.
class Compiler : public AllStatic {
public:
// Default maximum number of function optimization attempts before we
// give up.
static const int kDefaultMaxOptCount = 10;
static const int kMaxInliningLevels = 3;
// Call count before primitive functions trigger their own optimization.
static const int kCallsUntilPrimitiveOpt = 200;
// All routines return a SharedFunctionInfo.
// If an error occurs an exception is raised and the return handle
// contains NULL.
// Compile a String source within a context.
static Handle<SharedFunctionInfo> Compile(Handle<String> source,
Handle<Object> script_name,
int line_offset,
int column_offset,
v8::Extension* extension,
ScriptDataImpl* pre_data,
Handle<Object> script_data,
NativesFlag is_natives_code);
// Compile a String source within a context for Eval.
static Handle<SharedFunctionInfo> CompileEval(Handle<String> source,
Handle<Context> context,
bool is_global,
LanguageMode language_mode,
int scope_position);
// Compile from function info (used for lazy compilation). Returns true o
n
// success and false if the compilation resulted in a stack overflow.
static bool CompileLazy(CompilationInfo* info);
static void RecompileParallel(Handle<JSFunction> function);
// Compile a shared function info object (the function is possibly lazily
// compiled).
static Handle<SharedFunctionInfo> BuildFunctionInfo(FunctionLiteral* node
,
Handle<Script> script
);
// Set the function info for a newly compiled function.
static void SetFunctionInfo(Handle<SharedFunctionInfo> function_info,
FunctionLiteral* lit,
bool is_toplevel,
Handle<Script> script);
static void InstallOptimizedCode(OptimizingCompiler* info);
#ifdef ENABLE_DEBUGGER_SUPPORT
static bool MakeCodeForLiveEdit(CompilationInfo* info);
#endif #endif
static void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
CompilationInfo* info,
Handle<SharedFunctionInfo> shared);
};
} } // namespace v8::internal
#endif // V8_COMPILER_H_
 End of changes. 3 change blocks. 
471 lines changed or deleted 30 lines changed or added


 compress.h   compress.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
namespace mongo { namespace mongo {
size_t compress(const char* input, size_t input_length, std::string* ou tput); size_t compress(const char* input, size_t input_length, std::string* ou tput);
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 config.h   config.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
/* This file is things related to the "grid configuration": /* This file is things related to the "grid configuration":
- what machines make up the db component of our cloud - what machines make up the db component of our cloud
- where various ranges of things live - where various ranges of things live
*/ */
#pragma once #pragma once
#include "mongo/client/dbclient_rs.h" #include "mongo/client/dbclient_rs.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 config_server_checker_service.h   config_server_checker_service.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
namespace mongo { namespace mongo {
/** /**
* Returns true if the config servers have the same contents since the last check * Returns true if the config servers have the same contents since the last check
* was performed. Currently checks only the config.chunks and config.da tabases. * was performed. Currently checks only the config.chunks and config.da tabases.
*/ */
bool isConfigServerConsistent(); bool isConfigServerConsistent();
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 config_upgrade.h   config_upgrade.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/client/dbclientinterface.h" #include "mongo/client/dbclientinterface.h"
#include "mongo/s/type_config_version.h" #include "mongo/s/type_config_version.h"
namespace mongo { namespace mongo {
/** /**
skipping to change at line 86 skipping to change at line 98
* Version upgrade which added collection epochs to all sharded col lections and * Version upgrade which added collection epochs to all sharded col lections and
* chunks. * chunks.
* *
* Also: * Also:
* + Version document in config.version now of the form: * + Version document in config.version now of the form:
* { minVersion : X, currentVersion : Y, clusterId : OID(...) } * { minVersion : X, currentVersion : Y, clusterId : OID(...) }
* + Mongos pings include a "mongoVersion" field indicating the mon gos version * + Mongos pings include a "mongoVersion" field indicating the mon gos version
* + Mongos pings include a "configVersion" field indicating the cu rrent config version * + Mongos pings include a "configVersion" field indicating the cu rrent config version
* + Mongos explicitly ignores any collection with a "primary" fiel d * + Mongos explicitly ignores any collection with a "primary" fiel d
*/ */
UpgradeHistory_MandatoryEpochVersion = 4 UpgradeHistory_MandatoryEpochVersion = 4,
/**
* Version upgrade with the following changes:
*
* + Dropping a collection from mongos now waits for the chunks to
be removed from the
* config server before contacting each shard. Because of this, m
ongos should be
* upgraded first before mongod or never drop collections during
upgrade.
*/
UpgradeHistory_DummyBumpPre2_6 = 5
}; };
// //
// CURRENT VERSION CONSTANTS // CURRENT VERSION CONSTANTS
// Note: We must modify these constants we add new upgrades, otherwise we will fail on startup // Note: We must modify these constants we add new upgrades, otherwise we will fail on startup
// //
// Earliest version we're compatible with // Earliest version we're compatible with
const int MIN_COMPATIBLE_CONFIG_VERSION = UpgradeHistory_NoEpochVersion ; const int MIN_COMPATIBLE_CONFIG_VERSION = UpgradeHistory_MandatoryEpoch Version;
// Latest version we know how to communicate with // Latest version we know how to communicate with
const int CURRENT_CONFIG_VERSION = UpgradeHistory_MandatoryEpochVersion ; const int CURRENT_CONFIG_VERSION = UpgradeHistory_DummyBumpPre2_6;
// //
// DECLARATION OF UPGRADE FUNCTIONALITY // DECLARATION OF UPGRADE FUNCTIONALITY
// These functions must also be wired explicitly to the upgrade path in // These functions must also be wired explicitly to the upgrade path in
// config_upgrade.cpp::createRegistry() // config_upgrade.cpp::createRegistry()
// //
bool doUpgradeV0ToV4(const ConnectionString& configLoc, bool doUpgradeV0ToV5(const ConnectionString& configLoc,
const VersionType& lastVersionInfo, const VersionType& lastVersionInfo,
string* errMsg); string* errMsg);
bool doUpgradeV3ToV4(const ConnectionString& configLoc, bool doUpgradeV4ToV5(const ConnectionString& configLoc,
const VersionType& lastVersionInfo, const VersionType& lastVersionInfo,
string* errMsg); string* errMsg);
// //
// Utilities for upgrading a config database to a new config version an d checking the status of // Utilities for upgrading a config database to a new config version an d checking the status of
// the config version. // the config version.
// //
enum VersionStatus { enum VersionStatus {
 End of changes. 6 change blocks. 
5 lines changed or deleted 36 lines changed or added


 config_upgrade_helpers.h   config_upgrade_helpers.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
/** /**
* Client utilities for upgrade processes, useful operations for safe confi guration upgrades. * Client utilities for upgrade processes, useful operations for safe confi guration upgrades.
* *
* These are not very general purpose, however, so are not in the general c luster utilities * These are not very general purpose, however, so are not in the general c luster utilities
* libraries. * libraries.
*/ */
#pragma once #pragma once
#include "mongo/client/dbclientinterface.h" #include "mongo/client/dbclientinterface.h"
namespace mongo { namespace mongo {
class VersionType;
/** /**
* Verifies that two collections contain documents with the same _ids. * Verifies that two collections contain documents with the same _ids.
* *
* @return OK if they do, RemoteValidationError if they do not, and an error Status if * @return OK if they do, RemoteValidationError if they do not, and an error Status if
* anything else went wrong. * anything else went wrong.
*/ */
Status checkIdsTheSame(const ConnectionString& configLoc, Status checkIdsTheSame(const ConnectionString& configLoc,
const std::string& nsA, const std::string& nsA,
const std::string& nsB); const std::string& nsB);
skipping to change at line 81 skipping to change at line 95
/** /**
* Creates a suffix for an upgrade's working collection * Creates a suffix for an upgrade's working collection
*/ */
string genWorkingSuffix(const OID& lastUpgradeId); string genWorkingSuffix(const OID& lastUpgradeId);
/** /**
* Creates a suffix for an upgrade's backup collection * Creates a suffix for an upgrade's backup collection
*/ */
string genBackupSuffix(const OID& lastUpgradeId); string genBackupSuffix(const OID& lastUpgradeId);
/**
* Checks whether an unsuccessful upgrade was performed last time and a
lso checks whether
* the mongos in the current cluster have the mimimum version required.
Returns not ok if
* the check failed and the upgrade should not proceed.
*
* Note: There is also a special case for ManualInterventionRequired er
ror where the
* message will be empty.
*/
Status preUpgradeCheck(const ConnectionString& configServer,
const VersionType& lastVersionInfo,
std::string minMongosVersion);
/**
* Sets a new upgradeID and empties upgrade state to the config server.
*/
Status startConfigUpgrade(const std::string& configServer,
int currentVersion,
const OID& upgradeID);
/**
* Informs the config server that we are about to enter to the critical
section of
* the upgrade.
*/
Status enterConfigUpgradeCriticalSection(const std::string& configServe
r, int currentVersion);
/**
* Informs the config server that the upgrade task was completed by bum
ping the version.
* This also clears all upgrade state effectively leaving the critical
section if the
* upgrade process did enter it.
*/
Status commitConfigUpgrade(const std::string& configServer,
int currentVersion,
int minCompatibleVersion,
int newVersion);
} }
 End of changes. 3 change blocks. 
0 lines changed or deleted 63 lines changed or added


 connections.h   connections.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <map> #include <map>
#include "mongo/db/auth/authorization_manager.h" #include "mongo/db/auth/authorization_manager.h"
#include "mongo/db/auth/authorization_manager_global.h"
#include "mongo/db/auth/security_key.h" #include "mongo/db/auth/security_key.h"
#include "mongo/db/repl/rs.h" // extern Tee* rslog #include "mongo/db/repl/rs.h" // extern Tee* rslog
namespace mongo { namespace mongo {
/** here we keep a single connection (with reconnect) for a set of host s, /** here we keep a single connection (with reconnect) for a set of host s,
one each, and allow one user at a time per host. if in use already for that one each, and allow one user at a time per host. if in use already for that
host, we block. so this is an easy way to keep a 1-deep pool of co nnections host, we block. so this is an easy way to keep a 1-deep pool of co nnections
that many threads can share. that many threads can share.
skipping to change at line 131 skipping to change at line 144
log() << "couldn't connect to " << _hostport << ": " << err << rsLog; log() << "couldn't connect to " << _hostport << ": " << err << rsLog;
return false; return false;
} }
connInfo->connected = true; connInfo->connected = true;
connInfo->tagPort(); connInfo->tagPort();
// if we cannot authenticate against a member, then either its ke y file // if we cannot authenticate against a member, then either its ke y file
// or our key file has to change. if our key file has to change, we'll // or our key file has to change. if our key file has to change, we'll
// be rebooting. if their file has to change, they'll be rebooted so the // be rebooting. if their file has to change, they'll be rebooted so the
// connection created above will go dead, reconnect, and reauth. // connection created above will go dead, reconnect, and reauth.
if (AuthorizationManager::isAuthEnabled()) { if (getGlobalAuthorizationManager()->isAuthEnabled()) {
return authenticateInternalUser(connInfo->cc.get()); return authenticateInternalUser(connInfo->cc.get());
} }
return true; return true;
} }
}; };
inline ScopedConn::ScopedConn(const std::string& hostport) : _hostport( hostport) { inline ScopedConn::ScopedConn(const std::string& hostport) : _hostport( hostport) {
bool first = false; bool first = false;
{ {
 End of changes. 3 change blocks. 
1 lines changed or deleted 22 lines changed or added


 console_appender.h   console_appender.h 
skipping to change at line 33 skipping to change at line 33
#include "mongo/logger/appender.h" #include "mongo/logger/appender.h"
#include "mongo/logger/console.h" #include "mongo/logger/console.h"
#include "mongo/logger/encoder.h" #include "mongo/logger/encoder.h"
namespace mongo { namespace mongo {
namespace logger { namespace logger {
/** /**
* Appender for writing to the console (stdout). * Appender for writing to the console (stdout).
*/ */
template <typename Event> template <typename Event, typename ConsoleType = Console>
class ConsoleAppender : public Appender<Event> { class ConsoleAppender : public Appender<Event> {
MONGO_DISALLOW_COPYING(ConsoleAppender); MONGO_DISALLOW_COPYING(ConsoleAppender);
public: public:
typedef Encoder<Event> EventEncoder; typedef Encoder<Event> EventEncoder;
explicit ConsoleAppender(EventEncoder* encoder) : _encoder(encoder) {} explicit ConsoleAppender(EventEncoder* encoder) : _encoder(encoder) {}
virtual Status append(const Event& event) { virtual Status append(const Event& event) {
Console console; ConsoleType console;
_encoder->encode(event, console.out()).flush(); _encoder->encode(event, console.out()).flush();
if (!console.out()) if (!console.out())
return Status(ErrorCodes::LogWriteFailed, "Error writing lo g message to console."); return Status(ErrorCodes::LogWriteFailed, "Error writing lo g message to console.");
return Status::OK(); return Status::OK();
} }
private: private:
boost::scoped_ptr<EventEncoder> _encoder; boost::scoped_ptr<EventEncoder> _encoder;
}; };
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 core.h   core.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/util/mongoutils/str.h" #include "mongo/util/mongoutils/str.h"
#include <cmath> #include <cmath>
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 count.h   count.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
/** /**
* { count: "collectionname"[, query: <query>] } * { count: "collectionname"[, query: <query>] }
* @return -1 on ns does not exist error and other errors, 0 on other e rrors, otherwise the match count. * @return -1 on ns does not exist error and other errors, 0 on other e rrors, otherwise the match count.
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 counters.h   counters.h 
skipping to change at line 16 skipping to change at line 16
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "../jsobj.h" #include "../jsobj.h"
#include "../../util/net/message.h" #include "../../util/net/message.h"
#include "../../util/processinfo.h" #include "../../util/processinfo.h"
#include "../../util/concurrency/spin_lock.h" #include "../../util/concurrency/spin_lock.h"
#include "mongo/db/pdfile.h" #include "mongo/db/pdfile.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 curop-inl.h   curop-inl.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#include "mongo/db/curop.h" #include "mongo/db/curop.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 curop.h   curop.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <vector> #include <vector>
#include "mongo/bson/util/atomic_int.h" #include "mongo/bson/util/atomic_int.h"
#include "mongo/db/client.h" #include "mongo/db/client.h"
#include "mongo/db/storage/namespace.h" #include "mongo/db/storage/namespace.h"
#include "mongo/util/concurrency/spin_lock.h" #include "mongo/util/concurrency/spin_lock.h"
skipping to change at line 191 skipping to change at line 203
void reset( const HostAndPort& remote, int op ); void reset( const HostAndPort& remote, int op );
void markCommand() { _command = true; } void markCommand() { _command = true; }
OpDebug& debug() { return _debug; } OpDebug& debug() { return _debug; }
int profileLevel() const { return _dbprofile; } int profileLevel() const { return _dbprofile; }
const char * getNS() const { return _ns; } const char * getNS() const { return _ns; }
bool shouldDBProfile( int ms ) const { bool shouldDBProfile( int ms ) const {
if ( _dbprofile <= 0 ) if ( _dbprofile <= 0 )
return false; return false;
return _dbprofile >= 2 || ms >= cmdLine.slowMS; return _dbprofile >= 2 || ms >= serverGlobalParams.slowMS;
} }
AtomicUInt opNum() const { return _opNum; } AtomicUInt opNum() const { return _opNum; }
/** if this op is running */ /** if this op is running */
bool active() const { return _active; } bool active() const { return _active; }
bool displayInCurop() const { return _active && ! _suppressFromCuro p; } bool displayInCurop() const { return _active && ! _suppressFromCuro p; }
int getOp() const { return _op; } int getOp() const { return _op; }
skipping to change at line 341 skipping to change at line 353
/** Nested class that implements a time limit ($maxTimeMS) for a Cu rOp object. */ /** Nested class that implements a time limit ($maxTimeMS) for a Cu rOp object. */
class MaxTimeTracker { class MaxTimeTracker {
MONGO_DISALLOW_COPYING(MaxTimeTracker); MONGO_DISALLOW_COPYING(MaxTimeTracker);
public: public:
/** Newly-constructed MaxTimeTracker objects have the time limi t disabled. */ /** Newly-constructed MaxTimeTracker objects have the time limi t disabled. */
MaxTimeTracker(); MaxTimeTracker();
/** Disables the time limit. */ /** Disables the time limit. */
void reset(); void reset();
/** Returns whether or not the time limit is enabled. */
bool isEnabled() { return _enabled; }
/** /**
* Enables the time limit to be "durationMicros" microseconds f rom "startEpochMicros" * Enables the time limit to be "durationMicros" microseconds f rom "startEpochMicros"
* (units of microseconds since the epoch). * (units of microseconds since the epoch).
* *
* "durationMicros" must be nonzero. * "durationMicros" must be nonzero.
*/ */
void setTimeLimit(uint64_t startEpochMicros, uint64_t durationM icros); void setTimeLimit(uint64_t startEpochMicros, uint64_t durationM icros);
/** /**
* Checks whether the time limit has been hit. Returns false i f not, or if the time * Checks whether the time limit has been hit. Returns false i f not, or if the time
 End of changes. 3 change blocks. 
1 lines changed or deleted 24 lines changed or added


 cursor.h   cursor.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/matcher.h" #include "mongo/db/matcher.h"
#include "mongo/db/matcher_covered.h" #include "mongo/db/matcher_covered.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 cursors.h   cursors.h 
skipping to change at line 16 skipping to change at line 16
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include <string> #include <string>
#include "mongo/client/parallel.h" #include "mongo/client/parallel.h"
#include "mongo/db/dbmessage.h" #include "mongo/db/dbmessage.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 d_concurrency.h   d_concurrency.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
// only used by mongod, thus the name ('d') // only used by mongod, thus the name ('d')
// (also used by dbtests test binary, which is running mongod test code) // (also used by dbtests test binary, which is running mongod test code)
#pragma once #pragma once
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/lockstat.h" #include "mongo/db/lockstat.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 d_globals.h   d_globals.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
// //
// these are global variables used in mongod ("d"). also used in test bina ry as that is effectively a variation on mongod code. // these are global variables used in mongod ("d"). also used in test bina ry as that is effectively a variation on mongod code.
// that is, these are not in mongos. // that is, these are not in mongos.
// //
#pragma once #pragma once
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 d_logic.h   d_logic.h 
skipping to change at line 16 skipping to change at line 16
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/s/collection_metadata.h" #include "mongo/s/collection_metadata.h"
#include "mongo/s/chunk_version.h" #include "mongo/s/chunk_version.h"
#include "mongo/util/concurrency/ticketholder.h" #include "mongo/util/concurrency/ticketholder.h"
skipping to change at line 130 skipping to change at line 142
/** /**
* Creates and installs a new chunk metadata for a given collection by "forgetting" about * Creates and installs a new chunk metadata for a given collection by "forgetting" about
* one of its chunks. The new metadata uses the provided version, which has to be higher * one of its chunks. The new metadata uses the provided version, which has to be higher
* than the current metadata's shard version. * than the current metadata's shard version.
* *
* One exception: if the forgotten chunk is the last one in this sh ard for the collection, * One exception: if the forgotten chunk is the last one in this sh ard for the collection,
* version has to be 0. * version has to be 0.
* *
* If it runs successfully, clients need to grab the new version to access the collection. * If it runs successfully, clients need to grab the new version to access the collection.
* *
* LOCKING NOTE:
* Only safe to do inside the
*
* @param ns the collection * @param ns the collection
* @param min max the chunk to eliminate from the current metadata * @param min max the chunk to eliminate from the current metadata
* @param version at which the new metadata should be at * @param version at which the new metadata should be at
*/ */
void donateChunk( const string& ns , const BSONObj& min , const BSO NObj& max , ChunkVersion version ); void donateChunk( const string& ns , const BSONObj& min , const BSO NObj& max , ChunkVersion version );
/** /**
* Creates and installs new chunk metadata for a given collection b y reclaiming a previously * Creates and installs new chunk metadata for a given collection b y reclaiming a previously
* donated chunk. The previous metadata's shard version has to be provided. * donated chunk. The previous metadata's shard version has to be provided.
* *
* If it runs successfully, clients that became stale by the previo us donateChunk will be * If it runs successfully, clients that became stale by the previo us donateChunk will be
* able to access the collection again. * able to access the collection again.
* *
* Note: If a migration has aborted but not yet unregistered a pend
ing chunk, replacing the
* metadata may leave the chunk as pending - this is not dangerous
and should be rare, but
* will require a stepdown to fully recover.
*
* @param ns the collection * @param ns the collection
* @param min max the chunk to reclaim and add to the current metad * @param prevMetadata the previous metadata before we donated a ch
ata unk
* @param version at which the new metadata should be at
*/ */
void undoDonateChunk( const string& ns , const BSONObj& min , const BSONObj& max , ChunkVersion version ); void undoDonateChunk( const string& ns, CollectionMetadataPtr prevM etadata );
/** /**
* Remembers a chunk range between 'min' and 'max' as a range which will have data migrated * Remembers a chunk range between 'min' and 'max' as a range which will have data migrated
* into it. This data can then be protected against cleanup of orp haned data. * into it. This data can then be protected against cleanup of orp haned data.
* *
* Overlapping pending ranges will be removed, so it is only safe t o use this when you know * Overlapping pending ranges will be removed, so it is only safe t o use this when you know
* your metadata view is definitive, such as at the start of a migr ation. * your metadata view is definitive, such as at the start of a migr ation.
* *
* @return false with errMsg if the range is owned by this shard * @return false with errMsg if the range is owned by this shard
*/ */
 End of changes. 5 change blocks. 
4 lines changed or deleted 31 lines changed or added


 d_merge.h   d_merge.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#include <string> #include <string>
#include "mongo/db/namespace_string.h" #include "mongo/db/namespace_string.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
/** /**
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 d_writeback.h   d_writeback.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/util/queue.h" #include "mongo/util/queue.h"
#include "mongo/util/background.h" #include "mongo/util/background.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 data_file.h   data_file.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/pdfile_version.h" #include "mongo/db/pdfile_version.h"
#include "mongo/db/storage/durable_mapped_file.h" #include "mongo/db/storage/durable_mapped_file.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 database.h   database.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/cc_by_loc.h" #include "mongo/db/cc_by_loc.h"
#include "mongo/db/cmdline.h"
#include "mongo/db/namespace_details.h" #include "mongo/db/namespace_details.h"
#include "mongo/db/storage/record.h"
#include "mongo/db/storage/extent_manager.h" #include "mongo/db/storage/extent_manager.h"
#include "mongo/db/structure/collection.h" #include "mongo/db/storage/record.h"
#include "mongo/db/storage_options.h"
namespace mongo { namespace mongo {
class Collection;
class Extent; class Extent;
class DataFile; class DataFile;
class IndexDetails;
/** /**
* Database represents a database database * Database represents a database database
* Each database database has its own set of files -- dbname.ns, dbname .0, dbname.1, ... * Each database database has its own set of files -- dbname.ns, dbname .0, dbname.1, ...
* NOT memory mapped * NOT memory mapped
*/ */
class Database { class Database {
public: public:
// you probably need to be in dbHolderMutex when constructing this // you probably need to be in dbHolderMutex when constructing this
Database(const char *nm, /*out*/ bool& newDb, const string& path = Database(const char *nm, /*out*/ bool& newDb,
dbpath); const string& path = storageGlobalParams.dbpath);
/* you must use this to close - there is essential code in this met hod that is not in the ~Database destructor. /* you must use this to close - there is essential code in this met hod that is not in the ~Database destructor.
thus the destructor is private. this could be cleaned up one da y... thus the destructor is private. this could be cleaned up one da y...
*/ */
static void closeDatabase( const string& db, const string& path ); static void closeDatabase( const string& db, const string& path );
const string& name() const { return _name; } const string& name() const { return _name; }
const string& path() const { return _path; } const string& path() const { return _path; }
void clearTmpCollections(); void clearTmpCollections();
skipping to change at line 71 skipping to change at line 85
* total file size of Database in bytes * total file size of Database in bytes
*/ */
long long fileSize() const { return _extentManager.fileSize(); } long long fileSize() const { return _extentManager.fileSize(); }
int numFiles() const { return _extentManager.numFiles(); } int numFiles() const { return _extentManager.numFiles(); }
/** /**
* return file n. if it doesn't exist, create it * return file n. if it doesn't exist, create it
*/ */
DataFile* getFile( int n, int sizeNeeded = 0, bool preallocateOnly = false ) { DataFile* getFile( int n, int sizeNeeded = 0, bool preallocateOnly = false ) {
_namespaceIndex.init(); _initForWrites();
return _extentManager.getFile( n, sizeNeeded, preallocateOnly ) ; return _extentManager.getFile( n, sizeNeeded, preallocateOnly ) ;
} }
DataFile* addAFile( int sizeNeeded, bool preallocateNextFile ) { DataFile* addAFile( int sizeNeeded, bool preallocateNextFile ) {
_initForWrites();
return _extentManager.addAFile( sizeNeeded, preallocateNextFile ); return _extentManager.addAFile( sizeNeeded, preallocateNextFile );
} }
/** /**
* makes sure we have an extra file at the end that is empty * makes sure we have an extra file at the end that is empty
* safe to call this multiple times - the implementation will only preallocate one file * safe to call this multiple times - the implementation will only preallocate one file
*/ */
void preallocateAFile() { _extentManager.preallocateAFile(); } void preallocateAFile() { _extentManager.preallocateAFile(); }
Extent* allocExtent( const char *ns, int size, bool capped, bool en
forceQuota );
/** /**
* @return true if success. false if bad level or error creating p rofile ns * @return true if success. false if bad level or error creating p rofile ns
*/ */
bool setProfilingLevel( int newLevel , string& errmsg ); bool setProfilingLevel( int newLevel , string& errmsg );
void flushFiles( bool sync ) { return _extentManager.flushFiles( sy nc ); } void flushFiles( bool sync ) { return _extentManager.flushFiles( sy nc ); }
/** /**
* @return true if ns is part of the database * @return true if ns is part of the database
* ns=foo.bar, db=foo returns true * ns=foo.bar, db=foo returns true
skipping to change at line 119 skipping to change at line 132
CCByLoc& ccByLoc() { return _ccByLoc; } CCByLoc& ccByLoc() { return _ccByLoc; }
const NamespaceIndex& namespaceIndex() const { return _namespaceInd ex; } const NamespaceIndex& namespaceIndex() const { return _namespaceInd ex; }
NamespaceIndex& namespaceIndex() { return _namespaceIndex; } NamespaceIndex& namespaceIndex() { return _namespaceIndex; }
// TODO: do not think this method should exist, so should try and e ncapsulate better // TODO: do not think this method should exist, so should try and e ncapsulate better
ExtentManager& getExtentManager() { return _extentManager; } ExtentManager& getExtentManager() { return _extentManager; }
const ExtentManager& getExtentManager() const { return _extentManag er; } const ExtentManager& getExtentManager() const { return _extentManag er; }
void dropCollection( const StringData& fullns ); Status dropCollection( const StringData& fullns );
Collection* createCollection( const StringData& ns, bool capped, co
nst BSONObj* options );
/** /**
* @param ns - this is fully qualified, which is maybe not ideal ?? ? * @param ns - this is fully qualified, which is maybe not ideal ?? ?
*/ */
CollectionTemp* getCollectionTemp( const StringData& ns ); Collection* getCollection( const StringData& ns );
Status renameCollection( const StringData& fromNS, const StringData
& toNS, bool stayTemp );
/** /**
* @return name of an existing database with same text name but dif ferent * @return name of an existing database with same text name but dif ferent
* casing, if one exists. Otherwise the empty string is returned. If * casing, if one exists. Otherwise the empty string is returned. If
* 'duplicates' is specified, it is filled with all duplicate names . * 'duplicates' is specified, it is filled with all duplicate names .
*/ */
static string duplicateUncasedName( bool inholderlockalready, const string &name, const string &path, set< string > *duplicates = 0 ); static string duplicateUncasedName( bool inholderlockalready, const string &name, const string &path, set< string > *duplicates = 0 );
static Status validateDBName( const StringData& dbname ); static Status validateDBName( const StringData& dbname );
private: private:
void _clearCollectionCache( const StringData& fullns );
void _clearCollectionCache_inlock( const StringData& fullns );
~Database(); // closes files and other cleanup see below. ~Database(); // closes files and other cleanup see below.
void _addNamespaceToCatalog( const StringData& ns, const BSONObj* o
ptions );
/**
* removes from *.system.namespaces
* frees extents
* removes from NamespaceIndex
* NOT RIGHT NOW, removes cache entry in Database TODO?
*/
Status _dropNS( const StringData& ns );
/**
* make sure namespace is initialized and $freelist is allocated be
fore
* doing anything that will write
*/
void _initForWrites() {
_namespaceIndex.init();
if ( !_extentManager.hasFreeList() ) {
_initExtentFreeList();
}
}
void _initExtentFreeList();
/** /**
* @throws DatabaseDifferCaseCode if the name is a duplicate based on * @throws DatabaseDifferCaseCode if the name is a duplicate based on
* case insensitive matching. * case insensitive matching.
*/ */
void checkDuplicateUncasedNames(bool inholderlockalready) const; void checkDuplicateUncasedNames(bool inholderlockalready) const;
void openAllFiles(); void openAllFiles();
/** Status _renameSingleNamespace( const StringData& fromNS, const Stri
* throws exception if error encounted ngData& toNS,
* @return true if the file was opened bool stayTemp );
* false if no errors, but file doesn't exist
*/
bool openExistingFile( int n );
const string _name; // "alleyinsider" const string _name; // "alleyinsider"
const string _path; // "/data/db" const string _path; // "/data/db"
NamespaceIndex _namespaceIndex; NamespaceIndex _namespaceIndex;
ExtentManager _extentManager; ExtentManager _extentManager;
const string _profileName; // "alleyinsider.system.profile" const string _profileName; // "alleyinsider.system.profile"
const string _namespacesName; // "alleyinsider.system.namespaces"
const string _extentFreelistName;
CCByLoc _ccByLoc; // use by ClientCursor CCByLoc _ccByLoc; // use by ClientCursor
RecordStats _recordStats; RecordStats _recordStats;
int _profile; // 0=off. int _profile; // 0=off.
int _magic; // used for making sure the object is still loaded in m emory int _magic; // used for making sure the object is still loaded in m emory
// TODO: probably shouldn't be a std::map // TODO: probably shouldn't be a std::map
// TODO: make sure deletes go through // TODO: make sure deletes go through
// this in some ways is a dupe of _namespaceIndex // this in some ways is a dupe of _namespaceIndex
// but it points to a much more useful data structure // but it points to a much more useful data structure
typedef std::map< std::string, CollectionTemp* > CollectionMap; typedef std::map< std::string, Collection* > CollectionMap;
CollectionMap _collections; CollectionMap _collections;
mutex _collectionLock; mutex _collectionLock;
friend class NamespaceDetails;
friend class IndexDetails;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 18 change blocks. 
18 lines changed or deleted 73 lines changed or added


 database_holder.h   database_holder.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/database.h" #include "mongo/db/database.h"
#include "mongo/db/namespace_string.h" #include "mongo/db/namespace_string.h"
namespace mongo { namespace mongo {
/** /**
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 db.h   db.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/db/client.h" #include "mongo/db/client.h"
#include "mongo/db/curop.h" #include "mongo/db/curop.h"
#include "mongo/db/database_holder.h" #include "mongo/db/database_holder.h"
#include "mongo/db/pdfile.h" #include "mongo/db/pdfile.h"
skipping to change at line 107 skipping to change at line 119
} }
~dbtempreleasecond() { ~dbtempreleasecond() {
if ( real ) { if ( real ) {
delete real; delete real;
real = 0; real = 0;
} }
} }
bool unlocked() const { return real != 0; } bool unlocked() const { return real != 0; }
}; };
extern void (*snmpInit)();
} // namespace mongo } // namespace mongo
 End of changes. 2 change blocks. 
0 lines changed or deleted 22 lines changed or added


 dbclient.h   dbclient.h 
skipping to change at line 37 skipping to change at line 37
#include "mongo/client/redef_macros.h" #include "mongo/client/redef_macros.h"
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/client/connpool.h" #include "mongo/client/connpool.h"
#include "mongo/client/dbclient_rs.h" #include "mongo/client/dbclient_rs.h"
#include "mongo/client/dbclientcursor.h" #include "mongo/client/dbclientcursor.h"
#include "mongo/client/dbclientinterface.h" #include "mongo/client/dbclientinterface.h"
#include "mongo/client/gridfs.h" #include "mongo/client/gridfs.h"
#include "mongo/client/model.h"
#include "mongo/client/sasl_client_authenticate.h" #include "mongo/client/sasl_client_authenticate.h"
#include "mongo/client/syncclusterconnection.h" #include "mongo/client/syncclusterconnection.h"
#include "mongo/util/net/ssl_options.h"
#include "mongo/client/undef_macros.h" #include "mongo/client/undef_macros.h"
 End of changes. 2 change blocks. 
1 lines changed or deleted 1 lines changed or added


 dbclientinterface.h   dbclientinterface.h 
skipping to change at line 504 skipping to change at line 504
return str::stream() << "QSpec " << return str::stream() << "QSpec " <<
BSON( "ns" << _ns << "n2skip" << _ntoskip << "n2return" << _ntoreturn << "options" << _options BSON( "ns" << _ns << "n2skip" << _ntoskip << "n2return" << _ntoreturn << "options" << _options
<< "query" << _query << "fields" << _fields ); << "query" << _query << "fields" << _fields );
} }
}; };
/** Typically one uses the QUERY(...) macro to construct a Query object . /** Typically one uses the QUERY(...) macro to construct a Query object .
Example: QUERY( "age" << 33 << "school" << "UCLA" ) Example: QUERY( "age" << 33 << "school" << "UCLA" )
*/ */
#define QUERY(x) mongo::Query( BSON(x) ) #define QUERY(x) ::mongo::Query( BSON(x) )
// Useful utilities for namespaces // Useful utilities for namespaces
/** @return the database name portion of an ns string */ /** @return the database name portion of an ns string */
string nsGetDB( const string &ns ); string nsGetDB( const string &ns );
/** @return the collection name portion of an ns string */ /** @return the collection name portion of an ns string */
string nsGetCollection( const string &ns ); string nsGetCollection( const string &ns );
/** /**
interface that handles communication with the db interface that handles communication with the db
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 dbhelpers.h   dbhelpers.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
// TODO: Remove // TODO: Remove
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/db/client.h" #include "mongo/db/client.h"
#include "mongo/db/db.h" #include "mongo/db/db.h"
#include "mongo/db/keypattern.h" #include "mongo/db/keypattern.h"
skipping to change at line 42 skipping to change at line 54
class CoveredIndexMatcher; class CoveredIndexMatcher;
/** /**
* db helpers are helper functions and classes that let us easily manip ulate the local * db helpers are helper functions and classes that let us easily manip ulate the local
* database instance in-proc. * database instance in-proc.
* *
* all helpers assume locking is handled above them * all helpers assume locking is handled above them
*/ */
struct Helpers { struct Helpers {
class RemoveSaver;
/* ensure the specified index exists. /* ensure the specified index exists.
@param keyPattern key pattern, e.g., { ts : 1 } @param keyPattern key pattern, e.g., { ts : 1 }
@param name index name, e.g., "name_1" @param name index name, e.g., "name_1"
This method can be a little (not much) cpu-slow, so you may wish to use This method can be a little (not much) cpu-slow, so you may wish to use
OCCASIONALLY ensureIndex(...); OCCASIONALLY ensureIndex(...);
Note: use ensureHaveIdIndex() for the _id index: it is faster. Note: use ensureHaveIdIndex() for the _id index: it is faster.
Note: does nothing if collection does not yet exist. Note: does nothing if collection does not yet exist.
skipping to change at line 124 skipping to change at line 138
* o = {a : 5 , b : 6} --> {"" : 5, "" : 6} * o = {a : 5 , b : 6} --> {"" : 5, "" : 6}
*/ */
static BSONObj toKeyFormat( const BSONObj& o ); static BSONObj toKeyFormat( const BSONObj& o );
/* Takes object o, and infers an ascending keyPattern with the same fields as o /* Takes object o, and infers an ascending keyPattern with the same fields as o
* Example: * Example:
* o = {a : 5 , b : 6} --> {a : 1 , b : 1 } * o = {a : 5 , b : 6} --> {a : 1 , b : 1 }
*/ */
static BSONObj inferKeyPattern( const BSONObj& o ); static BSONObj inferKeyPattern( const BSONObj& o );
class RemoveCallback {
public:
virtual ~RemoveCallback() {}
virtual void goingToDelete( const BSONObj& o ) = 0;
};
/** /**
* Takes a namespace range, specified by a min and max and qualifie d by an index pattern, * Takes a namespace range, specified by a min and max and qualifie d by an index pattern,
* and removes all the documents in that range found by iterating * and removes all the documents in that range found by iterating
* over the given index. Caller is responsible for insuring that mi n/max are * over the given index. Caller is responsible for insuring that mi n/max are
* compatible with the given keyPattern (e.g min={a:100} is compati ble with * compatible with the given keyPattern (e.g min={a:100} is compati ble with
* keyPattern={a:1,b:1} since it can be extended to {a:100,b:minKey }, but * keyPattern={a:1,b:1} since it can be extended to {a:100,b:minKey }, but
* min={b:100} is not compatible). * min={b:100} is not compatible).
* *
* Caller must hold a write lock on 'ns' * Caller must hold a write lock on 'ns'
* *
* Returns -1 when no usable index exists * Returns -1 when no usable index exists
* *
* Does oplog the individual document deletions. * Does oplog the individual document deletions.
* // TODO: Refactor this mechanism, it is growing too large * // TODO: Refactor this mechanism, it is growing too large
*/ */
static long long removeRange( const KeyRange& range, static long long removeRange( const KeyRange& range,
bool maxInclusive = false, bool maxInclusive = false,
bool secondaryThrottle = false, bool secondaryThrottle = false,
RemoveCallback * callback = 0, RemoveSaver* callback = NULL,
bool fromMigrate = false, bool fromMigrate = false,
bool onlyRemoveOrphanedDocs = false ) ; bool onlyRemoveOrphanedDocs = false ) ;
// TODO: This will supersede Chunk::MaxObjectsPerChunk // TODO: This will supersede Chunk::MaxObjectsPerChunk
static const long long kMaxDocsPerChunk; static const long long kMaxDocsPerChunk;
/** /**
* Get sorted disklocs that belong to a range of a namespace define d over an index * Get sorted disklocs that belong to a range of a namespace define d over an index
* key pattern (KeyRange). * key pattern (KeyRange).
* *
skipping to change at line 184 skipping to change at line 192
long long* numDocs, long long* numDocs,
long long* estChunkSizeBytes ); long long* estChunkSizeBytes );
/** /**
* Remove all documents from a collection. * Remove all documents from a collection.
* You do not need to set the database before calling. * You do not need to set the database before calling.
* Does not oplog the operation. * Does not oplog the operation.
*/ */
static void emptyCollection(const char *ns); static void emptyCollection(const char *ns);
}; /**
* for saving deleted bson objects to a flat file
*/
class RemoveSaver : public boost::noncopyable {
public:
RemoveSaver(const string& type, const string& ns, const string&
why);
~RemoveSaver();
/** void goingToDelete( const BSONObj& o );
* user for saving deleted bson objects to a flat file
*/ private:
class RemoveSaver : public Helpers::RemoveCallback , boost::noncopyable boost::filesystem::path _root;
{ boost::filesystem::path _file;
public: ofstream* _out;
RemoveSaver( const string& type , const string& ns , const string& };
why);
~RemoveSaver();
void goingToDelete( const BSONObj& o );
private:
boost::filesystem::path _root;
boost::filesystem::path _file;
ofstream* _out;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 6 change blocks. 
24 lines changed or deleted 38 lines changed or added


 dbmessage.h   dbmessage.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/bson/bson_validate.h" #include "mongo/bson/bson_validate.h"
#include "mongo/client/constants.h" #include "mongo/client/constants.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/util/net/message.h" #include "mongo/util/net/message.h"
#include "mongo/util/net/message_port.h" #include "mongo/util/net/message_port.h"
skipping to change at line 199 skipping to change at line 211
} }
BSONObj nextJsObj() { BSONObj nextJsObj() {
if ( nextjsobj == data ) { if ( nextjsobj == data ) {
nextjsobj += strlen(data) + 1; // skip namespace nextjsobj += strlen(data) + 1; // skip namespace
massert( 13066 , "Message contains no documents", theEnd > nextjsobj ); massert( 13066 , "Message contains no documents", theEnd > nextjsobj );
} }
massert( 10304, massert( 10304,
"Client Error: Remaining data too small for BSON objec t", "Client Error: Remaining data too small for BSON objec t",
theEnd - nextjsobj >= 5 ); theEnd - nextjsobj >= 5 );
if ( cmdLine.objcheck ) { if (serverGlobalParams.objcheck) {
Status status = validateBSON( nextjsobj, theEnd - nextjsobj ); Status status = validateBSON( nextjsobj, theEnd - nextjsobj );
massert( 10307, massert( 10307,
str::stream() << "Client Error: bad object in mess age: " << status.reason(), str::stream() << "Client Error: bad object in mess age: " << status.reason(),
status.isOK() ); status.isOK() );
} }
BSONObj js(nextjsobj); BSONObj js(nextjsobj);
verify( js.objsize() >= 5 ); verify( js.objsize() >= 5 );
verify( js.objsize() < ( theEnd - data ) ); verify( js.objsize() < ( theEnd - data ) );
 End of changes. 2 change blocks. 
1 lines changed or deleted 21 lines changed or added


 dbtests.h   dbtests.h 
skipping to change at line 28 skipping to change at line 28
*/ */
#pragma once #pragma once
#include "mongo/db/instance.h" #include "mongo/db/instance.h"
#include "mongo/unittest/unittest.h" #include "mongo/unittest/unittest.h"
using namespace mongo; using namespace mongo;
using namespace mongo::unittest; using namespace mongo::unittest;
using boost::shared_ptr; using boost::shared_ptr;
namespace mongo {
// This specifies default dbpath for our testing framework
extern const std::string default_test_dbpath;
}
 End of changes. 1 change blocks. 
0 lines changed or deleted 0 lines changed or added


 dbwebserver.h   dbwebserver.h 
skipping to change at line 18 skipping to change at line 18
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/util/admin_access.h" #include "mongo/util/admin_access.h"
#include "mongo/util/net/sock.h" #include "mongo/util/net/sock.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 delete.h   delete.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/db/jsobj.h"
#include "../jsobj.h"
#include "../clientcursor.h"
namespace mongo { namespace mongo {
class RemoveSaver;
// If justOne is true, deletedId is set to the id of the deleted object . // If justOne is true, deletedId is set to the id of the deleted object .
long long deleteObjects(const char *ns, BSONObj pattern, bool justOne, long long deleteObjects(const StringData& ns,
bool logop = false, bool god=false, RemoveSaver * rs=0); BSONObj pattern,
bool justOne,
bool logop = false,
bool god=false);
} }
 End of changes. 4 change blocks. 
7 lines changed or deleted 26 lines changed or added


 diskloc.h   diskloc.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
/* @file diskloc.h /* @file diskloc.h
Storage subsystem management. Storage subsystem management.
Lays out our datafiles on disk, manages disk space. Lays out our datafiles on disk, manages disk space.
*/ */
#pragma once #pragma once
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 document-inl.h   document-inl.h 
skipping to change at line 50 skipping to change at line 50
} }
inline Element Document::root() { inline Element Document::root() {
return _root; return _root;
} }
inline ConstElement Document::root() const { inline ConstElement Document::root() const {
return _root; return _root;
} }
inline Element Document::end() {
return Element(this, Element::kInvalidRepIdx);
}
inline ConstElement Document::end() const {
return const_cast<Document*>(this)->end();
}
inline std::string Document::toString() const { inline std::string Document::toString() const {
return getObject().toString(); return getObject().toString();
} }
inline bool Document::isInPlaceModeEnabled() const { inline bool Document::isInPlaceModeEnabled() const {
return getCurrentInPlaceMode() == kInPlaceEnabled; return getCurrentInPlaceMode() == kInPlaceEnabled;
} }
} // namespace mutablebson } // namespace mutablebson
} // namespace mongo } // namespace mongo
 End of changes. 1 change blocks. 
0 lines changed or deleted 8 lines changed or added


 document.h   document.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link th
e
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the GNU Affero General Public License in all respects f
or
* all of the code used other than as permitted herein. If you modify file(
s)
* with this exception, you may extend this exception to your version of th
e
* file(s), but you are not obligated to do so. If you do not wish to do so
,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also dele
te
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/pipeline/document_internal.h" #include "mongo/db/pipeline/document_internal.h"
#include <boost/functional/hash.hpp> #include <boost/functional/hash.hpp>
#include "mongo/bson/util/builder.h" #include "mongo/bson/util/builder.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 18 lines changed or added


 document_internal.h   document_internal.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link th
e
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the GNU Affero General Public License in all respects f
or
* all of the code used other than as permitted herein. If you modify file(
s)
* with this exception, you may extend this exception to your version of th
e
* file(s), but you are not obligated to do so. If you do not wish to do so
,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also dele
te
* it in the license file.
*/ */
#pragma once #pragma once
#include <third_party/murmurhash3/MurmurHash3.h> #include <third_party/murmurhash3/MurmurHash3.h>
#include "mongo/util/intrusive_counter.h" #include "mongo/util/intrusive_counter.h"
#include "mongo/db/pipeline/value.h" #include "mongo/db/pipeline/value.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 18 lines changed or added


 document_source.h   document_source.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link th
e
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the GNU Affero General Public License in all respects f
or
* all of the code used other than as permitted herein. If you modify file(
s)
* with this exception, you may extend this exception to your version of th
e
* file(s), but you are not obligated to do so. If you do not wish to do so
,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also dele
te
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
#include <deque> #include <deque>
skipping to change at line 135 skipping to change at line 147
results, first coalesce compatible sources using coalesce(). results, first coalesce compatible sources using coalesce().
This is intended for any operations that include expressions, and This is intended for any operations that include expressions, and
provides a hook for those to optimize those operations. provides a hook for those to optimize those operations.
The default implementation is to do nothing. The default implementation is to do nothing.
*/ */
virtual void optimize(); virtual void optimize();
enum GetDepsReturn { enum GetDepsReturn {
NOT_SUPPORTED, // This means the set should be ignored NOT_SUPPORTED, // This means the set should be ignored and the full object is required.
EXHAUSTIVE, // This means that everything needed should be in t he set EXHAUSTIVE, // This means that everything needed should be in t he set
SEE_NEXT, // Add the next Source's deps to the set SEE_NEXT, // Add the next Source's deps to the set
}; };
/** Get the fields this operation needs to do its job. /** Get the fields this operation needs to do its job.
* Deps should be in "a.b.c" notation * Deps should be in "a.b.c" notation
* An empty string in deps means the whole document is needed.
* *
* @param deps results are added here. NOT CLEARED * @param deps results are added here. NOT CLEARED
*/ */
virtual GetDepsReturn getDependencies(set<string>& deps) const { virtual GetDepsReturn getDependencies(set<string>& deps) const {
return NOT_SUPPORTED; return NOT_SUPPORTED;
} }
/** This takes dependencies from getDependencies and /** This takes dependencies from getDependencies and
* returns a projection that includes all of them * returns a projection that includes all of them
*/ */
static BSONObj depsToProjection(const set<string>& deps); static BSONObj depsToProjection(const set<string>& deps);
/** These functions take the same input as depsToProjection but are able to /** These functions take the same input as depsToProjection but are able to
* produce a Document from a BSONObj with the needed fields much f aster. * produce a Document from a BSONObj with the needed fields much f aster.
*/ */
typedef Document ParsedDeps; // See implementation for structure typedef Document ParsedDeps; // See implementation for structure
static ParsedDeps parseDeps(const set<string>& deps); static ParsedDeps parseDeps(const set<string>& deps);
static Document documentFromBsonWithDeps(const BSONObj& object, con st ParsedDeps& deps); static Document documentFromBsonWithDeps(const BSONObj& object, con st ParsedDeps& deps);
/** /**
Add the DocumentSource to the array builder. * In the default case, serializes the DocumentSource and adds it t
o the vector<Value>.
The default implementation calls sourceToBson() in order to *
convert the inner part of the object which will be added to the * A subclass may choose to overwrite this, rather than serialize,
array being built here. * if it should output multiple stages (eg, $sort sometimes also ou
tputs a $limit).
A subclass may choose to overwrite this rather than addToBsonArra
y
if it should output multiple stages.
@param pBuilder the array builder to add the operation to.
@param explain create explain output
*/ */
virtual void addToBsonArray(BSONArrayBuilder *pBuilder, bool explai
n=false) const; virtual void serializeToArray(vector<Value>& array, bool explain =
false) const;
/// Returns true if doesn't require an input source (most DocumentS ources do). /// Returns true if doesn't require an input source (most DocumentS ources do).
virtual bool isValidInitialSource() const { return false; } virtual bool isValidInitialSource() const { return false; }
protected: protected:
/** /**
Base constructor. Base constructor.
*/ */
DocumentSource(const intrusive_ptr<ExpressionContext> &pExpCtx); DocumentSource(const intrusive_ptr<ExpressionContext> &pExpCtx);
/**
Create an object that represents the document source. The object
will have a single field whose name is the source's name. This
will be used by the default implementation of addToBsonArray()
to add this object to a pipeline being represented in BSON.
@param pBuilder a blank object builder to write to
@param explain create explain output
*/
virtual void sourceToBson(BSONObjBuilder *pBuilder,
bool explain) const = 0;
/* /*
Most DocumentSources have an underlying source they get their dat a Most DocumentSources have an underlying source they get their dat a
from. This is a convenience for them. from. This is a convenience for them.
The default implementation of setSource() sets this; if you don't The default implementation of setSource() sets this; if you don't
need a source, override that to verify(). The default is to need a source, override that to verify(). The default is to
verify() if this has already been set. verify() if this has already been set.
*/ */
DocumentSource *pSource; DocumentSource *pSource;
skipping to change at line 222 skipping to change at line 217
int step; int step;
intrusive_ptr<ExpressionContext> pExpCtx; intrusive_ptr<ExpressionContext> pExpCtx;
/* /*
for explain: # of rows returned by this source for explain: # of rows returned by this source
This is *not* unsigned so it can be passed to BSONObjBuilder.appe nd(). This is *not* unsigned so it can be passed to BSONObjBuilder.appe nd().
*/ */
long long nRowsOut; long long nRowsOut;
private:
/**
* Create a Value that represents the document source.
*
* This is used by the default implementation of serializeToArray()
to add this object
* to a pipeline being serialized. Returning a missing() Value resu
lts in no entry
* being added to the array for this stage (DocumentSource).
*/
virtual Value serialize(bool explain = false) const = 0;
}; };
/** This class marks DocumentSources that should be split between the r outer and the shards /** This class marks DocumentSources that should be split between the r outer and the shards
* See Pipeline::splitForSharded() for details * See Pipeline::splitForSharded() for details
* *
* TODO inheriting from DocumentSource here was a mistake. It should b e separate. * TODO inheriting from DocumentSource here was a mistake. It should b e separate.
*/ */
class SplittableDocumentSource : public DocumentSource { class SplittableDocumentSource : public DocumentSource {
public: public:
/** returns a source to be run on the shards. /** returns a source to be run on the shards.
skipping to change at line 262 skipping to change at line 267
public: public:
virtual ~MongodInterface() {}; virtual ~MongodInterface() {};
virtual DBClientBase* directClient() = 0; // Always returns a D BDirectClient virtual DBClientBase* directClient() = 0; // Always returns a D BDirectClient
// Note that in some rare cases this could return a false negat ive but will never return // Note that in some rare cases this could return a false negat ive but will never return
// a false positive. This method will be fixed in the future on ce it becomes possible to // a false positive. This method will be fixed in the future on ce it becomes possible to
// avoid false negatives. // avoid false negatives.
virtual bool isSharded(const NamespaceString& ns) = 0; virtual bool isSharded(const NamespaceString& ns) = 0;
virtual bool isCapped(const NamespaceString& ns) = 0;
// Add new methods as needed. // Add new methods as needed.
}; };
void injectMongodInterface(boost::shared_ptr<MongodInterface> mongo d) { void injectMongodInterface(boost::shared_ptr<MongodInterface> mongo d) {
_mongod = mongod; _mongod = mongod;
} }
protected: protected:
// It is invalid to delete through a DocumentSourceNeedsMongod-type d pointer. // It is invalid to delete through a DocumentSourceNeedsMongod-type d pointer.
virtual ~DocumentSourceNeedsMongod() {} virtual ~DocumentSourceNeedsMongod() {}
// Gives subclasses access to a MongodInterface implementation // Gives subclasses access to a MongodInterface implementation
shared_ptr<MongodInterface> _mongod; shared_ptr<MongodInterface> _mongod;
}; };
class DocumentSourceBsonArray : class DocumentSourceBsonArray :
public DocumentSource { public DocumentSource {
public: public:
// virtuals from DocumentSource // virtuals from DocumentSource
virtual boost::optional<Document> getNext(); virtual boost::optional<Document> getNext();
virtual Value serialize(bool explain = false) const;
virtual void setSource(DocumentSource *pSource); virtual void setSource(DocumentSource *pSource);
virtual bool isValidInitialSource() const { return true; } virtual bool isValidInitialSource() const { return true; }
/** /**
Create a document source based on a BSON array. Create a document source based on a BSON array.
This is usually put at the beginning of a chain of document sourc es This is usually put at the beginning of a chain of document sourc es
in order to fetch data from the database. in order to fetch data from the database.
CAUTION: the BSON is not read until the source is used. Any CAUTION: the BSON is not read until the source is used. Any
elements that appear after these documents must not be read until elements that appear after these documents must not be read until
this source is exhausted. this source is exhausted.
@param pBsonElement the BSON array to treat as a document source @param array the BSON array to treat as a document source
@param pExpCtx the expression context for the pipeline @param pExpCtx the expression context for the pipeline
@returns the newly created document source @returns the newly created document source
*/ */
static intrusive_ptr<DocumentSourceBsonArray> create( static intrusive_ptr<DocumentSourceBsonArray> create(
BSONElement *pBsonElement, const BSONObj& array,
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
protected:
// virtuals from DocumentSource
virtual void sourceToBson(BSONObjBuilder *pBuilder, bool explain) c
onst;
private: private:
DocumentSourceBsonArray(BSONElement *pBsonElement, DocumentSourceBsonArray(
const BSONObj& embeddedArray,
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
BSONObj embeddedObject; BSONObj embeddedObject;
BSONObjIterator arrayIterator; BSONObjIterator arrayIterator;
}; };
class DocumentSourceCommandShards : class DocumentSourceCommandShards :
public DocumentSource { public DocumentSource {
public: public:
// virtuals from DocumentSource // virtuals from DocumentSource
virtual boost::optional<Document> getNext(); virtual boost::optional<Document> getNext();
virtual Value serialize(bool explain = false) const;
virtual void setSource(DocumentSource *pSource); virtual void setSource(DocumentSource *pSource);
virtual bool isValidInitialSource() const { return true; } virtual bool isValidInitialSource() const { return true; }
/* convenient shorthand for a commonly used type */ /* convenient shorthand for a commonly used type */
typedef vector<Strategy::CommandResult> ShardOutput; typedef vector<Strategy::CommandResult> ShardOutput;
/** /**
Create a DocumentSource that wraps the output of many shards Create a DocumentSource that wraps the output of many shards
@param shardOutput output from the individual shards @param shardOutput output from the individual shards
@param pExpCtx the expression context for the pipeline @param pExpCtx the expression context for the pipeline
@returns the newly created DocumentSource @returns the newly created DocumentSource
*/ */
static intrusive_ptr<DocumentSourceCommandShards> create( static intrusive_ptr<DocumentSourceCommandShards> create(
const ShardOutput& shardOutput, const ShardOutput& shardOutput,
const intrusive_ptr<ExpressionContext>& pExpCtx); const intrusive_ptr<ExpressionContext>& pExpCtx);
protected:
// virtuals from DocumentSource
virtual void sourceToBson(BSONObjBuilder *pBuilder, bool explain) c
onst;
private: private:
DocumentSourceCommandShards(const ShardOutput& shardOutput, DocumentSourceCommandShards(const ShardOutput& shardOutput,
const intrusive_ptr<ExpressionContext>& pExpCtx); const intrusive_ptr<ExpressionContext>& pExpCtx);
/** /**
Advance to the next document, setting pCurrent appropriately. Advance to the next document, setting pCurrent appropriately.
Adjusts pCurrent, pBsonSource, and iterator, as needed. On exit, Adjusts pCurrent, pBsonSource, and iterator, as needed. On exit,
pCurrent is the Document to return, or NULL. If NULL, this pCurrent is the Document to return, or NULL. If NULL, this
indicates there is nothing more to return. indicates there is nothing more to return.
skipping to change at line 373 skipping to change at line 375
/** /**
* Constructs and returns Documents from the BSONObj objects produced b y a supplied Cursor. * Constructs and returns Documents from the BSONObj objects produced b y a supplied Cursor.
* An object of this type may only be used by one thread, see SERVER-61 23. * An object of this type may only be used by one thread, see SERVER-61 23.
*/ */
class DocumentSourceCursor : class DocumentSourceCursor :
public DocumentSource { public DocumentSource {
public: public:
// virtuals from DocumentSource // virtuals from DocumentSource
virtual ~DocumentSourceCursor(); virtual ~DocumentSourceCursor();
virtual boost::optional<Document> getNext(); virtual boost::optional<Document> getNext();
virtual const char *getSourceName() const;
virtual Value serialize(bool explain = false) const;
virtual void setSource(DocumentSource *pSource); virtual void setSource(DocumentSource *pSource);
virtual bool coalesce(const intrusive_ptr<DocumentSource>& nextSour ce); virtual bool coalesce(const intrusive_ptr<DocumentSource>& nextSour ce);
virtual bool isValidInitialSource() const { return true; } virtual bool isValidInitialSource() const { return true; }
/** /**
* Release the Cursor and the read lock it requires, but without ch anging the other data. * Release the Cursor and the read lock it requires, but without ch anging the other data.
* Releasing the lock is required for proper concurrency, see SERVE R-6123. This * Releasing the lock is required for proper concurrency, see SERVE R-6123. This
* functionality is also used by the explain version of pipeline ex ecution. * functionality is also used by the explain version of pipeline ex ecution.
*/ */
virtual void dispose(); virtual void dispose();
skipping to change at line 439 skipping to change at line 443
This gets used for explain output. This gets used for explain output.
@param pBsonObj the sort to record @param pBsonObj the sort to record
*/ */
void setSort(const BSONObj& sort) { _sort = sort; } void setSort(const BSONObj& sort) { _sort = sort; }
void setProjection(const BSONObj& projection, const ParsedDeps& dep s); void setProjection(const BSONObj& projection, const ParsedDeps& dep s);
/// returns -1 for no limit /// returns -1 for no limit
long long getLimit() const; long long getLimit() const;
protected:
// virtuals from DocumentSource
virtual void sourceToBson(BSONObjBuilder *pBuilder, bool explain) c
onst;
private: private:
DocumentSourceCursor( DocumentSourceCursor(
const string& ns, const string& ns,
CursorId cursorId, CursorId cursorId,
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
void loadBatch(); void loadBatch();
std::deque<Document> _currentBatch; std::deque<Document> _currentBatch;
skipping to change at line 465 skipping to change at line 466
BSONObj _sort; BSONObj _sort;
shared_ptr<Projection> _projection; // shared with pClientCursor shared_ptr<Projection> _projection; // shared with pClientCursor
ParsedDeps _dependencies; ParsedDeps _dependencies;
intrusive_ptr<DocumentSourceLimit> _limit; intrusive_ptr<DocumentSourceLimit> _limit;
long long _docsAddedToBatches; // for _limit enforcement long long _docsAddedToBatches; // for _limit enforcement
string ns; // namespace string ns; // namespace
CursorId _cursorId; CursorId _cursorId;
CollectionMetadataPtr _collMetadata; CollectionMetadataPtr _collMetadata;
bool canUseCoveredIndex(ClientCursor* cursor); bool canUseCoveredIndex(ClientCursor* cursor) const;
/* /*
Yield the cursor sometimes. Yield the cursor sometimes.
If the state of the world changed during the yield such that we If the state of the world changed during the yield such that we
are unable to continue execution of the query, this will release the are unable to continue execution of the query, this will release the
client cursor, and throw an error. NOTE This differs from the client cursor, and throw an error. NOTE This differs from the
behavior of most other operations, see SERVER-2454. behavior of most other operations, see SERVER-2454.
*/ */
void yieldSometimes(ClientCursor* cursor); void yieldSometimes(ClientCursor* cursor);
skipping to change at line 528 skipping to change at line 529
}; };
class DocumentSourceGroup : class DocumentSourceGroup :
public SplittableDocumentSource { public SplittableDocumentSource {
public: public:
// virtuals from DocumentSource // virtuals from DocumentSource
virtual boost::optional<Document> getNext(); virtual boost::optional<Document> getNext();
virtual const char *getSourceName() const; virtual const char *getSourceName() const;
virtual GetDepsReturn getDependencies(set<string>& deps) const; virtual GetDepsReturn getDependencies(set<string>& deps) const;
virtual void dispose(); virtual void dispose();
virtual Value serialize(bool explain = false) const;
/** /**
Create a new grouping DocumentSource. Create a new grouping DocumentSource.
@param pExpCtx the expression context for the pipeline @param pExpCtx the expression context for the pipeline
@returns the DocumentSource @returns the DocumentSource
*/ */
static intrusive_ptr<DocumentSourceGroup> create( static intrusive_ptr<DocumentSourceGroup> create(
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
skipping to change at line 580 skipping to change at line 582
This is a convenience method that uses the above, and operates on This is a convenience method that uses the above, and operates on
a BSONElement that has been deteremined to be an Object with an a BSONElement that has been deteremined to be an Object with an
element named $group. element named $group.
@param pBsonElement the BSONELement that defines the group @param pBsonElement the BSONELement that defines the group
@param pExpCtx the expression context @param pExpCtx the expression context
@returns the grouping DocumentSource @returns the grouping DocumentSource
*/ */
static intrusive_ptr<DocumentSource> createFromBson( static intrusive_ptr<DocumentSource> createFromBson(
BSONElement *pBsonElement, BSONElement elem,
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
// Virtuals for SplittableDocumentSource // Virtuals for SplittableDocumentSource
virtual intrusive_ptr<DocumentSource> getShardSource(); virtual intrusive_ptr<DocumentSource> getShardSource();
virtual intrusive_ptr<DocumentSource> getRouterSource(); virtual intrusive_ptr<DocumentSource> getRouterSource();
static const char groupName[]; static const char groupName[];
protected:
// virtuals from DocumentSource
virtual void sourceToBson(BSONObjBuilder *pBuilder, bool explain) c
onst;
private: private:
DocumentSourceGroup(const intrusive_ptr<ExpressionContext> &pExpCtx ); DocumentSourceGroup(const intrusive_ptr<ExpressionContext> &pExpCtx );
/// Spill groups map to disk and returns an iterator to the file. /// Spill groups map to disk and returns an iterator to the file.
shared_ptr<Sorter<Value, Value>::Iterator> spill(); shared_ptr<Sorter<Value, Value>::Iterator> spill();
// Only used by spill. Would be function-local if that were legal i n C++03. // Only used by spill. Would be function-local if that were legal i n C++03.
class SpillSTLComparator; class SpillSTLComparator;
/* /*
skipping to change at line 655 skipping to change at line 653
pair<Value, Value> _firstPartOfNextGroup; pair<Value, Value> _firstPartOfNextGroup;
Value _currentId; Value _currentId;
Accumulators _currentAccumulators; Accumulators _currentAccumulators;
}; };
class DocumentSourceMatch : class DocumentSourceMatch :
public DocumentSourceFilterBase { public DocumentSourceFilterBase {
public: public:
// virtuals from DocumentSource // virtuals from DocumentSource
virtual const char *getSourceName() const; virtual const char *getSourceName() const;
virtual Value serialize(bool explain = false) const;
/** /**
Create a filter. Create a filter.
@param pBsonElement the raw BSON specification for the filter @param pBsonElement the raw BSON specification for the filter
@returns the filter @returns the filter
*/ */
static intrusive_ptr<DocumentSource> createFromBson( static intrusive_ptr<DocumentSource> createFromBson(
BSONElement *pBsonElement, BSONElement elem,
const intrusive_ptr<ExpressionContext> &pCtx); const intrusive_ptr<ExpressionContext> &pCtx);
/** /**
Create a BSONObj suitable for Matcher construction. Create a BSONObj suitable for Matcher construction.
This is used after filter analysis has moved as many filters to This is used after filter analysis has moved as many filters to
as early a point as possible in the document processing pipeline. as early a point as possible in the document processing pipeline.
See db/Matcher.h and the associated documentation for the format. See db/Matcher.h and the associated documentation for the format.
This conversion is used to move back to the low-level find() This conversion is used to move back to the low-level find()
Cursor mechanism. Cursor mechanism.
@param pBuilder the builder to write to @param pBuilder the builder to write to
*/ */
void toMatcherBson(BSONObjBuilder *pBuilder) const; void toMatcherBson(BSONObjBuilder *pBuilder) const;
static const char matchName[]; static const char matchName[];
protected:
// virtuals from DocumentSource
virtual void sourceToBson(BSONObjBuilder *pBuilder, bool explain) c
onst;
// virtuals from DocumentSourceFilterBase // virtuals from DocumentSourceFilterBase
virtual bool accept(const Document& pDocument) const; virtual bool accept(const Document& pDocument) const;
/** Returns the portion of the match that can safely be promoted to
before a $redact.
* If this returns an empty BSONObj, no part of this match may saf
ely be promoted.
*
* To be safe to promote, removing a field from a document to be m
atched must not cause
* that document to be accepted when it would otherwise be rejecte
d. As an example,
* {name: {$ne: "bob smith"}} accepts documents without a name fie
ld, which means that
* running this filter before a redact that would remove the name
field would leak
* information. On the other hand, {age: {$gt:5}} is ok because it
doesn't accept documents
* that have had their age field removed.
*/
BSONObj redactSafePortion() const;
private: private:
DocumentSourceMatch(const BSONObj &query, DocumentSourceMatch(const BSONObj &query,
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
Matcher matcher; Matcher matcher;
}; };
class DocumentSourceMergeCursors : class DocumentSourceMergeCursors :
public DocumentSource { public DocumentSource {
public: public:
typedef vector<pair<ConnectionString, CursorId> > CursorIds; typedef vector<pair<ConnectionString, CursorId> > CursorIds;
// virtuals from DocumentSource // virtuals from DocumentSource
boost::optional<Document> getNext(); boost::optional<Document> getNext();
virtual void setSource(DocumentSource *pSource); virtual void setSource(DocumentSource *pSource);
virtual const char *getSourceName() const; virtual const char *getSourceName() const;
virtual void dispose(); virtual void dispose();
virtual Value serialize(bool explain = false) const;
virtual bool isValidInitialSource() const { return true; } virtual bool isValidInitialSource() const { return true; }
static intrusive_ptr<DocumentSource> createFromBson( static intrusive_ptr<DocumentSource> createFromBson(
BSONElement *pBsonElement, BSONElement elem,
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
static intrusive_ptr<DocumentSource> create( static intrusive_ptr<DocumentSource> create(
const CursorIds& cursorIds, const CursorIds& cursorIds,
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
static const char name[]; static const char name[];
protected:
// virtuals from DocumentSource
virtual void sourceToBson(BSONObjBuilder *pBuilder, bool explain) c
onst;
private: private:
struct CursorAndConnection { struct CursorAndConnection {
CursorAndConnection(ConnectionString host, NamespaceString ns, CursorId id); CursorAndConnection(ConnectionString host, NamespaceString ns, CursorId id);
ScopedDbConnection connection; ScopedDbConnection connection;
DBClientCursor cursor; DBClientCursor cursor;
}; };
// using list to enable removing arbitrary elements // using list to enable removing arbitrary elements
skipping to change at line 752 skipping to change at line 757
bool _unstarted; bool _unstarted;
}; };
class DocumentSourceOut : public SplittableDocumentSource class DocumentSourceOut : public SplittableDocumentSource
, public DocumentSourceNeedsMongod { , public DocumentSourceNeedsMongod {
public: public:
// virtuals from DocumentSource // virtuals from DocumentSource
virtual ~DocumentSourceOut(); virtual ~DocumentSourceOut();
virtual boost::optional<Document> getNext(); virtual boost::optional<Document> getNext();
virtual const char *getSourceName() const; virtual const char *getSourceName() const;
virtual Value serialize(bool explain = false) const;
// Virtuals for SplittableDocumentSource // Virtuals for SplittableDocumentSource
virtual intrusive_ptr<DocumentSource> getShardSource() { return NUL L; } virtual intrusive_ptr<DocumentSource> getShardSource() { return NUL L; }
virtual intrusive_ptr<DocumentSource> getRouterSource() { return th is; } virtual intrusive_ptr<DocumentSource> getRouterSource() { return th is; }
const NamespaceString& getOutputNs() const { return _outputNs; } const NamespaceString& getOutputNs() const { return _outputNs; }
/** /**
Create a document source for output and pass-through. Create a document source for output and pass-through.
This can be put anywhere in a pipeline and will store content as This can be put anywhere in a pipeline and will store content as
well as pass it on. well as pass it on.
@param pBsonElement the raw BSON specification for the source @param pBsonElement the raw BSON specification for the source
@param pExpCtx the expression context for the pipeline @param pExpCtx the expression context for the pipeline
@returns the newly created document source @returns the newly created document source
*/ */
static intrusive_ptr<DocumentSource> createFromBson( static intrusive_ptr<DocumentSource> createFromBson(
BSONElement *pBsonElement, BSONElement elem,
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
static const char outName[]; static const char outName[];
protected:
// virtuals from DocumentSource
virtual void sourceToBson(BSONObjBuilder *pBuilder, bool explain) c
onst;
private: private:
DocumentSourceOut(const NamespaceString& outputNs, DocumentSourceOut(const NamespaceString& outputNs,
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
// Sets _tempsNs and prepares it to receive data. // Sets _tempsNs and prepares it to receive data.
void prepTempCollection(); void prepTempCollection();
void spill(DBClientBase* conn, const vector<BSONObj>& toInsert); void spill(DBClientBase* conn, const vector<BSONObj>& toInsert);
bool _done; bool _done;
skipping to change at line 801 skipping to change at line 803
const NamespaceString _outputNs; // output will go here after all d ata is processed. const NamespaceString _outputNs; // output will go here after all d ata is processed.
}; };
class DocumentSourceProject : class DocumentSourceProject :
public DocumentSource { public DocumentSource {
public: public:
// virtuals from DocumentSource // virtuals from DocumentSource
virtual boost::optional<Document> getNext(); virtual boost::optional<Document> getNext();
virtual const char *getSourceName() const; virtual const char *getSourceName() const;
virtual void optimize(); virtual void optimize();
virtual Value serialize(bool explain = false) const;
virtual GetDepsReturn getDependencies(set<string>& deps) const; virtual GetDepsReturn getDependencies(set<string>& deps) const;
/** /**
Create a new projection DocumentSource from BSON. Create a new projection DocumentSource from BSON.
This is a convenience for directly handling BSON, and relies on t he This is a convenience for directly handling BSON, and relies on t he
above methods. above methods.
@param pBsonElement the BSONElement with an object named $project @param pBsonElement the BSONElement with an object named $project
@param pExpCtx the expression context for the pipeline @param pExpCtx the expression context for the pipeline
@returns the created projection @returns the created projection
*/ */
static intrusive_ptr<DocumentSource> createFromBson( static intrusive_ptr<DocumentSource> createFromBson(
BSONElement *pBsonElement, BSONElement elem,
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
static const char projectName[]; static const char projectName[];
/** projection as specified by the user */ /** projection as specified by the user */
BSONObj getRaw() const { return _raw; } BSONObj getRaw() const { return _raw; }
protected:
// virtuals from DocumentSource
virtual void sourceToBson(BSONObjBuilder *pBuilder, bool explain) c
onst;
private: private:
DocumentSourceProject(const intrusive_ptr<ExpressionContext>& pExpC tx, DocumentSourceProject(const intrusive_ptr<ExpressionContext>& pExpC tx,
const intrusive_ptr<ExpressionObject>& exprOb j); const intrusive_ptr<ExpressionObject>& exprOb j);
// configuration state // configuration state
intrusive_ptr<ExpressionObject> pEO; intrusive_ptr<ExpressionObject> pEO;
BSONObj _raw; BSONObj _raw;
#if defined(_DEBUG) #if defined(_DEBUG)
// this is used in DEBUG builds to ensure we are compatible // this is used in DEBUG builds to ensure we are compatible
skipping to change at line 850 skipping to change at line 849
class DocumentSourceRedact : class DocumentSourceRedact :
public DocumentSource { public DocumentSource {
public: public:
virtual boost::optional<Document> getNext(); virtual boost::optional<Document> getNext();
virtual const char* getSourceName() const; virtual const char* getSourceName() const;
virtual void optimize(); virtual void optimize();
static const char redactName[]; static const char redactName[];
static intrusive_ptr<DocumentSource> createFromBson(BSONElement* bs static intrusive_ptr<DocumentSource> createFromBson(
onElement, BSONElement elem,
const intrusive_ptr<ExpressionContext>& expCtx); const intrusive_ptr<ExpressionContext>& expCtx);
protected: virtual Value serialize(bool explain = false) const;
virtual void sourceToBson(BSONObjBuilder* pBuilder, bool explain) c
onst;
private: private:
DocumentSourceRedact(const intrusive_ptr<ExpressionContext>& expCtx , DocumentSourceRedact(const intrusive_ptr<ExpressionContext>& expCtx ,
const intrusive_ptr<Expression>& previsit); const intrusive_ptr<Expression>& previsit);
boost::optional<Document> redactObject(const Variables& in); boost::optional<Document> redactObject(const Variables& in);
Value redactValue(const Variables& vars, const Value& in); Value redactValue(const Variables& vars, const Value& in);
intrusive_ptr<Expression> _expression; intrusive_ptr<Expression> _expression;
}; };
class DocumentSourceSort : class DocumentSourceSort :
public SplittableDocumentSource { public SplittableDocumentSource {
public: public:
// virtuals from DocumentSource // virtuals from DocumentSource
virtual boost::optional<Document> getNext(); virtual boost::optional<Document> getNext();
virtual const char *getSourceName() const; virtual const char *getSourceName() const;
virtual void addToBsonArray(BSONArrayBuilder *pBuilder, bool explai n=false) const; virtual void serializeToArray(vector<Value>& array, bool explain = false) const;
virtual bool coalesce(const intrusive_ptr<DocumentSource> &pNextSou rce); virtual bool coalesce(const intrusive_ptr<DocumentSource> &pNextSou rce);
virtual void dispose(); virtual void dispose();
virtual GetDepsReturn getDependencies(set<string>& deps) const; virtual GetDepsReturn getDependencies(set<string>& deps) const;
// Virtuals for SplittableDocumentSource // Virtuals for SplittableDocumentSource
// All work for sort is done in router currently if there is no lim it. // All work for sort is done in router currently if there is no lim it.
// If there is a limit, the $sort/$limit combination is performed o n the // If there is a limit, the $sort/$limit combination is performed o n the
// shards, then the results are resorted and limited on mongos // shards, then the results are resorted and limited on mongos
virtual intrusive_ptr<DocumentSource> getShardSource() { return lim itSrc ? this : NULL; } virtual intrusive_ptr<DocumentSource> getShardSource() { return lim itSrc ? this : NULL; }
skipping to change at line 896 skipping to change at line 895
Adds a sort key field to the key being built up. A concatenated Adds a sort key field to the key being built up. A concatenated
key is built up by calling this repeatedly. key is built up by calling this repeatedly.
@param fieldPath the field path to the key component @param fieldPath the field path to the key component
@param ascending if true, use the key for an ascending sort, @param ascending if true, use the key for an ascending sort,
otherwise, use it for descending otherwise, use it for descending
*/ */
void addKey(const string &fieldPath, bool ascending); void addKey(const string &fieldPath, bool ascending);
/** /// Write out a Document whose contents are the sort key.
Write out an object whose contents are the sort key. Document serializeSortKey() const;
@param pBuilder initialized object builder.
@param fieldPrefix specify whether or not to include the field pr
efix
*/
void sortKeyToBson(BSONObjBuilder *pBuilder, bool usePrefix) const;
/** /**
Create a sorting DocumentSource from BSON. Create a sorting DocumentSource from BSON.
This is a convenience method that uses the above, and operates on This is a convenience method that uses the above, and operates on
a BSONElement that has been deteremined to be an Object with an a BSONElement that has been deteremined to be an Object with an
element named $group. element named $group.
@param pBsonElement the BSONELement that defines the group @param pBsonElement the BSONELement that defines the group
@param pExpCtx the expression context for the pipeline @param pExpCtx the expression context for the pipeline
@returns the grouping DocumentSource @returns the grouping DocumentSource
*/ */
static intrusive_ptr<DocumentSource> createFromBson( static intrusive_ptr<DocumentSource> createFromBson(
BSONElement *pBsonElement, BSONElement elem,
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
/// Create a DocumentSourceSort with a given sort and (optional) li mit /// Create a DocumentSourceSort with a given sort and (optional) li mit
static intrusive_ptr<DocumentSourceSort> create( static intrusive_ptr<DocumentSourceSort> create(
const intrusive_ptr<ExpressionContext> &pExpCtx, const intrusive_ptr<ExpressionContext> &pExpCtx,
BSONObj sortOrder, BSONObj sortOrder,
long long limit=-1); long long limit=-1);
/// returns -1 for no limit /// returns -1 for no limit
long long getLimit() const; long long getLimit() const;
intrusive_ptr<DocumentSourceLimit> getLimitSrc() const { return lim itSrc; } intrusive_ptr<DocumentSourceLimit> getLimitSrc() const { return lim itSrc; }
static const char sortName[]; static const char sortName[];
protected:
// virtuals from DocumentSource
virtual void sourceToBson(BSONObjBuilder *pBuilder, bool explain) c
onst {
verify(false); // should call addToBsonArray instead
}
private: private:
DocumentSourceSort(const intrusive_ptr<ExpressionContext> &pExpCtx) ; DocumentSourceSort(const intrusive_ptr<ExpressionContext> &pExpCtx) ;
virtual Value serialize(bool explain = false) const {
verify(false); // should call addToBsonArray instead
}
/* /*
Before returning anything, this source must fetch everything from Before returning anything, this source must fetch everything from
the underlying source and group it. populate() is used to do tha t the underlying source and group it. populate() is used to do tha t
on the first call to any method on this source. The populated on the first call to any method on this source. The populated
boolean indicates that this has been done. boolean indicates that this has been done.
*/ */
void populate(); void populate();
bool populated; bool populated;
/* these two parallel each other */ /* these two parallel each other */
skipping to change at line 986 skipping to change at line 979
scoped_ptr<MySorter::Iterator> _output; scoped_ptr<MySorter::Iterator> _output;
}; };
class DocumentSourceLimit : class DocumentSourceLimit :
public SplittableDocumentSource { public SplittableDocumentSource {
public: public:
// virtuals from DocumentSource // virtuals from DocumentSource
virtual boost::optional<Document> getNext(); virtual boost::optional<Document> getNext();
virtual const char *getSourceName() const; virtual const char *getSourceName() const;
virtual bool coalesce(const intrusive_ptr<DocumentSource> &pNextSou rce); virtual bool coalesce(const intrusive_ptr<DocumentSource> &pNextSou rce);
virtual Value serialize(bool explain = false) const;
virtual GetDepsReturn getDependencies(set<string>& deps) const { virtual GetDepsReturn getDependencies(set<string>& deps) const {
return SEE_NEXT; // This doesn't affect needed fields return SEE_NEXT; // This doesn't affect needed fields
} }
/** /**
Create a new limiting DocumentSource. Create a new limiting DocumentSource.
@param pExpCtx the expression context for the pipeline @param pExpCtx the expression context for the pipeline
@returns the DocumentSource @returns the DocumentSource
skipping to change at line 1021 skipping to change at line 1015
This is a convenience method that uses the above, and operates on This is a convenience method that uses the above, and operates on
a BSONElement that has been deteremined to be an Object with an a BSONElement that has been deteremined to be an Object with an
element named $limit. element named $limit.
@param pBsonElement the BSONELement that defines the limit @param pBsonElement the BSONELement that defines the limit
@param pExpCtx the expression context @param pExpCtx the expression context
@returns the grouping DocumentSource @returns the grouping DocumentSource
*/ */
static intrusive_ptr<DocumentSource> createFromBson( static intrusive_ptr<DocumentSource> createFromBson(
BSONElement *pBsonElement, BSONElement elem,
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
static const char limitName[]; static const char limitName[];
protected:
// virtuals from DocumentSource
virtual void sourceToBson(BSONObjBuilder *pBuilder, bool explain) c
onst;
private: private:
DocumentSourceLimit(const intrusive_ptr<ExpressionContext> &pExpCtx , DocumentSourceLimit(const intrusive_ptr<ExpressionContext> &pExpCtx ,
long long limit); long long limit);
long long limit; long long limit;
long long count; long long count;
}; };
class DocumentSourceSkip : class DocumentSourceSkip :
public SplittableDocumentSource { public SplittableDocumentSource {
public: public:
// virtuals from DocumentSource // virtuals from DocumentSource
virtual boost::optional<Document> getNext(); virtual boost::optional<Document> getNext();
virtual const char *getSourceName() const; virtual const char *getSourceName() const;
virtual bool coalesce(const intrusive_ptr<DocumentSource> &pNextSou rce); virtual bool coalesce(const intrusive_ptr<DocumentSource> &pNextSou rce);
virtual Value serialize(bool explain = false) const;
virtual GetDepsReturn getDependencies(set<string>& deps) const { virtual GetDepsReturn getDependencies(set<string>& deps) const {
return SEE_NEXT; // This doesn't affect needed fields return SEE_NEXT; // This doesn't affect needed fields
} }
/** /**
Create a new skipping DocumentSource. Create a new skipping DocumentSource.
@param pExpCtx the expression context @param pExpCtx the expression context
@returns the DocumentSource @returns the DocumentSource
skipping to change at line 1079 skipping to change at line 1070
This is a convenience method that uses the above, and operates on This is a convenience method that uses the above, and operates on
a BSONElement that has been deteremined to be an Object with an a BSONElement that has been deteremined to be an Object with an
element named $skip. element named $skip.
@param pBsonElement the BSONELement that defines the skip @param pBsonElement the BSONELement that defines the skip
@param pExpCtx the expression context @param pExpCtx the expression context
@returns the grouping DocumentSource @returns the grouping DocumentSource
*/ */
static intrusive_ptr<DocumentSource> createFromBson( static intrusive_ptr<DocumentSource> createFromBson(
BSONElement *pBsonElement, BSONElement elem,
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
static const char skipName[]; static const char skipName[];
protected:
// virtuals from DocumentSource
virtual void sourceToBson(BSONObjBuilder *pBuilder, bool explain) c
onst;
private: private:
DocumentSourceSkip(const intrusive_ptr<ExpressionContext> &pExpCtx) ; DocumentSourceSkip(const intrusive_ptr<ExpressionContext> &pExpCtx) ;
long long _skip; long long _skip;
bool _needToSkip; bool _needToSkip;
}; };
class DocumentSourceUnwind : class DocumentSourceUnwind :
public DocumentSource { public DocumentSource {
public: public:
// virtuals from DocumentSource // virtuals from DocumentSource
virtual boost::optional<Document> getNext(); virtual boost::optional<Document> getNext();
virtual const char *getSourceName() const; virtual const char *getSourceName() const;
virtual Value serialize(bool explain = false) const;
virtual GetDepsReturn getDependencies(set<string>& deps) const; virtual GetDepsReturn getDependencies(set<string>& deps) const;
/** /**
Create a new projection DocumentSource from BSON. Create a new projection DocumentSource from BSON.
This is a convenience for directly handling BSON, and relies on t he This is a convenience for directly handling BSON, and relies on t he
above methods. above methods.
@param pBsonElement the BSONElement with an object named $project @param pBsonElement the BSONElement with an object named $project
@param pExpCtx the expression context for the pipeline @param pExpCtx the expression context for the pipeline
@returns the created projection @returns the created projection
*/ */
static intrusive_ptr<DocumentSource> createFromBson( static intrusive_ptr<DocumentSource> createFromBson(
BSONElement *pBsonElement, BSONElement elem,
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
static const char unwindName[]; static const char unwindName[];
protected:
// virtuals from DocumentSource
virtual void sourceToBson(BSONObjBuilder *pBuilder, bool explain) c
onst;
private: private:
DocumentSourceUnwind(const intrusive_ptr<ExpressionContext> &pExpCt x); DocumentSourceUnwind(const intrusive_ptr<ExpressionContext> &pExpCt x);
/** Specify the field to unwind. */ /** Specify the field to unwind. */
void unwindPath(const FieldPath &fieldPath); void unwindPath(const FieldPath &fieldPath);
// Configuration state. // Configuration state.
scoped_ptr<FieldPath> _unwindPath; scoped_ptr<FieldPath> _unwindPath;
// Iteration state. // Iteration state.
skipping to change at line 1147 skipping to change at line 1131
class DocumentSourceGeoNear : public SplittableDocumentSource class DocumentSourceGeoNear : public SplittableDocumentSource
, public DocumentSourceNeedsMongod { , public DocumentSourceNeedsMongod {
public: public:
// virtuals from DocumentSource // virtuals from DocumentSource
virtual boost::optional<Document> getNext(); virtual boost::optional<Document> getNext();
virtual const char *getSourceName() const; virtual const char *getSourceName() const;
virtual void setSource(DocumentSource *pSource); // errors out sinc e this must be first virtual void setSource(DocumentSource *pSource); // errors out sinc e this must be first
virtual bool coalesce(const intrusive_ptr<DocumentSource> &pNextSou rce); virtual bool coalesce(const intrusive_ptr<DocumentSource> &pNextSou rce);
virtual bool isValidInitialSource() const { return true; } virtual bool isValidInitialSource() const { return true; }
virtual Value serialize(bool explain = false) const;
// Virtuals for SplittableDocumentSource // Virtuals for SplittableDocumentSource
virtual intrusive_ptr<DocumentSource> getShardSource(); virtual intrusive_ptr<DocumentSource> getShardSource();
virtual intrusive_ptr<DocumentSource> getRouterSource(); virtual intrusive_ptr<DocumentSource> getRouterSource();
static intrusive_ptr<DocumentSource> createFromBson( static intrusive_ptr<DocumentSource> createFromBson(
BSONElement *pBsonElement, BSONElement elem,
const intrusive_ptr<ExpressionContext> &pCtx); const intrusive_ptr<ExpressionContext> &pCtx);
static char geoNearName[]; static char geoNearName[];
long long getLimit() { return limit; } long long getLimit() { return limit; }
// this should only be used for testing // this should only be used for testing
static intrusive_ptr<DocumentSourceGeoNear> create( static intrusive_ptr<DocumentSourceGeoNear> create(
const intrusive_ptr<ExpressionContext> &pCtx); const intrusive_ptr<ExpressionContext> &pCtx);
protected:
// virtuals from DocumentSource
virtual void sourceToBson(BSONObjBuilder *pBuilder, bool explain) c
onst;
private: private:
DocumentSourceGeoNear(const intrusive_ptr<ExpressionContext> &pExpC tx); DocumentSourceGeoNear(const intrusive_ptr<ExpressionContext> &pExpC tx);
void parseOptions(BSONObj options); void parseOptions(BSONObj options);
BSONObj buildGeoNearCmd() const; BSONObj buildGeoNearCmd() const;
void runCommand(); void runCommand();
// These fields describe the command to run. // These fields describe the command to run.
// coords and distanceField are required, rest are optional // coords and distanceField are required, rest are optional
BSONObj coords; // "near" option, but near is a reserved keyword on windows BSONObj coords; // "near" option, but near is a reserved keyword on windows
 End of changes. 53 change blocks. 
120 lines changed or deleted 101 lines changed or added


 dur.h   dur.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/storage/durable_mapped_file.h" #include "mongo/db/storage/durable_mapped_file.h"
namespace mongo { namespace mongo {
class NamespaceDetails; class NamespaceDetails;
skipping to change at line 40 skipping to change at line 52
namespace dur { namespace dur {
void releasedWriteLock(); void releasedWriteLock();
// a smaller limit is likely better on 32 bit // a smaller limit is likely better on 32 bit
const unsigned UncommittedBytesLimit = (sizeof(void*)==4) ? 50 * 10 24 * 1024 : 100 * 1024 * 1024; const unsigned UncommittedBytesLimit = (sizeof(void*)==4) ? 50 * 10 24 * 1024 : 100 * 1024 * 1024;
/** Call during startup so durability module can initialize /** Call during startup so durability module can initialize
Throws if fatal error Throws if fatal error
Does nothing if cmdLine.dur is false Does nothing if storageGlobalParams.dur is false
*/ */
void startup(); void startup();
class DurableInterface : boost::noncopyable { class DurableInterface : boost::noncopyable {
public: public:
virtual ~DurableInterface() { log() << "ERROR warning ~DurableI nterface not intended to be called" << endl; } virtual ~DurableInterface() { log() << "ERROR warning ~DurableI nterface not intended to be called" << endl; }
/** Declare that a file has been created /** Declare that a file has been created
Normally writes are applied only after journaling, for safe ty. But here the file Normally writes are applied only after journaling, for safe ty. But here the file
is created first, and the journal will just replay the crea tion if the create didn't is created first, and the journal will just replay the crea tion if the create didn't
 End of changes. 2 change blocks. 
1 lines changed or deleted 21 lines changed or added


 dur_commitjob.h   dur_commitjob.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/cmdline.h"
#include "mongo/db/d_concurrency.h" #include "mongo/db/d_concurrency.h"
#include "mongo/db/dur.h" #include "mongo/db/dur.h"
#include "mongo/db/durop.h" #include "mongo/db/durop.h"
#include "mongo/db/taskqueue.h" #include "mongo/db/taskqueue.h"
#include "mongo/util/alignedbuilder.h" #include "mongo/util/alignedbuilder.h"
#include "mongo/util/concurrency/synchronization.h" #include "mongo/util/concurrency/synchronization.h"
#include "mongo/util/mongoutils/hash.h" #include "mongo/util/mongoutils/hash.h"
namespace mongo { namespace mongo {
namespace dur { namespace dur {
 End of changes. 2 change blocks. 
1 lines changed or deleted 20 lines changed or added


 dur_journal.h   dur_journal.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
class AlignedBuilder; class AlignedBuilder;
namespace dur { namespace dur {
/** true if ok to cleanup journal files at termination. otherwise, files journal will be retained. /** true if ok to cleanup journal files at termination. otherwise, files journal will be retained.
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 dur_journalformat.h   dur_journalformat.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
namespace dur { namespace dur {
const unsigned Alignment = 8192; const unsigned Alignment = 8192;
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 dur_journalimpl.h   dur_journalimpl.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/dur_journalformat.h" #include "mongo/db/dur_journalformat.h"
#include "mongo/util/logfile.h" #include "mongo/util/logfile.h"
namespace mongo { namespace mongo {
namespace dur { namespace dur {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 dur_recover.h   dur_recover.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/filesystem/operations.hpp> #include <boost/filesystem/operations.hpp>
#include <list> #include <list>
#include "mongo/db/dur_journalformat.h" #include "mongo/db/dur_journalformat.h"
#include "mongo/util/concurrency/mutex.h" #include "mongo/util/concurrency/mutex.h"
#include "mongo/util/file.h" #include "mongo/util/file.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 dur_stats.h   dur_stats.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
namespace mongo { namespace mongo {
namespace dur { namespace dur {
/** journaling stats. the model here is that the commit thread is the only writer, and that reads are /** journaling stats. the model here is that the commit thread is the only writer, and that reads are
uncommon (from a serverStatus command and such). Thus, there s hould not be multicore chatter overhead. uncommon (from a serverStatus command and such). Thus, there s hould not be multicore chatter overhead.
*/ */
struct Stats { struct Stats {
Stats(); Stats();
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 durable_mapped_file.h   durable_mapped_file.h 
skipping to change at line 18 skipping to change at line 18
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/util/mmap.h" #include "mongo/util/mmap.h"
#include "mongo/util/paths.h" #include "mongo/util/paths.h"
namespace mongo { namespace mongo {
/** DurableMappedFile adds some layers atop memory mapped files - speci fically our handling of private views & such. /** DurableMappedFile adds some layers atop memory mapped files - speci fically our handling of private views & such.
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 durop.h   durop.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/dur_journalformat.h" #include "mongo/db/dur_journalformat.h"
#include "mongo/util/bufreader.h" #include "mongo/util/bufreader.h"
#include "mongo/util/paths.h" #include "mongo/util/paths.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 elapsed_tracker.h   elapsed_tracker.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/platform/cstdint.h" #include "mongo/platform/cstdint.h"
namespace mongo { namespace mongo {
/** Keep track of elapsed time. After a set amount of time, tells you t o do something. */ /** Keep track of elapsed time. After a set amount of time, tells you t o do something. */
class ElapsedTracker { class ElapsedTracker {
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 element-inl.h   element-inl.h 
skipping to change at line 92 skipping to change at line 92
} }
inline bool Element::isValueMinKey() const { inline bool Element::isValueMinKey() const {
return isType(mongo::MinKey); return isType(mongo::MinKey);
} }
inline bool Element::isValueMaxKey() const { inline bool Element::isValueMaxKey() const {
return isType(mongo::MaxKey); return isType(mongo::MaxKey);
} }
inline bool Element::ok() const {
dassert(_doc != NULL);
return _repIdx <= kMaxRepIdx;
}
inline Document& Element::getDocument() { inline Document& Element::getDocument() {
return *_doc; return *_doc;
} }
inline const Document& Element::getDocument() const { inline const Document& Element::getDocument() const {
return *_doc; return *_doc;
} }
inline bool Element::isType(BSONType type) const { inline bool Element::isType(BSONType type) const {
return (getType() == type); return (getType() == type);
} }
inline Element::RepIdx Element::getIdx() const { inline Element::RepIdx Element::getIdx() const {
return _repIdx; return _repIdx;
} }
inline Element::Element(Document* doc, RepIdx repIdx) inline Element::Element(Document* doc, RepIdx repIdx)
: _doc(doc) : _doc(doc)
, _repIdx(repIdx) {} , _repIdx(repIdx) {
dassert(_doc != NULL);
}
inline StringData Element::getValueStringOrSymbol() const { inline StringData Element::getValueStringOrSymbol() const {
const BSONElement value = getValue(); const BSONElement value = getValue();
const char* str = value.valuestr(); const char* str = value.valuestr();
const size_t size = value.valuestrsize() - 1; const size_t size = value.valuestrsize() - 1;
return StringData(str, size); return StringData(str, size);
} }
inline bool operator==(const Element& l, const Element& r) { inline bool operator==(const Element& l, const Element& r) {
return (l._doc == r._doc) && (l._repIdx == r._repIdx); return (l._doc == r._doc) && (l._repIdx == r._repIdx);
 End of changes. 2 change blocks. 
1 lines changed or deleted 8 lines changed or added


 element.h   element.h 
skipping to change at line 103 skipping to change at line 103
* API is provided that combines the effects of calling makeElement on the Document with * API is provided that combines the effects of calling makeElement on the Document with
* calling pushBack on the current Element. The effect is to create the element and make * calling pushBack on the current Element. The effect is to create the element and make
* it the new rightmost child of this Element. Use of this API is di scouraged and it may * it the new rightmost child of this Element. Use of this API is di scouraged and it may
* be removed. * be removed.
*/ */
class Element { class Element {
public: public:
typedef uint32_t RepIdx; typedef uint32_t RepIdx;
// Some special RepIdx values. These are really implementation deta
ils, but they are
// here so that we can inline Element::OK, which gets called very f
requently, and they
// need to be public so some free functions in document.cpp can use
them. You must not
// use these values explicitly.
// Used to signal an invalid Element.
static const RepIdx kInvalidRepIdx = RepIdx(-1);
// A rep that points to an unexamined entity
static const RepIdx kOpaqueRepIdx = RepIdx(-2);
// This is the highest valid rep that does not overlap flag values.
static const RepIdx kMaxRepIdx = RepIdx(-3);
// //
// Topology mutation API. Element arguments must belong to the same Document. // Topology mutation API. Element arguments must belong to the same Document.
// //
/** Add the provided Element to the left of this Element. The added Element must be /** Add the provided Element to the left of this Element. The added Element must be
* 'ok', and this Element must have a parent. * 'ok', and this Element must have a parent.
*/ */
Status addSiblingLeft(Element e); Status addSiblingLeft(Element e);
/** Add the provided Element to the right of this Element. The adde d Element must be /** Add the provided Element to the right of this Element. The adde d Element must be
skipping to change at line 421 skipping to change at line 435
/** Set the value of this Element to a numeric type appropriate to hold the given /** Set the value of this Element to a numeric type appropriate to hold the given
* SafeNum value. * SafeNum value.
*/ */
Status setValueSafeNum(const SafeNum value); Status setValueSafeNum(const SafeNum value);
// //
// Accessors // Accessors
// //
/** Returns true if this Element represents a valid part of the Doc ument. */ /** Returns true if this Element represents a valid part of the Doc ument. */
bool ok() const; inline bool ok() const;
/** Returns the Document to which this Element belongs. */ /** Returns the Document to which this Element belongs. */
inline Document& getDocument(); inline Document& getDocument();
/** Returns the Document to which this Element belongs. */ /** Returns the Document to which this Element belongs. */
inline const Document& getDocument() const; inline const Document& getDocument() const;
/** Returns the BSONType of this Element. */ /** Returns the BSONType of this Element. */
BSONType getType() const; BSONType getType() const;
skipping to change at line 529 skipping to change at line 543
Status appendMaxKey(const StringData& fieldName); Status appendMaxKey(const StringData& fieldName);
/** Append the given BSONElement. The data in 'value' is copied. */ /** Append the given BSONElement. The data in 'value' is copied. */
Status appendElement(const BSONElement& value); Status appendElement(const BSONElement& value);
/** Append the provided number as field of the appropriate numeric type with the /** Append the provided number as field of the appropriate numeric type with the
* provided name. * provided name.
*/ */
Status appendSafeNum(const StringData& fieldName, SafeNum value); Status appendSafeNum(const StringData& fieldName, SafeNum value);
/** Convert this element to its JSON representation */ /** Convert this element to its JSON representation if ok(),
* otherwise return !ok() message */
std::string toString() const; std::string toString() const;
private: private:
friend class Document; friend class Document;
friend class ConstElement; friend class ConstElement;
friend bool operator==(const Element&, const Element&); friend bool operator==(const Element&, const Element&);
inline Element(Document* doc, RepIdx repIdx); inline Element(Document* doc, RepIdx repIdx);
 End of changes. 3 change blocks. 
2 lines changed or deleted 20 lines changed or added


 emulated_cursor.h   emulated_cursor.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <set> #include <set>
#include "mongo/db/cursor.h" #include "mongo/db/cursor.h"
#include "mongo/db/index_names.h" #include "mongo/db/index_names.h"
#include "mongo/db/index/index_access_method.h" #include "mongo/db/index/index_access_method.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 engine.h   engine.h 
skipping to change at line 138 skipping to change at line 138
/** /**
* if any changes are made to .system.js, call this * if any changes are made to .system.js, call this
* right now its just global - slightly inefficient, but a lot simp ler * right now its just global - slightly inefficient, but a lot simp ler
*/ */
static void storedFuncMod(); static void storedFuncMod();
static void validateObjectIdString(const string& str); static void validateObjectIdString(const string& str);
/** increments the number of times a scope was used */ /** increments the number of times a scope was used */
void incTimeUsed() { ++_numTimeUsed; } void incTimesUsed() { ++_numTimesUsed; }
/** gets the number of times a scope was used */ /** gets the number of times a scope was used */
int getTimeUsed() { return _numTimeUsed; } int getTimesUsed() { return _numTimesUsed; }
/** return true if last invoke() return'd native code */ /** return true if last invoke() return'd native code */
virtual bool isLastRetNativeCode() { return _lastRetIsNativeCode; } virtual bool isLastRetNativeCode() { return _lastRetIsNativeCode; }
class NoDBAccess { class NoDBAccess {
Scope* _s; Scope* _s;
public: public:
NoDBAccess(Scope* s) : _s(s) { NoDBAccess(Scope* s) : _s(s) {
} }
~NoDBAccess() { ~NoDBAccess() {
skipping to change at line 171 skipping to change at line 171
friend class PooledScope; friend class PooledScope;
virtual FunctionCacheMap& getFunctionCache() { return _cachedFuncti ons; } virtual FunctionCacheMap& getFunctionCache() { return _cachedFuncti ons; }
virtual ScriptingFunction _createFunction(const char* code, virtual ScriptingFunction _createFunction(const char* code,
ScriptingFunction functio nNumber = 0) = 0; ScriptingFunction functio nNumber = 0) = 0;
string _localDBName; string _localDBName;
long long _loadedVersion; long long _loadedVersion;
set<string> _storedNames; set<string> _storedNames;
static long long _lastVersion; static long long _lastVersion;
FunctionCacheMap _cachedFunctions; FunctionCacheMap _cachedFunctions;
int _numTimeUsed; int _numTimesUsed;
bool _lastRetIsNativeCode; // v8 only: set to true if eval'd script returns a native func bool _lastRetIsNativeCode; // v8 only: set to true if eval'd script returns a native func
}; };
class ScriptEngine : boost::noncopyable { class ScriptEngine : boost::noncopyable {
public: public:
ScriptEngine(); ScriptEngine();
virtual ~ScriptEngine(); virtual ~ScriptEngine();
virtual Scope* newScope() { virtual Scope* newScope() {
return createScope(); return createScope();
} }
virtual void runTest() = 0; virtual void runTest() = 0;
virtual bool utf8Ok() const = 0; virtual bool utf8Ok() const = 0;
static void setup(); static void setup();
/** gets a scope from the pool or a new one if pool is empty /** gets a scope from the pool or a new one if pool is empty
* @param pool An identifier for the pool, usually the db name * @param db The db name
* @param scopeType A unique id to limit scope sharing.
* This must include authenticated users.
* @return the scope * @return the scope
*/ */
auto_ptr<Scope> getPooledScope(const string& pool, const string& sc auto_ptr<Scope> getPooledScope(const string& db, const string& scop
opeType); eType);
/**
* call this method to release some JS resources when a thread is d
one
*/
void threadDone();
void setScopeInitCallback(void (*func)(Scope&)) { _scopeInitCallbac k = func; } void setScopeInitCallback(void (*func)(Scope&)) { _scopeInitCallbac k = func; }
static void setConnectCallback(void (*func)(DBClientWithCommands&)) { static void setConnectCallback(void (*func)(DBClientWithCommands&)) {
_connectCallback = func; _connectCallback = func;
} }
static void runConnectCallback(DBClientWithCommands& c) { static void runConnectCallback(DBClientWithCommands& c) {
if (_connectCallback) if (_connectCallback)
_connectCallback(c); _connectCallback(c);
} }
 End of changes. 5 change blocks. 
12 lines changed or deleted 8 lines changed or added


 engine_v8.h   engine_v8.h 
skipping to change at line 435 skipping to change at line 435
v8::Persistent<v8::FunctionTemplate> _MongoFT; v8::Persistent<v8::FunctionTemplate> _MongoFT;
v8::Persistent<v8::FunctionTemplate> _DBFT; v8::Persistent<v8::FunctionTemplate> _DBFT;
v8::Persistent<v8::FunctionTemplate> _DBCollectionFT; v8::Persistent<v8::FunctionTemplate> _DBCollectionFT;
v8::Persistent<v8::FunctionTemplate> _DBQueryFT; v8::Persistent<v8::FunctionTemplate> _DBQueryFT;
v8::Persistent<v8::FunctionTemplate> _InternalCursorFT; v8::Persistent<v8::FunctionTemplate> _InternalCursorFT;
v8::Persistent<v8::FunctionTemplate> _LazyBsonFT; v8::Persistent<v8::FunctionTemplate> _LazyBsonFT;
v8::Persistent<v8::FunctionTemplate> _ROBsonFT; v8::Persistent<v8::FunctionTemplate> _ROBsonFT;
v8::Persistent<v8::Function> _jsRegExpConstructor; v8::Persistent<v8::Function> _jsRegExpConstructor;
v8::Isolate* _isolate; /// Like v8::Isolate* but calls Dispose() in destructor.
class IsolateHolder {
MONGO_DISALLOW_COPYING(IsolateHolder);
public:
IsolateHolder() :_isolate(NULL) {}
~IsolateHolder() {
if (_isolate) {
_isolate->Dispose();
_isolate = NULL;
}
}
void set(v8::Isolate* isolate) {
fassert(17184, !_isolate);
_isolate = isolate;
}
v8::Isolate* operator -> () const { return _isolate; };
operator v8::Isolate* () const { return _isolate; };
private:
v8::Isolate* _isolate;
};
IsolateHolder _isolate; // NOTE: this must be destructed before the
ObjTrackers
V8CpuProfiler _cpuProfiler; V8CpuProfiler _cpuProfiler;
// See comments in strLitToV8 // See comments in strLitToV8
typedef unordered_map<const char*, v8::Handle<v8::String> > StrLitM ap; typedef unordered_map<const char*, v8::Handle<v8::String> > StrLitM ap;
StrLitMap _strLitMap; StrLitMap _strLitMap;
mongo::mutex _interruptLock; // protects interruption-related flags mongo::mutex _interruptLock; // protects interruption-related flags
bool _inNativeExecution; // protected by _interruptLock bool _inNativeExecution; // protected by _interruptLock
bool _pendingKill; // protected by _interruptLock bool _pendingKill; // protected by _interruptLock
int _opId; // op id for this scope int _opId; // op id for this scope
 End of changes. 1 change blocks. 
1 lines changed or deleted 26 lines changed or added


 environment.h   environment.h 
skipping to change at line 23 skipping to change at line 23
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <map> #include <map>
#include <vector> #include <vector>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/jsobj.h"
#include "mongo/util/options_parser/value.h" #include "mongo/util/options_parser/value.h"
namespace mongo { namespace mongo {
namespace optionenvironment { namespace optionenvironment {
class Constraint; class Constraint;
class KeyConstraint; class KeyConstraint;
typedef std::string Key; typedef std::string Key;
skipping to change at line 120 skipping to change at line 121
*/ */
Status addKeyConstraint(KeyConstraint* keyConstraint); Status addKeyConstraint(KeyConstraint* keyConstraint);
Status addConstraint(Constraint* constraint); Status addConstraint(Constraint* constraint);
/** Add the Value to this Environment with the given Key. If " validate" has already /** Add the Value to this Environment with the given Key. If " validate" has already
* been called on this Environment, runs all Constraints on th e new Environment. If * been called on this Environment, runs all Constraints on th e new Environment. If
* any of the Constraints fail, reverts to the old Environment and returns an error * any of the Constraints fail, reverts to the old Environment and returns an error
*/ */
Status set(const Key& key, const Value& value); Status set(const Key& key, const Value& value);
/** Add a default Value to this Environment with the given Key.
Fails if validate has
* already been called on our environment. The get functions
will return the default
* if one exists and the value has not been explicitly set.
*/
Status setDefault(const Key& key, const Value& value);
/** Populate the given Value with the Value stored for the give n Key. Return a success /** Populate the given Value with the Value stored for the give n Key. Return a success
* status if the value was found, or an error status if the va lue was not found. * status if the value was found, or an error status if the va lue was not found.
* Leaves the Value unchanged on error. * Leaves the Value unchanged on error.
*/ */
Status get(const Key& key, Value* value) const; Status get(const Key& key, Value* value) const;
/** Same as the above get interface, but supports directly gett ing C++ types without the /** Same as the above get interface, but supports directly gett ing C++ types without the
* intermediate Value and has the added failure case of the va lue being the wrong type * intermediate Value and has the added failure case of the va lue being the wrong type
*/ */
template <typename T> template <typename T>
skipping to change at line 142 skipping to change at line 149
/** Runs all registered Constraints and returns the result. On success, marks this as a /** Runs all registered Constraints and returns the result. On success, marks this as a
* valid Environment so that any modifications will re run all Constraints * valid Environment so that any modifications will re run all Constraints
*/ */
Status validate(); Status validate();
/** Sets all variables in the given Environment in this Environ ment. Does not add /** Sets all variables in the given Environment in this Environ ment. Does not add
* Constraints * Constraints
*/ */
Status setAll(const Environment& other); Status setAll(const Environment& other);
/** The functions below are the legacy interface to be consiste
nt with
* boost::program_options::variables_map during the transition
period
*/
/**
* @return 1 if the given Key has a Value set in this Environm
ent and 0 if not
*/
bool count(const Key& key) const;
/**
* @return the Value for the given Key in this Environment. R
eturns an empty Value if
* Key is not set.
*/
Value operator[](const Key& key) const;
/**
* Gets the BSON representation of this Environment. This will
collapse dotted fields
* into sub objects.
*
* Example:
*
* The following Environment values map:
* "a.b.c" -> true
* "a.b.d" -> false
* "a.e.f" -> 0
* "a.e.g" -> 1
* "a.h" -> "foo"
*
* Has a BSON represation of (shown as JSON):
* { "a" : {
* "b" : {
* "c" : true,
* "d" : false
* },
* "e" : {
* "f" : 0,
* "g" : 1
* },
* "h" : "foo"
* }
* }
*
* Note that the BSON representation only includes fields that
were explicitly set using
* setAll or set, and not defaults that were specified using se
tDefault.
*/
BSONObj toBSON() const;
/* Debugging */ /* Debugging */
void dump(); void dump();
protected: protected:
std::vector<boost::shared_ptr<Constraint> > constraints; std::vector<boost::shared_ptr<Constraint> > constraints;
std::vector<boost::shared_ptr<KeyConstraint> > keyConstraints; std::vector<boost::shared_ptr<KeyConstraint> > keyConstraints;
std::map <Key, Value> values; std::map <Key, Value> values;
std::map <Key, Value> default_values;
bool valid; bool valid;
}; };
template <typename T> template <typename T>
Status Environment::get(const Key& get_key, T* get_value) const { Status Environment::get(const Key& get_key, T* get_value) const {
typedef std::map<Key, Value>::const_iterator it_type; Value value;
it_type value = values.find(get_key); Status ret = get(get_key, &value);
if (value == values.end()) { if (!ret.isOK()) {
return Status(ErrorCodes::InternalError, "Value not found!"); return ret;
} }
else { ret = value.get(get_value);
return value->second.get(get_value); if (!ret.isOK()) {
StringBuilder sb;
sb << "Error getting value for key: \"" << get_key << "\": " <<
ret.toString();
return Status(ErrorCodes::NoSuchKey, sb.str());
} }
return Status::OK();
} }
} // namespace optionenvironment } // namespace optionenvironment
} // namespace mongo } // namespace mongo
 End of changes. 7 change blocks. 
6 lines changed or deleted 75 lines changed or added


 eof_runner.h   eof_runner.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/clientcursor.h" #include <boost/scoped_ptr.hpp>
#include "mongo/db/query/canonical_query.h" #include <string>
#include "mongo/db/query/lite_parsed_query.h"
#include "mongo/db/query/plan_cache.h" #include "mongo/base/status.h"
#include "mongo/db/query/plan_executor.h"
#include "mongo/db/query/runner.h" #include "mongo/db/query/runner.h"
#include "mongo/db/query/stage_builder.h"
namespace mongo { namespace mongo {
class BSONObj;
class CanonicalQuery;
class DiskLoc;
class TypeExplain;
/** /**
* EOFRunner is EOF immediately and doesn't do anything except return E OF and possibly die * EOFRunner is EOF immediately and doesn't do anything except return E OF and possibly die
* during a yield. * during a yield.
*/ */
class EOFRunner : public Runner { class EOFRunner : public Runner {
public: public:
EOFRunner(const string& ns) : _ns(ns), _cq(CanonicalQuery::getInter nalQuery()) { }
Runner::RunnerState getNext(BSONObj* objOut, DiskLoc* dlOut) { /* Takes onwership */
return Runner::RUNNER_EOF; EOFRunner(CanonicalQuery* cq, const std::string& ns);
}
virtual ~EOFRunner();
virtual Runner::RunnerState getNext(BSONObj* objOut, DiskLoc* dlOut
);
virtual bool isEOF() { return true; } virtual bool isEOF();
virtual void saveState() { } virtual void saveState();
virtual bool restoreState() { virtual bool restoreState();
// TODO: Does this value matter?
return false;
}
virtual void setYieldPolicy(Runner::YieldPolicy policy) { } virtual void setYieldPolicy(Runner::YieldPolicy policy);
virtual void invalidate(const DiskLoc& dl) { } virtual void invalidate(const DiskLoc& dl);
virtual const string& ns() { return _ns; } virtual const std::string& ns();
virtual const CanonicalQuery& getQuery() { virtual void kill();
// This shouldn't be called and is going away shortly anyway.
verify(0);
return *_cq;
}
virtual void kill() { } /**
* Always returns OK, allocating and filling in '*explain' with a f
ake ("zeroed")
* collection scan plan. Caller owns '*explain', though.
*/
virtual Status getExplainPlan(TypeExplain** explain) const;
private: private:
string _ns; boost::scoped_ptr<CanonicalQuery> _cq;
scoped_ptr<CanonicalQuery> _cq; std::string _ns;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 15 change blocks. 
27 lines changed or deleted 51 lines changed or added


 error_codes.h   error_codes.h 
skipping to change at line 78 skipping to change at line 78
CannotBackfillArray = 34, CannotBackfillArray = 34,
UserModificationFailed = 35, UserModificationFailed = 35,
RemoteChangeDetected = 36, RemoteChangeDetected = 36,
FileRenameFailed = 37, FileRenameFailed = 37,
FileNotOpen = 38, FileNotOpen = 38,
FileStreamFailed = 39, FileStreamFailed = 39,
ConflictingUpdateOperators = 40, ConflictingUpdateOperators = 40,
FileAlreadyOpen = 41, FileAlreadyOpen = 41,
LogWriteFailed = 42, LogWriteFailed = 42,
CursorNotFound = 43, CursorNotFound = 43,
KeyNotFound = 44, UserDataInconsistent = 45,
LockBusy = 46,
NoMatchingDocument = 47,
NamespaceExists = 48,
InvalidRoleModification = 49,
ExceededTimeLimit = 50,
ManualInterventionRequired = 51,
DollarPrefixedFieldName = 52,
InvalidIdField = 53,
ImmutableIdField = 54,
InvalidDBRef = 55,
EmptyFieldName = 56,
DottedFieldName = 57,
RoleModificationFailed = 58,
CommandNotFound = 59,
DatabaseNotFound = 60,
ShardKeyNotFound = 61,
OplogOperationUnsupported = 62,
StaleShardVersion = 63,
WriteConcernFailed = 64,
MultipleErrorsOccurred = 65,
ImmutableShardKeyField = 66,
MaxError MaxError
}; };
static const char* errorString(Error err); static const char* errorString(Error err);
/** /**
* Parse an Error from its "name". Returns UnknownError if "name" is unrecognized. * Parse an Error from its "name". Returns UnknownError if "name" is unrecognized.
* *
* NOTE: Also returns UnknownError for the string "UnknownError". * NOTE: Also returns UnknownError for the string "UnknownError".
*/ */
 End of changes. 1 change blocks. 
1 lines changed or deleted 22 lines changed or added


 exception_filter_win32.h   exception_filter_win32.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
void setWindowsUnhandledExceptionFilter(); void setWindowsUnhandledExceptionFilter();
} // namespace mongo } // namespace mongo
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 expression.h   expression.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonobj.h"
#include "mongo/db/matcher/matchable.h" #include "mongo/db/matcher/matchable.h"
#include "mongo/db/matcher/match_details.h" #include "mongo/db/matcher/match_details.h"
namespace mongo { namespace mongo {
class TreeMatchExpression; class TreeMatchExpression;
skipping to change at line 51 skipping to change at line 65
// leaf types // leaf types
LTE, LT, EQ, GT, GTE, REGEX, MOD, EXISTS, MATCH_IN, NIN, LTE, LT, EQ, GT, GTE, REGEX, MOD, EXISTS, MATCH_IN, NIN,
// special types // special types
TYPE_OPERATOR, GEO, WHERE, TYPE_OPERATOR, GEO, WHERE,
// things that maybe shouldn't even be nodes // things that maybe shouldn't even be nodes
ATOMIC, ALWAYS_FALSE, ATOMIC, ALWAYS_FALSE,
// Things that we parse but cannot be answered without an index . // Things that we parse but cannot be answered without an index .
// TODO: Text goes here eventually. GEO_NEAR, TEXT,
GEO_NEAR,
}; };
MatchExpression( MatchType type ); MatchExpression( MatchType type );
virtual ~MatchExpression(){} virtual ~MatchExpression(){}
//
// Structural/AST information
//
/**
* What type is the node? See MatchType above.
*/
MatchType matchType() const { return _matchType; }
/**
* How many children does the node have? Most nodes are leaves so
the default impl. is for
* a leaf.
*/
virtual size_t numChildren() const { return 0; }
/**
* Get the i-th child.
*/
virtual MatchExpression* getChild( size_t i ) const { return NULL;
}
/**
* Get all the children of a node
*/
virtual std::vector<MatchExpression*>* getChildVector() { return NU
LL; }
/**
* Get the path of the leaf. Returns StringData() if there is no p
ath (node is logical).
*/
virtual const StringData path() const { return StringData(); }
/**
* Notes on structure:
* isLogical, isArray, and isLeaf define three partitions of all po
ssible operators.
*
* isLogical can have children and its children can be arbitrary op
erators.
*
* isArray can have children and its children are predicates over o
ne field.
*
* isLeaf is a predicate over one field.
*/
/**
* Is this node a logical operator? All of these inherit from List
OfMatchExpression.
* AND, OR, NOT, NOR.
*/
bool isLogical() const {
return AND == _matchType || OR == _matchType || NOT == _matchTy
pe || NOR == _matchType;
}
/** /**
* determins if the doc matches the expression * Is this node an array operator? Array operators have multiple c
* there could be an expression that looks at fields, or the entire lauses but operate on one
doc * field.
*
* ALL (AllElemMatchOp)
* ELEM_MATCH_VALUE, ELEM_MATCH_OBJECT, SIZE (ArrayMatchingMatchExp
ression)
*/ */
bool isArray() const {
return SIZE == _matchType || ALL == _matchType || ELEM_MATCH_VA
LUE == _matchType
|| ELEM_MATCH_OBJECT == _matchType;
}
/**
* Not-internal nodes, predicates over one field. Almost all of th
ese inherit from
* LeafMatchExpression.
*
* Exceptions: WHERE, which doesn't have a field.
* TYPE_OPERATOR, which inherits from MatchExpression d
ue to unique array
* semantics.
*/
bool isLeaf() const {
return !isArray() && !isLogical();
}
// XXX: document
virtual MatchExpression* shallowClone() const = 0;
// XXX document
virtual bool equivalent( const MatchExpression* other ) const = 0;
//
// Determine if a document satisfies the tree-predicate.
//
virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails = 0 ) const = 0; virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails = 0 ) const = 0;
virtual bool matchesBSON( const BSONObj& doc, MatchDetails* details = 0 ) const; virtual bool matchesBSON( const BSONObj& doc, MatchDetails* details = 0 ) const;
/** /**
* does the element match the expression * Determines if the element satisfies the tree-predicate.
* not valid for all expressions ($where) where this will immediate * Not valid for all expressions (e.g. $where); in those cases, ret
ly return false urns false.
*/ */
virtual bool matchesSingleElement( const BSONElement& e ) const = 0 ; virtual bool matchesSingleElement( const BSONElement& e ) const = 0 ;
virtual size_t numChildren() const { return 0; } //
virtual const MatchExpression* getChild( size_t i ) const { return // Tagging mechanism: Hang data off of the tree for retrieval later
NULL; } .
//
class TagData {
public:
virtual ~TagData() { }
virtual void debugString(StringBuilder* builder) const = 0;
virtual TagData* clone() const = 0;
};
MatchType matchType() const { return _matchType; } /**
* Takes ownership
*/
void setTag(TagData* data) { _tagData.reset(data); }
TagData* getTag() const { return _tagData.get(); }
virtual void resetTag() {
setTag(NULL);
for (size_t i = 0; i < numChildren(); ++i) {
getChild(i)->resetTag();
}
}
//
// Debug information
//
virtual string toString() const; virtual string toString() const;
virtual void debugString( StringBuilder& debug, int level = 0 ) con st = 0; virtual void debugString( StringBuilder& debug, int level = 0 ) con st = 0;
virtual bool equivalent( const MatchExpression* other ) const = 0;
protected: protected:
void _debugAddSpace( StringBuilder& debug, int level ) const; void _debugAddSpace( StringBuilder& debug, int level ) const;
private: private:
MatchType _matchType; MatchType _matchType;
boost::scoped_ptr<TagData> _tagData;
}; };
/** /**
* this isn't really an expression, but a hint to other things * this isn't really an expression, but a hint to other things
* not sure where to put it in the end * not sure where to put it in the end
*/ */
class AtomicMatchExpression : public MatchExpression { class AtomicMatchExpression : public MatchExpression {
public: public:
AtomicMatchExpression() : MatchExpression( ATOMIC ){} AtomicMatchExpression() : MatchExpression( ATOMIC ){}
virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails = 0 ) const { virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails = 0 ) const {
return true; return true;
} }
virtual bool matchesSingleElement( const BSONElement& e ) const { virtual bool matchesSingleElement( const BSONElement& e ) const {
return true; return true;
} }
virtual MatchExpression* shallowClone() const {
return new AtomicMatchExpression();
}
virtual void debugString( StringBuilder& debug, int level = 0 ) con st; virtual void debugString( StringBuilder& debug, int level = 0 ) con st;
virtual bool equivalent( const MatchExpression* other ) const { virtual bool equivalent( const MatchExpression* other ) const {
return other->matchType() == ATOMIC; return other->matchType() == ATOMIC;
} }
}; };
class FalseMatchExpression : public MatchExpression { class FalseMatchExpression : public MatchExpression {
public: public:
FalseMatchExpression() : MatchExpression( ALWAYS_FALSE ){} FalseMatchExpression() : MatchExpression( ALWAYS_FALSE ){}
virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails = 0 ) const { virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails = 0 ) const {
return false; return false;
} }
virtual bool matchesSingleElement( const BSONElement& e ) const { virtual bool matchesSingleElement( const BSONElement& e ) const {
return false; return false;
} }
virtual MatchExpression* shallowClone() const {
return new FalseMatchExpression();
}
virtual void debugString( StringBuilder& debug, int level = 0 ) con st; virtual void debugString( StringBuilder& debug, int level = 0 ) con st;
virtual bool equivalent( const MatchExpression* other ) const { virtual bool equivalent( const MatchExpression* other ) const {
return other->matchType() == ALWAYS_FALSE; return other->matchType() == ALWAYS_FALSE;
} }
}; };
} }
 End of changes. 16 change blocks. 
15 lines changed or deleted 155 lines changed or added


 expression_array.h   expression_array.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <vector> #include <vector>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonobj.h"
#include "mongo/bson/bsonmisc.h" #include "mongo/bson/bsonmisc.h"
#include "mongo/db/matcher/expression.h" #include "mongo/db/matcher/expression.h"
#include "mongo/db/matcher/expression_leaf.h" #include "mongo/db/matcher/expression_leaf.h"
namespace mongo { namespace mongo {
/**
* ALL and ELEM_MATCH inherit from this.
*/
class ArrayMatchingMatchExpression : public MatchExpression { class ArrayMatchingMatchExpression : public MatchExpression {
public: public:
ArrayMatchingMatchExpression( MatchType matchType ) : MatchExpressi on( matchType ){} ArrayMatchingMatchExpression( MatchType matchType ) : MatchExpressi on( matchType ){}
virtual ~ArrayMatchingMatchExpression(){} virtual ~ArrayMatchingMatchExpression(){}
Status initPath( const StringData& path ); Status initPath( const StringData& path );
virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails ) const; virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails ) const;
/** /**
* @param e - has to be an array. calls matchesArray with e as an array * @param e - has to be an array. calls matchesArray with e as an array
*/ */
virtual bool matchesSingleElement( const BSONElement& e ) const; virtual bool matchesSingleElement( const BSONElement& e ) const;
virtual bool matchesArray( const BSONObj& anArray, MatchDetails* de tails ) const = 0; virtual bool matchesArray( const BSONObj& anArray, MatchDetails* de tails ) const = 0;
bool equivalent( const MatchExpression* other ) const; bool equivalent( const MatchExpression* other ) const;
const StringData& path() const { return _path; } const StringData path() const { return _path; }
private: private:
StringData _path; StringData _path;
ElementPath _elementPath; ElementPath _elementPath;
}; };
class ElemMatchObjectMatchExpression : public ArrayMatchingMatchExpress ion { class ElemMatchObjectMatchExpression : public ArrayMatchingMatchExpress ion {
public: public:
ElemMatchObjectMatchExpression() : ArrayMatchingMatchExpression( EL EM_MATCH_OBJECT ){} ElemMatchObjectMatchExpression() : ArrayMatchingMatchExpression( EL EM_MATCH_OBJECT ){}
Status init( const StringData& path, const MatchExpression* sub ); Status init( const StringData& path, MatchExpression* sub );
bool matchesArray( const BSONObj& anArray, MatchDetails* details ) const; bool matchesArray( const BSONObj& anArray, MatchDetails* details ) const;
virtual ElemMatchObjectMatchExpression* shallowClone() const {
ElemMatchObjectMatchExpression* e = new ElemMatchObjectMatchExp
ression();
e->init(path(), _sub->shallowClone());
if ( getTag() ) {
e->setTag(getTag()->clone());
}
return e;
}
virtual void debugString( StringBuilder& debug, int level ) const; virtual void debugString( StringBuilder& debug, int level ) const;
virtual size_t numChildren() const { return 1; } virtual size_t numChildren() const { return 1; }
virtual const MatchExpression* getChild( size_t i ) const { return
_sub.get(); } virtual MatchExpression* getChild( size_t i ) const { return _sub.g
et(); }
private: private:
boost::scoped_ptr<const MatchExpression> _sub; boost::scoped_ptr<MatchExpression> _sub;
}; };
class ElemMatchValueMatchExpression : public ArrayMatchingMatchExpressi on { class ElemMatchValueMatchExpression : public ArrayMatchingMatchExpressi on {
public: public:
ElemMatchValueMatchExpression() : ArrayMatchingMatchExpression( ELE M_MATCH_VALUE ){} ElemMatchValueMatchExpression() : ArrayMatchingMatchExpression( ELE M_MATCH_VALUE ){}
virtual ~ElemMatchValueMatchExpression(); virtual ~ElemMatchValueMatchExpression();
Status init( const StringData& path ); Status init( const StringData& path );
Status init( const StringData& path, const MatchExpression* sub ); Status init( const StringData& path, MatchExpression* sub );
void add( const MatchExpression* sub ); void add( MatchExpression* sub );
bool matchesArray( const BSONObj& anArray, MatchDetails* details ) const; bool matchesArray( const BSONObj& anArray, MatchDetails* details ) const;
virtual ElemMatchValueMatchExpression* shallowClone() const {
ElemMatchValueMatchExpression* e = new ElemMatchValueMatchExpre
ssion();
e->init(path());
for (size_t i = 0; i < _subs.size(); ++i) {
e->add(_subs[i]->shallowClone());
}
if ( getTag() ) {
e->setTag(getTag()->clone());
}
return e;
}
virtual void debugString( StringBuilder& debug, int level ) const; virtual void debugString( StringBuilder& debug, int level ) const;
virtual size_t numChildren() const { return _subs.size(); } virtual size_t numChildren() const { return _subs.size(); }
virtual const MatchExpression* getChild( size_t i ) const { return
_subs[i]; } virtual MatchExpression* getChild( size_t i ) const { return _subs[
i]; }
private: private:
bool _arrayElementMatchesAll( const BSONElement& e ) const; bool _arrayElementMatchesAll( const BSONElement& e ) const;
std::vector< const MatchExpression* > _subs; std::vector<MatchExpression*> _subs;
};
class SizeMatchExpression : public ArrayMatchingMatchExpression {
public:
SizeMatchExpression() : ArrayMatchingMatchExpression( SIZE ){}
Status init( const StringData& path, int size );
virtual SizeMatchExpression* shallowClone() const {
SizeMatchExpression* e = new SizeMatchExpression();
e->init(path(), _size);
if ( getTag() ) {
e->setTag(getTag()->clone());
}
return e;
}
virtual bool matchesArray( const BSONObj& anArray, MatchDetails* de
tails ) const;
virtual void debugString( StringBuilder& debug, int level ) const;
virtual bool equivalent( const MatchExpression* other ) const;
int getData() const { return _size; }
private:
int _size; // >= 0 real, < 0, nothing will match
}; };
/** /**
* i'm suprised this isn't a regular AllMatchExpression * i'm suprised this isn't a regular AllMatchExpression
*/ */
class AllElemMatchOp : public MatchExpression { class AllElemMatchOp : public MatchExpression {
public: public:
AllElemMatchOp() : MatchExpression( ALL ){} AllElemMatchOp() : MatchExpression( ALL ){}
virtual ~AllElemMatchOp(); virtual ~AllElemMatchOp();
Status init( const StringData& path ); Status init( const StringData& path );
void add( const ArrayMatchingMatchExpression* expr ); void add( ArrayMatchingMatchExpression* expr );
virtual MatchExpression* shallowClone() const {
AllElemMatchOp* e = new AllElemMatchOp();
e->init(path());
for (size_t i = 0; i < _list.size(); ++i) {
e->add(reinterpret_cast<ArrayMatchingMatchExpression*>(
_list[i]->shallowClone()));
}
if ( getTag() ) {
e->setTag(getTag()->clone());
}
return e;
}
virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails ) const; virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails ) const;
/** /**
* @param e has to be an array * @param e has to be an array
*/ */
virtual bool matchesSingleElement( const BSONElement& e ) const; virtual bool matchesSingleElement( const BSONElement& e ) const;
virtual void debugString( StringBuilder& debug, int level ) const; virtual void debugString( StringBuilder& debug, int level ) const;
virtual bool equivalent( const MatchExpression* other ) const; virtual bool equivalent( const MatchExpression* other ) const;
virtual size_t numChildren() const { return _list.size(); } virtual size_t numChildren() const { return _list.size(); }
virtual const ArrayMatchingMatchExpression* getChild( size_t i ) co nst { return _list[i]; }
const StringData& path() const { return _path; } virtual MatchExpression* getChild( size_t i ) const { return _list[
i]; }
virtual std::vector<MatchExpression*>* getChildVector() { return &_
list; }
const StringData path() const { return _path; }
private: private:
bool _allMatch( const BSONObj& anArray ) const; bool _allMatch( const BSONObj& anArray ) const;
StringData _path; StringData _path;
ElementPath _elementPath; ElementPath _elementPath;
std::vector< const ArrayMatchingMatchExpression* > _list; std::vector<MatchExpression*> _list;
};
class SizeMatchExpression : public ArrayMatchingMatchExpression {
public:
SizeMatchExpression() : ArrayMatchingMatchExpression( SIZE ){}
Status init( const StringData& path, int size );
virtual bool matchesArray( const BSONObj& anArray, MatchDetails* de
tails ) const;
virtual void debugString( StringBuilder& debug, int level ) const;
virtual bool equivalent( const MatchExpression* other ) const;
int getData() const { return _size; }
private:
int _size; // >= 0 real, < 0, nothing will match
}; };
} }
 End of changes. 15 change blocks. 
32 lines changed or deleted 108 lines changed or added


 expression_context.h   expression_context.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link th
e
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the GNU Affero General Public License in all respects f
or
* all of the code used other than as permitted herein. If you modify file(
s)
* with this exception, you may extend this exception to your version of th
e
* file(s), but you are not obligated to do so. If you do not wish to do so
,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also dele
te
* it in the license file.
*/ */
#pragma once #pragma once
#include <string>
#include "mongo/db/interrupt_status.h" #include "mongo/db/interrupt_status.h"
#include "mongo/db/namespace_string.h" #include "mongo/db/namespace_string.h"
#include "mongo/util/intrusive_counter.h" #include "mongo/util/intrusive_counter.h"
namespace mongo { namespace mongo {
struct ExpressionContext : public IntrusiveCounterUnsigned { struct ExpressionContext : public IntrusiveCounterUnsigned {
public: public:
ExpressionContext(const InterruptStatus& status, const NamespaceStr ing& ns) ExpressionContext(const InterruptStatus& status, const NamespaceStr ing& ns)
: inShard(false) : inShard(false)
skipping to change at line 47 skipping to change at line 61
void checkForInterrupt() { void checkForInterrupt() {
// The check could be expensive, at least in relative terms. // The check could be expensive, at least in relative terms.
RARELY interruptStatus.checkForInterrupt(); RARELY interruptStatus.checkForInterrupt();
} }
bool inShard; bool inShard;
bool inRouter; bool inRouter;
bool extSortAllowed; bool extSortAllowed;
const InterruptStatus& interruptStatus; const InterruptStatus& interruptStatus;
NamespaceString ns; NamespaceString ns;
std::string tempDir; // Defaults to empty to prevent external sorti ng in mongos.
}; };
} }
 End of changes. 3 change blocks. 
0 lines changed or deleted 21 lines changed or added


 expression_geo.h   expression_geo.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/geo/geonear.h" #include "mongo/db/geo/geonear.h"
#include "mongo/db/geo/geoquery.h" #include "mongo/db/geo/geoquery.h"
#include "mongo/db/matcher/expression.h" #include "mongo/db/matcher/expression.h"
#include "mongo/db/matcher/expression_leaf.h" #include "mongo/db/matcher/expression_leaf.h"
namespace mongo { namespace mongo {
class GeoMatchExpression : public LeafMatchExpression { class GeoMatchExpression : public LeafMatchExpression {
public: public:
GeoMatchExpression() : LeafMatchExpression( GEO ){} GeoMatchExpression() : LeafMatchExpression( GEO ){}
virtual ~GeoMatchExpression(){} virtual ~GeoMatchExpression(){}
Status init( const StringData& path, const GeoQuery& query ); Status init( const StringData& path, const GeoQuery& query, const B SONObj& rawObj );
virtual bool matchesSingleElement( const BSONElement& e ) const; virtual bool matchesSingleElement( const BSONElement& e ) const;
virtual void debugString( StringBuilder& debug, int level = 0 ) con st; virtual void debugString( StringBuilder& debug, int level = 0 ) con st;
virtual bool equivalent( const MatchExpression* other ) const; virtual bool equivalent( const MatchExpression* other ) const;
virtual LeafMatchExpression* shallowClone() const; virtual LeafMatchExpression* shallowClone() const;
const GeoQuery& getGeoQuery() const { return _query; }
const BSONObj getRawObj() const { return _rawObj; }
private: private:
BSONObj _rawObj;
GeoQuery _query; GeoQuery _query;
}; };
class GeoNearMatchExpression : public LeafMatchExpression { class GeoNearMatchExpression : public LeafMatchExpression {
public: public:
GeoNearMatchExpression() : LeafMatchExpression( GEO_NEAR ){} GeoNearMatchExpression() : LeafMatchExpression( GEO_NEAR ){}
virtual ~GeoNearMatchExpression(){} virtual ~GeoNearMatchExpression(){}
Status init( const StringData& path, const NearQuery& query ); Status init( const StringData& path, const NearQuery& query, const BSONObj& rawObj );
// This shouldn't be called and as such will crash. GeoNear always requires an index. // This shouldn't be called and as such will crash. GeoNear always requires an index.
virtual bool matchesSingleElement( const BSONElement& e ) const; virtual bool matchesSingleElement( const BSONElement& e ) const;
virtual void debugString( StringBuilder& debug, int level = 0 ) con st; virtual void debugString( StringBuilder& debug, int level = 0 ) con st;
virtual bool equivalent( const MatchExpression* other ) const; virtual bool equivalent( const MatchExpression* other ) const;
virtual LeafMatchExpression* shallowClone() const; virtual LeafMatchExpression* shallowClone() const;
const NearQuery& getData() const { return _query; } const NearQuery& getData() const { return _query; }
const BSONObj getRawObj() const { return _rawObj; }
private: private:
NearQuery _query; NearQuery _query;
BSONObj _rawObj;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 7 change blocks. 
2 lines changed or deleted 28 lines changed or added


 expression_leaf.h   expression_leaf.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <pcrecpp.h> #include <pcrecpp.h>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonobj.h"
#include "mongo/bson/bsonmisc.h" #include "mongo/bson/bsonmisc.h"
#include "mongo/db/matcher/expression.h" #include "mongo/db/matcher/expression.h"
namespace mongo { namespace mongo {
/**
* This file contains leaves in the parse tree that are not array-based
.
*
* LeafMatchExpression: REGEX MOD EXISTS MATCH_IN
* ComparisonMatchExpression: EQ LTE LT GT GTE
* MatchExpression: TYPE_OPERATOR
*/
/**
* Many operators subclass from this:
* REGEX, MOD, EXISTS, IN
* Everything that inherits from ComparisonMatchExpression.
*/
class LeafMatchExpression : public MatchExpression { class LeafMatchExpression : public MatchExpression {
public: public:
LeafMatchExpression( MatchType matchType ) LeafMatchExpression( MatchType matchType )
: MatchExpression( matchType ) { : MatchExpression( matchType ) {
} }
virtual ~LeafMatchExpression(){} virtual ~LeafMatchExpression(){}
virtual LeafMatchExpression* shallowClone() const = 0;
virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails = 0 ) const; virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails = 0 ) const;
virtual bool matchesSingleElement( const BSONElement& e ) const = 0 ; virtual bool matchesSingleElement( const BSONElement& e ) const = 0 ;
const StringData path() const { return _path; } virtual const StringData path() const { return _path; }
protected: protected:
Status initPath( const StringData& path ); Status initPath( const StringData& path );
private: private:
StringData _path; StringData _path;
ElementPath _elementPath; ElementPath _elementPath;
}; };
// ----- /**
* EQ, LTE, LT, GT, GTE subclass from ComparisonMatchExpression.
*/
class ComparisonMatchExpression : public LeafMatchExpression { class ComparisonMatchExpression : public LeafMatchExpression {
public: public:
ComparisonMatchExpression( MatchType type ) : LeafMatchExpression( type ){} ComparisonMatchExpression( MatchType type ) : LeafMatchExpression( type ){}
Status init( const StringData& path, const BSONElement& rhs ); Status init( const StringData& path, const BSONElement& rhs );
virtual ~ComparisonMatchExpression(){} virtual ~ComparisonMatchExpression(){}
virtual bool matchesSingleElement( const BSONElement& e ) const; virtual bool matchesSingleElement( const BSONElement& e ) const;
skipping to change at line 79 skipping to change at line 103
virtual void debugString( StringBuilder& debug, int level = 0 ) con st; virtual void debugString( StringBuilder& debug, int level = 0 ) con st;
virtual bool equivalent( const MatchExpression* other ) const; virtual bool equivalent( const MatchExpression* other ) const;
const BSONElement& getData() const { return _rhs; } const BSONElement& getData() const { return _rhs; }
protected: protected:
BSONElement _rhs; BSONElement _rhs;
}; };
//
// ComparisonMatchExpression inheritors
//
class EqualityMatchExpression : public ComparisonMatchExpression { class EqualityMatchExpression : public ComparisonMatchExpression {
public: public:
EqualityMatchExpression() : ComparisonMatchExpression( EQ ){} EqualityMatchExpression() : ComparisonMatchExpression( EQ ){}
virtual LeafMatchExpression* shallowClone() const { virtual LeafMatchExpression* shallowClone() const {
ComparisonMatchExpression* e = new EqualityMatchExpression(); ComparisonMatchExpression* e = new EqualityMatchExpression();
e->init( path(), _rhs ); e->init( path(), _rhs );
if ( getTag() ) {
e->setTag(getTag()->clone());
}
return e; return e;
} }
}; };
class LTEMatchExpression : public ComparisonMatchExpression { class LTEMatchExpression : public ComparisonMatchExpression {
public: public:
LTEMatchExpression() : ComparisonMatchExpression( LTE ){} LTEMatchExpression() : ComparisonMatchExpression( LTE ){}
virtual LeafMatchExpression* shallowClone() const { virtual LeafMatchExpression* shallowClone() const {
ComparisonMatchExpression* e = new LTEMatchExpression(); ComparisonMatchExpression* e = new LTEMatchExpression();
e->init( path(), _rhs ); e->init( path(), _rhs );
if ( getTag() ) {
e->setTag(getTag()->clone());
}
return e; return e;
} }
}; };
class LTMatchExpression : public ComparisonMatchExpression { class LTMatchExpression : public ComparisonMatchExpression {
public: public:
LTMatchExpression() : ComparisonMatchExpression( LT ){} LTMatchExpression() : ComparisonMatchExpression( LT ){}
virtual LeafMatchExpression* shallowClone() const { virtual LeafMatchExpression* shallowClone() const {
ComparisonMatchExpression* e = new LTMatchExpression(); ComparisonMatchExpression* e = new LTMatchExpression();
e->init( path(), _rhs ); e->init( path(), _rhs );
if ( getTag() ) {
e->setTag(getTag()->clone());
}
return e; return e;
} }
}; };
class GTMatchExpression : public ComparisonMatchExpression { class GTMatchExpression : public ComparisonMatchExpression {
public: public:
GTMatchExpression() : ComparisonMatchExpression( GT ){} GTMatchExpression() : ComparisonMatchExpression( GT ){}
virtual LeafMatchExpression* shallowClone() const { virtual LeafMatchExpression* shallowClone() const {
ComparisonMatchExpression* e = new GTMatchExpression(); ComparisonMatchExpression* e = new GTMatchExpression();
e->init( path(), _rhs ); e->init( path(), _rhs );
if ( getTag() ) {
e->setTag(getTag()->clone());
}
return e; return e;
} }
}; };
class GTEMatchExpression : public ComparisonMatchExpression { class GTEMatchExpression : public ComparisonMatchExpression {
public: public:
GTEMatchExpression() : ComparisonMatchExpression( GTE ){} GTEMatchExpression() : ComparisonMatchExpression( GTE ){}
virtual LeafMatchExpression* shallowClone() const { virtual LeafMatchExpression* shallowClone() const {
ComparisonMatchExpression* e = new GTEMatchExpression(); ComparisonMatchExpression* e = new GTEMatchExpression();
e->init( path(), _rhs ); e->init( path(), _rhs );
if ( getTag() ) {
e->setTag(getTag()->clone());
}
return e; return e;
} }
}; };
//
// LeafMatchExpression inheritors
//
class RegexMatchExpression : public LeafMatchExpression { class RegexMatchExpression : public LeafMatchExpression {
public: public:
/** /**
* Maximum pattern size which pcre v8.3 can do matches correctly wi th * Maximum pattern size which pcre v8.3 can do matches correctly wi th
* LINK_SIZE define macro set to 2 @ pcre's config.h (based on * LINK_SIZE define macro set to 2 @ pcre's config.h (based on
* experiments) * experiments)
*/ */
static const size_t MaxPatternSize = 32764; static const size_t MaxPatternSize = 32764;
RegexMatchExpression() : LeafMatchExpression( REGEX ){} RegexMatchExpression() : LeafMatchExpression( REGEX ){}
Status init( const StringData& path, const StringData& regex, const StringData& options ); Status init( const StringData& path, const StringData& regex, const StringData& options );
Status init( const StringData& path, const BSONElement& e ); Status init( const StringData& path, const BSONElement& e );
virtual LeafMatchExpression* shallowClone() const { virtual LeafMatchExpression* shallowClone() const {
RegexMatchExpression* e = new RegexMatchExpression(); RegexMatchExpression* e = new RegexMatchExpression();
e->init( path(), _regex, _flags ); e->init( path(), _regex, _flags );
if ( getTag() ) {
e->setTag(getTag()->clone());
}
return e; return e;
} }
virtual bool matchesSingleElement( const BSONElement& e ) const; virtual bool matchesSingleElement( const BSONElement& e ) const;
virtual void debugString( StringBuilder& debug, int level ) const; virtual void debugString( StringBuilder& debug, int level ) const;
virtual bool equivalent( const MatchExpression* other ) const; virtual bool equivalent( const MatchExpression* other ) const;
const string& getString() const { return _regex; } const string& getString() const { return _regex; }
skipping to change at line 177 skipping to change at line 227
class ModMatchExpression : public LeafMatchExpression { class ModMatchExpression : public LeafMatchExpression {
public: public:
ModMatchExpression() : LeafMatchExpression( MOD ){} ModMatchExpression() : LeafMatchExpression( MOD ){}
Status init( const StringData& path, int divisor, int remainder ); Status init( const StringData& path, int divisor, int remainder );
virtual LeafMatchExpression* shallowClone() const { virtual LeafMatchExpression* shallowClone() const {
ModMatchExpression* m = new ModMatchExpression(); ModMatchExpression* m = new ModMatchExpression();
m->init( path(), _divisor, _remainder ); m->init( path(), _divisor, _remainder );
if ( getTag() ) {
m->setTag(getTag()->clone());
}
return m; return m;
} }
virtual bool matchesSingleElement( const BSONElement& e ) const; virtual bool matchesSingleElement( const BSONElement& e ) const;
virtual void debugString( StringBuilder& debug, int level ) const; virtual void debugString( StringBuilder& debug, int level ) const;
virtual bool equivalent( const MatchExpression* other ) const; virtual bool equivalent( const MatchExpression* other ) const;
int getDivisor() const { return _divisor; } int getDivisor() const { return _divisor; }
skipping to change at line 203 skipping to change at line 256
class ExistsMatchExpression : public LeafMatchExpression { class ExistsMatchExpression : public LeafMatchExpression {
public: public:
ExistsMatchExpression() : LeafMatchExpression( EXISTS ){} ExistsMatchExpression() : LeafMatchExpression( EXISTS ){}
Status init( const StringData& path ); Status init( const StringData& path );
virtual LeafMatchExpression* shallowClone() const { virtual LeafMatchExpression* shallowClone() const {
ExistsMatchExpression* e = new ExistsMatchExpression(); ExistsMatchExpression* e = new ExistsMatchExpression();
e->init( path() ); e->init( path() );
if ( getTag() ) {
e->setTag(getTag()->clone());
}
return e; return e;
} }
virtual bool matchesSingleElement( const BSONElement& e ) const; virtual bool matchesSingleElement( const BSONElement& e ) const;
virtual void debugString( StringBuilder& debug, int level ) const; virtual void debugString( StringBuilder& debug, int level ) const;
virtual bool equivalent( const MatchExpression* other ) const; virtual bool equivalent( const MatchExpression* other ) const;
}; };
class TypeMatchExpression : public MatchExpression {
public:
TypeMatchExpression() : MatchExpression( TYPE_OPERATOR ){}
Status init( const StringData& path, int type );
virtual bool matchesSingleElement( const BSONElement& e ) const;
virtual bool matches( const MatchableDocument* doc, MatchDetails* d
etails = 0 ) const;
virtual void debugString( StringBuilder& debug, int level ) const;
virtual bool equivalent( const MatchExpression* other ) const;
int getType() const { return _type; }
private:
bool _matches( const StringData& path,
const MatchableDocument* doc,
MatchDetails* details = 0 ) const;
StringData _path;
ElementPath _elementPath;
int _type;
};
/** /**
* INTERNAL * INTERNAL
* terrible name * terrible name
* holds the entries of an $in or $all * holds the entries of an $in or $all
* either scalars or regex * either scalars or regex
*/ */
class ArrayFilterEntries { class ArrayFilterEntries {
MONGO_DISALLOW_COPYING( ArrayFilterEntries ); MONGO_DISALLOW_COPYING( ArrayFilterEntries );
public: public:
ArrayFilterEntries(); ArrayFilterEntries();
skipping to change at line 303 skipping to change at line 333
void copyTo( InMatchExpression* toFillIn ) const; void copyTo( InMatchExpression* toFillIn ) const;
const ArrayFilterEntries& getData() const { return _arrayEntries; } const ArrayFilterEntries& getData() const { return _arrayEntries; }
private: private:
bool _matchesRealElement( const BSONElement& e ) const; bool _matchesRealElement( const BSONElement& e ) const;
ArrayFilterEntries _arrayEntries; ArrayFilterEntries _arrayEntries;
}; };
} //
// The odd duck out, TYPE_OPERATOR.
//
/**
* Type has some odd semantics with arrays and as such it can't inherit
from
* LeafMatchExpression.
*/
class TypeMatchExpression : public MatchExpression {
public:
TypeMatchExpression() : MatchExpression( TYPE_OPERATOR ){}
Status init( const StringData& path, int type );
virtual MatchExpression* shallowClone() const {
TypeMatchExpression* e = new TypeMatchExpression();
e->init(_path, _type);
if ( getTag() ) {
e->setTag(getTag()->clone());
}
return e;
}
virtual bool matchesSingleElement( const BSONElement& e ) const;
virtual bool matches( const MatchableDocument* doc, MatchDetails* d
etails = 0 ) const;
virtual void debugString( StringBuilder& debug, int level ) const;
virtual bool equivalent( const MatchExpression* other ) const;
/**
* What is the type we're matching against?
*/
int getData() const { return _type; }
virtual const StringData path() const { return _path; }
private:
bool _matches( const StringData& path,
const MatchableDocument* doc,
MatchDetails* details = 0 ) const;
StringData _path;
ElementPath _elementPath;
int _type;
};
} // namespace mongo
 End of changes. 17 change blocks. 
32 lines changed or deleted 70 lines changed or added


 expression_parser.h   expression_parser.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/function.hpp> #include <boost/function.hpp>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/base/status_with.h" #include "mongo/base/status_with.h"
#include "mongo/db/matcher/expression.h" #include "mongo/db/matcher/expression.h"
#include "mongo/db/matcher/expression_leaf.h" #include "mongo/db/matcher/expression_leaf.h"
skipping to change at line 113 skipping to change at line 125
static StatusWithMatchExpression _parseNot( const char* name, const BSONElement& e ); static StatusWithMatchExpression _parseNot( const char* name, const BSONElement& e );
}; };
typedef boost::function<StatusWithMatchExpression(const char* name, int type, const BSONObj& section)> MatchExpressionParserGeoCallback; typedef boost::function<StatusWithMatchExpression(const char* name, int type, const BSONObj& section)> MatchExpressionParserGeoCallback;
extern MatchExpressionParserGeoCallback expressionParserGeoCallback; extern MatchExpressionParserGeoCallback expressionParserGeoCallback;
typedef boost::function<StatusWithMatchExpression(const BSONElement& wh ere)> MatchExpressionParserWhereCallback; typedef boost::function<StatusWithMatchExpression(const BSONElement& wh ere)> MatchExpressionParserWhereCallback;
extern MatchExpressionParserWhereCallback expressionParserWhereCallback ; extern MatchExpressionParserWhereCallback expressionParserWhereCallback ;
typedef boost::function<StatusWithMatchExpression(const BSONObj& queryO
bj)> MatchExpressionParserTextCallback;
extern MatchExpressionParserTextCallback expressionParserTextCallback;
} }
 End of changes. 2 change blocks. 
0 lines changed or deleted 24 lines changed or added


 expression_tree.h   expression_tree.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/matcher/expression.h" #include "mongo/db/matcher/expression.h"
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
/** /**
* this contains all Expessions that define the structure of the tree * this contains all Expessions that define the structure of the tree
skipping to change at line 48 skipping to change at line 60
*/ */
void add( MatchExpression* e ); void add( MatchExpression* e );
/** /**
* clears all the thingsd we own, and does NOT delete * clears all the thingsd we own, and does NOT delete
* someone else has taken ownership * someone else has taken ownership
*/ */
void clearAndRelease() { _expressions.clear(); } void clearAndRelease() { _expressions.clear(); }
virtual size_t numChildren() const { return _expressions.size(); } virtual size_t numChildren() const { return _expressions.size(); }
virtual const MatchExpression* getChild( size_t i ) const { return
_expressions[i]; } virtual MatchExpression* getChild( size_t i ) const { return _expre
ssions[i]; }
virtual std::vector<MatchExpression*>* getChildVector() { return &_
expressions; }
bool equivalent( const MatchExpression* other ) const; bool equivalent( const MatchExpression* other ) const;
protected: protected:
void _debugList( StringBuilder& debug, int level ) const; void _debugList( StringBuilder& debug, int level ) const;
private: private:
std::vector< MatchExpression* > _expressions; std::vector< MatchExpression* > _expressions;
}; };
class AndMatchExpression : public ListOfMatchExpression { class AndMatchExpression : public ListOfMatchExpression {
public: public:
AndMatchExpression() : ListOfMatchExpression( AND ){} AndMatchExpression() : ListOfMatchExpression( AND ){}
virtual ~AndMatchExpression(){} virtual ~AndMatchExpression(){}
virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails = 0 ) const; virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails = 0 ) const;
virtual bool matchesSingleElement( const BSONElement& e ) const; virtual bool matchesSingleElement( const BSONElement& e ) const;
virtual MatchExpression* shallowClone() const {
AndMatchExpression* self = new AndMatchExpression();
for (size_t i = 0; i < numChildren(); ++i) {
self->add(getChild(i)->shallowClone());
}
if ( getTag() ) {
self->setTag(getTag()->clone());
}
return self;
}
virtual void debugString( StringBuilder& debug, int level = 0 ) con st; virtual void debugString( StringBuilder& debug, int level = 0 ) con st;
}; };
class OrMatchExpression : public ListOfMatchExpression { class OrMatchExpression : public ListOfMatchExpression {
public: public:
OrMatchExpression() : ListOfMatchExpression( OR ){} OrMatchExpression() : ListOfMatchExpression( OR ){}
virtual ~OrMatchExpression(){} virtual ~OrMatchExpression(){}
virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails = 0 ) const; virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails = 0 ) const;
virtual bool matchesSingleElement( const BSONElement& e ) const; virtual bool matchesSingleElement( const BSONElement& e ) const;
virtual MatchExpression* shallowClone() const {
OrMatchExpression* self = new OrMatchExpression();
for (size_t i = 0; i < numChildren(); ++i) {
self->add(getChild(i)->shallowClone());
}
if ( getTag() ) {
self->setTag(getTag()->clone());
}
return self;
}
virtual void debugString( StringBuilder& debug, int level = 0 ) con st; virtual void debugString( StringBuilder& debug, int level = 0 ) con st;
}; };
class NorMatchExpression : public ListOfMatchExpression { class NorMatchExpression : public ListOfMatchExpression {
public: public:
NorMatchExpression() : ListOfMatchExpression( NOR ){} NorMatchExpression() : ListOfMatchExpression( NOR ){}
virtual ~NorMatchExpression(){} virtual ~NorMatchExpression(){}
virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails = 0 ) const; virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails = 0 ) const;
virtual bool matchesSingleElement( const BSONElement& e ) const; virtual bool matchesSingleElement( const BSONElement& e ) const;
virtual MatchExpression* shallowClone() const {
NorMatchExpression* self = new NorMatchExpression();
for (size_t i = 0; i < numChildren(); ++i) {
self->add(getChild(i)->shallowClone());
}
if ( getTag() ) {
self->setTag(getTag()->clone());
}
return self;
}
virtual void debugString( StringBuilder& debug, int level = 0 ) con st; virtual void debugString( StringBuilder& debug, int level = 0 ) con st;
}; };
class NotMatchExpression : public MatchExpression { class NotMatchExpression : public MatchExpression {
public: public:
NotMatchExpression() : MatchExpression( NOT ){} NotMatchExpression() : MatchExpression( NOT ){}
NotMatchExpression( MatchExpression* e ) : MatchExpression( NOT ), _exp( e ){} NotMatchExpression( MatchExpression* e ) : MatchExpression( NOT ), _exp( e ){}
/** /**
* @param exp - I own it, and will delete * @param exp - I own it, and will delete
*/ */
virtual Status init( MatchExpression* exp ) { virtual Status init( MatchExpression* exp ) {
_exp.reset( exp ); _exp.reset( exp );
return Status::OK(); return Status::OK();
} }
virtual MatchExpression* shallowClone() const {
NotMatchExpression* self = new NotMatchExpression();
MatchExpression* child = _exp->shallowClone();
self->init(child);
if ( getTag() ) {
self->setTag(getTag()->clone());
}
return self;
}
virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails = 0 ) const { virtual bool matches( const MatchableDocument* doc, MatchDetails* d etails = 0 ) const {
return !_exp->matches( doc, NULL ); return !_exp->matches( doc, NULL );
} }
virtual bool matchesSingleElement( const BSONElement& e ) const { virtual bool matchesSingleElement( const BSONElement& e ) const {
return !_exp->matchesSingleElement( e ); return !_exp->matchesSingleElement( e );
} }
virtual void debugString( StringBuilder& debug, int level = 0 ) con st; virtual void debugString( StringBuilder& debug, int level = 0 ) con st;
bool equivalent( const MatchExpression* other ) const; bool equivalent( const MatchExpression* other ) const;
virtual size_t numChildren() const { return 1; } virtual size_t numChildren() const { return 1; }
virtual MatchExpression* getChild( size_t i ) const { return _exp.g et(); } virtual MatchExpression* getChild( size_t i ) const { return _exp.g et(); }
private: private:
boost::scoped_ptr<MatchExpression> _exp; boost::scoped_ptr<MatchExpression> _exp;
}; };
} }
 End of changes. 7 change blocks. 
2 lines changed or deleted 70 lines changed or added


 extent.h   extent.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/storage/namespace.h" #include "mongo/db/storage/namespace.h"
namespace mongo { namespace mongo {
/* extents are datafile regions where all the records within the region /* extents are datafile regions where all the records within the region
skipping to change at line 65 skipping to change at line 77
void dump(iostream& s); void dump(iostream& s);
/* assumes already zeroed -- insufficient for block 'reuse' perhaps /* assumes already zeroed -- insufficient for block 'reuse' perhaps
Returns a DeletedRecord location which is the data in the extent re ady for us. Returns a DeletedRecord location which is the data in the extent re ady for us.
Caller will need to add that to the freelist structure in namespace detail. Caller will need to add that to the freelist structure in namespace detail.
*/ */
DiskLoc init(const char *nsname, int _length, int _fileNo, int _off set, bool capped); DiskLoc init(const char *nsname, int _length, int _fileNo, int _off set, bool capped);
/* like init(), but for a reuse case */ /* like init(), but for a reuse case */
DiskLoc reuse(const char *nsname, bool newUseIsAsCapped); DiskLoc reuse(const StringData& nsname, bool newUseIsAsCapped);
bool isOk() const { return magic == extentSignature; } bool isOk() const { return magic == extentSignature; }
void assertOk() const { verify(isOk()); } void assertOk() const { verify(isOk()); }
Record* getRecord(DiskLoc dl) { Record* getRecord(DiskLoc dl) {
verify( !dl.isNull() ); verify( !dl.isNull() );
verify( dl.sameFile(myLoc) ); verify( dl.sameFile(myLoc) );
int x = dl.getOfs() - myLoc.getOfs(); int x = dl.getOfs() - myLoc.getOfs();
verify( x > 0 ); verify( x > 0 );
return (Record *) (((char *) this) + x); return (Record *) (((char *) this) + x);
skipping to change at line 106 skipping to change at line 118
DiskLoc lastRecord; DiskLoc lastRecord;
}; };
/** often we want to update just the firstRecord and lastRecord fie lds. /** often we want to update just the firstRecord and lastRecord fie lds.
this helper is for that -- for use with getDur().writing() meth od this helper is for that -- for use with getDur().writing() meth od
*/ */
FL* fl() { return (FL*) &firstRecord; } FL* fl() { return (FL*) &firstRecord; }
/** caller must declare write intent first */ /** caller must declare write intent first */
void markEmpty(); void markEmpty();
private: private:
DiskLoc _reuse(const char *nsname, bool newUseIsAsCapped); // recyc le an extent and reuse it for a different ns DiskLoc _reuse(const StringData& nsname, bool newUseIsAsCapped); // recycle an extent and reuse it for a different ns
}; };
#pragma pack() #pragma pack()
} }
 End of changes. 3 change blocks. 
2 lines changed or deleted 22 lines changed or added


 extent_manager.h   extent_manager.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include <vector> #include <vector>
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
namespace mongo { namespace mongo {
class DataFile; class DataFile;
class NamespaceDetails;
/** /**
* ExtentManager basics * ExtentManager basics
* - one per database * - one per database
* - responsible for managing <db>.# files * - responsible for managing <db>.# files
* - NOT responsible for .ns file * - NOT responsible for .ns file
* - gives out extents * - gives out extents
* - responsible for figuring out how to get a new extent * - responsible for figuring out how to get a new extent
* - can use any method it wants to do so * - can use any method it wants to do so
* - this structure is NOT stored on disk * - this structure is NOT stored on disk
* - this class is NOT thread safe, locking should be above (for now) * - this class is NOT thread safe, locking should be above (for now)
* *
* implementation: * implementation:
* - ExtentManager holds a list of DataFile * - ExtentManager holds a list of DataFile
*/ */
class ExtentManager { class ExtentManager {
MONGO_DISALLOW_COPYING( ExtentManager ); MONGO_DISALLOW_COPYING( ExtentManager );
public: public:
ExtentManager( const StringData& dbname, const StringData& path, bo /**
ol directoryPerDB ); * @param freeListDetails this is a reference into the .ns file
* while a bit odd, this is not a layer violation as extents
* are a peer to the .ns file, without any layering
*/
ExtentManager( const StringData& dbname, const StringData& path,
NamespaceDetails* freeListDetails,
bool directoryPerDB );
~ExtentManager(); ~ExtentManager();
/** /**
* deletes all state and puts back to original state * deletes all state and puts back to original state
*/ */
void reset(); void reset();
/** /**
* can only be called once
*/
void init( NamespaceDetails* freeListDetails );
/**
* opens all current files * opens all current files
*/ */
Status init(); Status init();
size_t numFiles() const; size_t numFiles() const;
long long fileSize() const; long long fileSize() const;
DataFile* getFile( int n, int sizeNeeded = 0, bool preallocateOnly = false ); DataFile* getFile( int n, int sizeNeeded = 0, bool preallocateOnly = false );
DataFile* addAFile( int sizeNeeded, bool preallocateNextFile ); DataFile* addAFile( int sizeNeeded, bool preallocateNextFile );
void preallocateAFile() { getFile( numFiles() , 0, true ); }// XXX- ERH void preallocateAFile() { getFile( numFiles() , 0, true ); }// XXX- ERH
void flushFiles( bool sync ); void flushFiles( bool sync );
/* allocate a new Extent /* allocate a new Extent, does not check free list
@param capped - true if capped collection @param capped - true if capped collection
*/ */
Extent* createExtent( const char *ns, int approxSize, bool newCappe DiskLoc createExtent( int approxSize, int maxFileNoForQuota );
d, bool enforceQuota );
/**
* will return NULL if nothing suitable in free list
*/
DiskLoc allocFromFreeList( int approxSize, bool capped );
/**
* firstExt has to be == lastExt or a chain
*/
void freeExtents( DiskLoc firstExt, DiskLoc lastExt );
void printFreeList() const;
bool hasFreeList() const { return _freeListDetails != NULL; }
/** /**
* @param loc - has to be for a specific Record * @param loc - has to be for a specific Record
*/ */
Record* recordFor( const DiskLoc& loc ) const; Record* recordFor( const DiskLoc& loc ) const;
/** /**
* @param loc - has to be for a specific Record (not an Extent) * @param loc - has to be for a specific Record (not an Extent)
*/ */
Extent* extentFor( const DiskLoc& loc ) const; Extent* extentFor( const DiskLoc& loc ) const;
skipping to change at line 122 skipping to change at line 162
/** /**
* quantizes extent size to >= min + page boundary * quantizes extent size to >= min + page boundary
*/ */
static int quantizeExtentSize( int size ); static int quantizeExtentSize( int size );
private: private:
const DataFile* _getOpenFile( int n ) const; const DataFile* _getOpenFile( int n ) const;
Extent* _createExtentInFile( int fileNo, DataFile* f, DiskLoc _createExtentInFile( int fileNo, DataFile* f,
const char* ns, int size, bool newCapp int size, int maxFileNoForQuota );
ed,
bool enforceQuota );
boost::filesystem::path fileName( int n ) const; boost::filesystem::path fileName( int n ) const;
// ----- // -----
std::string _dbname; // i.e. "test" std::string _dbname; // i.e. "test"
std::string _path; // i.e. "/data/db" std::string _path; // i.e. "/data/db"
NamespaceDetails* _freeListDetails;
bool _directoryPerDB; bool _directoryPerDB;
// must be in the dbLock when touching this (and write locked when writing to of course) // must be in the dbLock when touching this (and write locked when writing to of course)
// however during Database object construction we aren't, which is ok as it isn't yet visible // however during Database object construction we aren't, which is ok as it isn't yet visible
// to others and we are in the dbholder lock then. // to others and we are in the dbholder lock then.
std::vector<DataFile*> _files; std::vector<DataFile*> _files;
}; };
} }
 End of changes. 8 change blocks. 
9 lines changed or deleted 54 lines changed or added


 extsort.h   extsort.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/db/index.h" #include "mongo/db/index.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/curop-inl.h" #include "mongo/db/curop-inl.h"
#include "mongo/util/array.h" #include "mongo/util/array.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 fail_point.h   fail_point.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/platform/atomic_word.h" #include "mongo/platform/atomic_word.h"
#include "mongo/util/concurrency/mutex.h" #include "mongo/util/concurrency/mutex.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 fail_point_registry.h   fail_point_registry.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
/** /**
* Should NOT be included by other header files. Include only in source fi les. * Should NOT be included by other header files. Include only in source fi les.
*/ */
#pragma once #pragma once
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/platform/unordered_map.h" #include "mongo/platform/unordered_map.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 fail_point_service.h   fail_point_service.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
/** /**
* Should NOT be included by other header files. Include only in source fi les. * Should NOT be included by other header files. Include only in source fi les.
*/ */
#pragma once #pragma once
#include "mongo/base/init.h" #include "mongo/base/init.h"
#include "mongo/util/fail_point_registry.h" #include "mongo/util/fail_point_registry.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 fetch.h   fetch.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/exec/plan_stage.h" #include "mongo/db/exec/plan_stage.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/matcher/expression.h" #include "mongo/db/matcher/expression.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 field_checker.h   field_checker.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/status.h" #include "mongo/base/status.h"
namespace mongo { namespace mongo {
class FieldRef; class FieldRef;
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 field_parser-inl.h   field_parser-inl.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#include "mongo/db/field_parser.h" #include "mongo/db/field_parser.h"
#include "mongo/util/mongoutils/str.h" #include "mongo/util/mongoutils/str.h"
namespace mongo { namespace mongo {
using mongoutils::str::stream; using mongoutils::str::stream;
template<class T>
void _genFieldErrMsg(const BSONObj& doc,
const BSONField<T>& field,
const string expected,
string* errMsg)
{
if (!errMsg) return;
*errMsg = stream() << "wrong type for '" << field() << "' field, ex
pected " << expected
<< ", found " << doc[field.name()].toString();
}
template<typename T>
FieldParser::FieldState FieldParser::extract(BSONObj doc,
const BSONField<T>& field,
T* out,
string* errMsg)
{
BSONElement elem = doc[field.name()];
if (elem.eoo()) {
if (field.hasDefault()) {
field.getDefault().cloneTo(out);
return FIELD_DEFAULT;
}
else {
return FIELD_NONE;
}
}
if (elem.type() != Object && elem.type() != Array) {
_genFieldErrMsg(doc, field, "Object/Array", errMsg);
return FIELD_INVALID;
}
if (!out->parseBSON(elem.embeddedObject(), errMsg)) {
return FIELD_INVALID;
}
return FIELD_SET;
}
template<typename T>
FieldParser::FieldState FieldParser::extract(BSONObj doc,
const BSONField<T*>& field,
T** out,
string* errMsg)
{
BSONElement elem = doc[field.name()];
if (elem.eoo()) {
if (field.hasDefault()) {
auto_ptr<T> temp(new T);
field.getDefault()->cloneTo(temp.get());
*out = temp.release();
return FIELD_DEFAULT;
}
else {
return FIELD_NONE;
}
}
if (elem.type() != Object && elem.type() != Array) {
_genFieldErrMsg(doc, field, "Object/Array", errMsg);
return FIELD_INVALID;
}
auto_ptr<T> temp(new T);
if (!temp->parseBSON(elem.embeddedObject(), errMsg)) {
return FIELD_INVALID;
}
*out = temp.release();
return FIELD_SET;
}
template<typename T>
FieldParser::FieldState FieldParser::extract(BSONObj doc,
const BSONField<T>& field,
T** out,
string* errMsg)
{
BSONElement elem = doc[field.name()];
if (elem.eoo()) {
if (field.hasDefault()) {
*out = new T;
field.getDefault().cloneTo(*out);
return FIELD_DEFAULT;
}
else {
return FIELD_NONE;
}
}
if (elem.type() != Object && elem.type() != Array) {
if (errMsg) {
*errMsg = stream() << "wrong type for '" << field() << "' f
ield, expected "
<< "vector or array" << ", found "
<< doc[field.name()].toString();
}
return FIELD_INVALID;
}
auto_ptr<T> temp(new T);
if (!temp->parseBSON(elem.embeddedObject(), errMsg)) {
return FIELD_INVALID;
}
*out = temp.release();
return FIELD_SET;
}
// Extracts an array into a vector // Extracts an array into a vector
template<typename T> template<typename T>
FieldParser::FieldState FieldParser::extract(BSONObj doc, FieldParser::FieldState FieldParser::extract(BSONObj doc,
const BSONField<vector<T> >& field, const BSONField<vector<T> >& field,
vector<T>* out, vector<T>* out,
string* errMsg) string* errMsg)
{ {
BSONElement elem = doc[field.name()]; BSONElement elem = doc[field.name()];
if (elem.eoo()) { if (elem.eoo()) {
if (field.hasDefault()) { if (field.hasDefault()) {
skipping to change at line 80 skipping to change at line 202
return FIELD_SET; return FIELD_SET;
} }
if (errMsg) { if (errMsg) {
*errMsg = stream() << "wrong type for '" << field() << "' field , expected " *errMsg = stream() << "wrong type for '" << field() << "' field , expected "
<< "vector array" << ", found " << doc[field .name()].toString(); << "vector array" << ", found " << doc[field .name()].toString();
} }
return FIELD_INVALID; return FIELD_INVALID;
} }
template<typename T>
FieldParser::FieldState FieldParser::extract(BSONObj doc,
const BSONField<vector<T*>
>& field,
vector<T*>* out,
string* errMsg) {
dassert(!field.hasDefault());
BSONElement elem = doc[field.name()];
if (elem.eoo()) {
return FIELD_NONE;
}
if (elem.type() != Array) {
if (errMsg) {
*errMsg = stream() << "wrong type for '" << field() << "' f
ield, expected "
<< "vector array" << ", found " << doc[f
ield.name()].toString();
}
return FIELD_INVALID;
}
BSONArray arr = BSONArray(elem.embeddedObject());
BSONObjIterator objIt(arr);
while (objIt.more()) {
BSONElement next = objIt.next();
if (next.type() != Object) {
if (errMsg) {
*errMsg = stream() << "wrong type for '" << field() <<
"' field contents, "
<< "expected object, found " << elem
.type();
}
return FIELD_INVALID;
}
auto_ptr<T> toInsert(new T);
if ( !toInsert->parseBSON( next.embeddedObject(), errMsg )
|| !toInsert->isValid( errMsg ) ) {
return FIELD_INVALID;
}
out->push_back(toInsert.release());
}
return FIELD_SET;
}
template<typename T>
void FieldParser::clearOwnedVector(vector<T*>* vec) {
for (typename vector<T*>::iterator it = vec->begin(); it != vec->en
d(); ++it) {
delete (*it);
}
}
template<typename T>
FieldParser::FieldState FieldParser::extract(BSONObj doc,
const BSONField<vector<T*>
>& field,
vector<T*>** out,
string* errMsg) {
dassert(!field.hasDefault());
BSONElement elem = doc[field.name()];
if (elem.eoo()) {
return FIELD_NONE;
}
if (elem.type() != Array) {
if (errMsg) {
*errMsg = stream() << "wrong type for '" << field() << "' f
ield, expected "
<< "vector array" << ", found " << doc[f
ield.name()].toString();
}
return FIELD_INVALID;
}
auto_ptr<vector<T*> > tempVector(new vector<T*>);
BSONArray arr = BSONArray(elem.embeddedObject());
BSONObjIterator objIt(arr);
while (objIt.more()) {
BSONElement next = objIt.next();
if (next.type() != Object) {
if (errMsg) {
*errMsg = stream() << "wrong type for '" << field() <<
"' field contents, "
<< "expected object, found " << elem
.type();
}
clearOwnedVector(tempVector.get());
return FIELD_INVALID;
}
auto_ptr<T> toInsert(new T);
if (!toInsert->parseBSON(next.embeddedObject(), errMsg)) {
clearOwnedVector(tempVector.get());
return FIELD_INVALID;
}
tempVector->push_back(toInsert.release());
}
*out = tempVector.release();
return FIELD_SET;
}
// Extracts an object into a map // Extracts an object into a map
template<typename K, typename T> template<typename K, typename T>
FieldParser::FieldState FieldParser::extract(BSONObj doc, FieldParser::FieldState FieldParser::extract(BSONObj doc,
const BSONField<map<K, T> >& field, const BSONField<map<K, T> >& field,
map<K, T>* out, map<K, T>* out,
string* errMsg) string* errMsg)
{ {
BSONElement elem = doc[field.name()]; BSONElement elem = doc[field.name()];
if (elem.eoo()) { if (elem.eoo()) {
if (field.hasDefault()) { if (field.hasDefault()) {
 End of changes. 3 change blocks. 
0 lines changed or deleted 247 lines changed or added


 field_parser.h   field_parser.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/bson/bson_field.h" #include "mongo/bson/bson_field.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/s/bson_serializable.h"
#include "mongo/util/time_support.h" #include "mongo/util/time_support.h"
namespace mongo { namespace mongo {
class FieldParser { class FieldParser {
public: public:
/** /**
* Returns true and fills in 'out' with the contents of the field d escribed by 'field' * Returns true and fills in 'out' with the contents of the field d escribed by 'field'
* or with the value in 'def', depending on whether the field is pr esent and has the * or with the value in 'def', depending on whether the field is pr esent and has the
* correct type in 'doc' or not, respectively. Otherwise, if the fi eld exists but has * correct type in 'doc' or not, respectively. Otherwise, if the fi eld exists but has
skipping to change at line 112 skipping to change at line 125
const BSONField<int>& field, const BSONField<int>& field,
int* out, int* out,
string* errMsg = NULL); string* errMsg = NULL);
static FieldState extractNumber(BSONObj doc, static FieldState extractNumber(BSONObj doc,
const BSONField<long long>& field, const BSONField<long long>& field,
long long* out, long long* out,
string* errMsg = NULL); string* errMsg = NULL);
/** /**
* Extracts a mandatory BSONSerializable structure 'field' from the
object 'doc'. Write
* the extracted contents to '*out' if successful or fills '*errMsg
', if exising,
* otherwise. This variant relies on T having a parseBSON, which a
ll
* BSONSerializable's have.
*
* TODO: Tighten for BSONSerializable's only
*/
template<typename T>
static FieldState extract(BSONObj doc,
const BSONField<T>& field,
T* out,
string* errMsg = NULL);
template<typename T>
static FieldState extract(BSONObj doc,
const BSONField<T*>& field,
T** out,
string* errMsg = NULL);
/**
* Similar to the mandatory 'extract' but on a optional field. '*ou
t' would only be
* allocated if the field is present. The ownership of '*out' would
be transferred to
* the caller, in that case.
*
* TODO: Tighten for BSONSerializable's only
*/
template<typename T>
static FieldState extract(BSONObj doc,
const BSONField<T>& field,
T** out, // alloc variation
string* errMsg = NULL);
/**
* Extracts a mandatory repetition of BSONSerializable structures,
'field', from the
* object 'doc'. Write the extracted contents to '*out' if successf
ul or fills
* '*errMsg', if exising, otherwise. This variant relies on T havi
ng a parseBSON,
* which all BSONSerializable's have.
*
* The vector owns the instances of T.
*
* TODO: Tighten for BSONSerializable's only
*/
template<typename T>
static FieldState extract(BSONObj doc,
const BSONField<vector<T*> >& field,
vector<T*>* out,
string* errMsg = NULL);
/**
* Similar to the mandatory repetition' extract but on an optional
field. '*out' would
* only be allocated if the field is present. The ownership of '*ou
t' would be
* transferred to the caller, in that case.
*
* The vector owns the instances of T.
*
* TODO: Tighten for BSONSerializable's only
*/
template<typename T>
static FieldState extract(BSONObj doc,
const BSONField<vector<T*> >& field,
vector<T*>** out,
string* errMsg = NULL);
//
// ==================== Below DEPRECATED; use types instead =======
=============
//
/**
* The following extract methods are templatized to handle extracti on of vectors and * The following extract methods are templatized to handle extracti on of vectors and
* maps of sub-objects. Keys in the map should be StringData compa tible. * maps of sub-objects. Keys in the map should be StringData compa tible.
* *
* It's possible to nest extraction of vectors and maps to any dept h, i.e: * It's possible to nest extraction of vectors and maps to any dept h, i.e:
* *
* vector<map<string,vector<string> > > val; * vector<map<string,vector<string> > > val;
* FieldParser::extract(doc, field, val, &val); * FieldParser::extract(doc, field, val, &val);
*/ */
template<typename T> template<typename T>
static FieldState extract(BSONObj doc, static FieldState extract(BSONObj doc,
const BSONField<vector<T> >& field, const BSONField<vector<T> >& field,
vector<T>* out, vector<T>* out,
string* errMsg = NULL); string* errMsg = NULL);
template<typename K, typename T> template<typename K, typename T>
static FieldState extract(BSONObj doc, static FieldState extract(BSONObj doc,
const BSONField<map<K, T> >& field, const BSONField<map<K, T> >& field,
map<K, T>* out, map<K, T>* out,
string* errMsg = NULL); string* errMsg = NULL);
private:
template<typename T>
static void clearOwnedVector(vector<T*>* vec);
}; };
} // namespace mongo } // namespace mongo
// Inline functions for templating // Inline functions for templating
#include "field_parser-inl.h" #include "field_parser-inl.h"
 End of changes. 4 change blocks. 
0 lines changed or deleted 104 lines changed or added


 field_path.h   field_path.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link th
e
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the GNU Affero General Public License in all respects f
or
* all of the code used other than as permitted herein. If you modify file(
s)
* with this exception, you may extend this exception to your version of th
e
* file(s), but you are not obligated to do so. If you do not wish to do so
,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also dele
te
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
namespace mongo { namespace mongo {
class FieldPath { class FieldPath {
public: public:
 End of changes. 1 change blocks. 
0 lines changed or deleted 18 lines changed or added


 field_ref.h   field_ref.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_array.hpp> #include <boost/scoped_array.hpp>
#include <iosfwd> #include <iosfwd>
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
skipping to change at line 81 skipping to change at line 93
/** /**
* Returns the number of field parts in the prefix that 'this' and 'other' share. * Returns the number of field parts in the prefix that 'this' and 'other' share.
*/ */
size_t commonPrefixSize( const FieldRef& other ) const; size_t commonPrefixSize( const FieldRef& other ) const;
/** /**
* Returns a copy of the full dotted field in its current state (i. e., some parts may * Returns a copy of the full dotted field in its current state (i. e., some parts may
* have been replaced since the parse() call). * have been replaced since the parse() call).
*/ */
std::string dottedField( size_t offset = 0 ) const; StringData dottedField( size_t offsetFromStart = 0 ) const;
/** /**
* Compares the full dotted path represented by this FieldRef to ot her * Compares the full dotted path represented by this FieldRef to ot her
*/ */
bool equalsDottedField( const StringData& other ) const; bool equalsDottedField( const StringData& other ) const;
/** /**
* Return 0 if 'this' is equal to 'other' lexicographically, -1 if is it less than or * Return 0 if 'this' is equal to 'other' lexicographically, -1 if is it less than or
* +1 if it is greater than. * +1 if it is greater than.
*/ */
skipping to change at line 108 skipping to change at line 120
// //
// accessors // accessors
// //
/** /**
* Returns the number of parts in this FieldRef. * Returns the number of parts in this FieldRef.
*/ */
size_t numParts() const { return _size; } size_t numParts() const { return _size; }
/** bool empty() const { return numParts() == 0; }
* Returns the number of fields parts that were replaced so far. Re
placing the same
* fields several times only counts for 1.
*/
size_t numReplaced() const;
private: private:
// Dotted fields are most often not longer than four parts. We use a mixed structure // Dotted fields are most often not longer than four parts. We use a mixed structure
// here that will not require any extra memory allocation when that is the case. And // here that will not require any extra memory allocation when that is the case. And
// handle larger dotted fields if it is. The idea is not to penaliz e the common case // handle larger dotted fields if it is. The idea is not to penaliz e the common case
// with allocations. // with allocations.
static const size_t kReserveAhead = 4; static const size_t kReserveAhead = 4;
/** Converts the field part index to the variable part equivalent * / /** Converts the field part index to the variable part equivalent * /
size_t getIndex(size_t i) const { return i-kReserveAhead; } size_t getIndex(size_t i) const { return i-kReserveAhead; }
/** /**
* Returns the new number of parts after appending 'part' to this f ield path. It * Returns the new number of parts after appending 'part' to this f ield path. It
* assumes that 'part' is pointing to an internally allocated area. * assumes that 'part' is pointing to an internally allocated area.
*/ */
size_t appendPart(const StringData& part); size_t appendPart(const StringData& part);
/**
* Re-assemble _dotted from components, including any replacements
in _replacements,
* and update the StringData components in _fixed and _variable to
refer to the parts
* of the new _dotted. This is used to make the storage for the cur
rent value of this
* FieldRef contiguous so it can be returned as a StringData from t
he dottedField
* method above.
*/
void reserialize() const;
// number of field parts stored // number of field parts stored
size_t _size; size_t _size;
// first kResevedAhead field components // first kResevedAhead field components
StringData _fixed[kReserveAhead]; mutable StringData _fixed[kReserveAhead];
// remaining field components // remaining field components
std::vector<StringData> _variable; mutable std::vector<StringData> _variable;
// concatenation of null-terminated parts pointed to by _fixed and // cached dotted name
_variable mutable std::string _dotted;
boost::scoped_array<char> _fieldBase;
// back memory added with the setPart call pointed to by _fized and _variable // back memory added with the setPart call pointed to by _fized and _variable
std::vector<std::string> _replacements; mutable std::vector<std::string> _replacements;
}; };
inline bool operator==(const FieldRef& lhs, const FieldRef& rhs) { inline bool operator==(const FieldRef& lhs, const FieldRef& rhs) {
return lhs.compare(rhs) == 0; return lhs.compare(rhs) == 0;
} }
inline bool operator!=(const FieldRef& lhs, const FieldRef& rhs) { inline bool operator!=(const FieldRef& lhs, const FieldRef& rhs) {
return lhs.compare(rhs) != 0; return lhs.compare(rhs) != 0;
} }
 End of changes. 8 change blocks. 
13 lines changed or deleted 40 lines changed or added


 field_ref_set.h   field_ref_set.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <set> #include <set>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/db/field_ref.h" #include "mongo/db/field_ref.h"
namespace mongo { namespace mongo {
/** /**
* A FieldRefSet holds a set of FieldRefs's that do not conflict with o ne another, that is, * A FieldRefSet holds a set of FieldRefs's that do not conflict with o ne another, that is,
* they target different subtrees of a given document. Two fieldRef's w ould conflict if they * they target different subtrees of a given document. Two fieldRef's w ould conflict if they
* are equal or one is prefix of the other. * are equal or one is prefix of the other.
*/ */
class FieldRefSet { class FieldRefSet {
MONGO_DISALLOW_COPYING(FieldRefSet); MONGO_DISALLOW_COPYING(FieldRefSet);
struct FieldRefPtrLessThan {
bool operator()(const FieldRef* lhs, const FieldRef* rhs) const
;
};
typedef std::set<const FieldRef*, FieldRefPtrLessThan> FieldSet;
public: public:
typedef FieldSet::iterator iterator;
typedef FieldSet::const_iterator const_iterator;
FieldRefSet(); FieldRefSet();
/** Returns 'true' if the set is empty */
bool empty() const {
return _fieldSet.empty();
}
inline const_iterator begin() const {
return _fieldSet.begin();
}
inline const_iterator end() const {
return _fieldSet.end();
}
/** /**
* Returns true if the field 'toInsert' can be added in the set wit hout * Returns true if the field 'toInsert' can be added in the set wit hout
* conflicts. Otwerwise returns false and fill in '*conflict' with the field 'toInsert' * conflicts. Otwerwise returns false and fill in '*conflict' with the field 'toInsert'
* clashed with. * clashed with.
* *
* There is no ownership transfer of 'toInsert'. The caller is resp onsible for * There is no ownership transfer of 'toInsert'. The caller is resp onsible for
* maintaining it alive for as long as the FieldRefSet is so. By th e same token * maintaining it alive for as long as the FieldRefSet is so. By th e same token
* 'conflict' can only be referred to while the FieldRefSet can. * 'conflict' can only be referred to while the FieldRefSet can.
*/ */
bool insert(const FieldRef* toInsert, const FieldRef** conflict); bool insert(const FieldRef* toInsert, const FieldRef** conflict);
private: /**
struct FieldRefPtrLessThan { * Find all inserted fields which conflict with the FieldRef 'toChe
bool operator()(const FieldRef* lhs, const FieldRef* rhs) const ck' by the semantics
; * of 'insert', and add those fields to the 'conflicts' set.
}; */
typedef std::set<const FieldRef*, FieldRefPtrLessThan> FieldSet; void getConflicts(const FieldRef* toCheck, FieldRefSet* conflicts)
const;
void clear() {
_fieldSet.clear();
}
private:
// A set of field_ref pointers, none of which is owned here. // A set of field_ref pointers, none of which is owned here.
FieldSet _fieldSet; FieldSet _fieldSet;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 6 change blocks. 
6 lines changed or deleted 56 lines changed or added


 filever.h   filever.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
inline void checkDataFileVersion(NamespaceDetails& d) { inline void checkDataFileVersion(NamespaceDetails& d) {
} }
inline void checkIndexFileVersion(NamespaceDetails& d) { inline void checkIndexFileVersion(NamespaceDetails& d) {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 filter.h   filter.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/exec/working_set.h" #include "mongo/db/exec/working_set.h"
#include "mongo/db/matcher/matchable.h" #include "mongo/db/matcher/matchable.h"
namespace mongo { namespace mongo {
/** /**
skipping to change at line 41 skipping to change at line 53
WorkingSetMatchableDocument(WorkingSetMember* wsm) : _wsm(wsm) { } WorkingSetMatchableDocument(WorkingSetMember* wsm) : _wsm(wsm) { }
virtual ~WorkingSetMatchableDocument() { } virtual ~WorkingSetMatchableDocument() { }
// This is only called by a $where query. The query system must be smart enough to realize // This is only called by a $where query. The query system must be smart enough to realize
// that it should do a fetch beforehand. // that it should do a fetch beforehand.
BSONObj toBSON() const { BSONObj toBSON() const {
verify(_wsm->hasObj()); verify(_wsm->hasObj());
return _wsm->obj; return _wsm->obj;
} }
virtual ElementIterator* getIterator(const ElementPath& path) const { virtual ElementIterator* allocateIterator(const ElementPath* path) const {
// BSONElementIterator does some interesting things with arrays that I don't think // BSONElementIterator does some interesting things with arrays that I don't think
// SimpleArrayElementIterator does. // SimpleArrayElementIterator does.
if (_wsm->hasObj()) { if (_wsm->hasObj()) {
return new BSONElementIterator(path, _wsm->obj); return new BSONElementIterator(path, _wsm->obj);
} }
// NOTE: This (kind of) duplicates code in WorkingSetMember::ge tFieldDotted. // NOTE: This (kind of) duplicates code in WorkingSetMember::ge tFieldDotted.
// Keep in sync w/that. // Keep in sync w/that.
// Find the first field in the index key data described by path and return an iterator // Find the first field in the index key data described by path and return an iterator
// over it. // over it.
for (size_t i = 0; i < _wsm->keyData.size(); ++i) { for (size_t i = 0; i < _wsm->keyData.size(); ++i) {
BSONObjIterator keyPatternIt(_wsm->keyData[i].indexKeyPatte rn); BSONObjIterator keyPatternIt(_wsm->keyData[i].indexKeyPatte rn);
BSONObjIterator keyDataIt(_wsm->keyData[i].keyData); BSONObjIterator keyDataIt(_wsm->keyData[i].keyData);
while (keyPatternIt.more()) { while (keyPatternIt.more()) {
BSONElement keyPatternElt = keyPatternIt.next(); BSONElement keyPatternElt = keyPatternIt.next();
verify(keyDataIt.more()); verify(keyDataIt.more());
BSONElement keyDataElt = keyDataIt.next(); BSONElement keyDataElt = keyDataIt.next();
if (path.fieldRef().equalsDottedField(keyPatternElt.fie ldName())) { if (path->fieldRef().equalsDottedField(keyPatternElt.fi eldName())) {
if (Array == keyDataElt.type()) { if (Array == keyDataElt.type()) {
return new SimpleArrayElementIterator(keyDataEl t, true); return new SimpleArrayElementIterator(keyDataEl t, true);
} }
else { else {
return new SingleElementElementIterator(keyData Elt); return new SingleElementElementIterator(keyData Elt);
} }
} }
} }
} }
// This should not happen. // This should not happen.
massert(16920, "trying to match on unknown field: " + path.fiel dRef().dottedField(), massert(16920, "trying to match on unknown field: " + path->fie ldRef().dottedField().toString(),
0); 0);
return new SingleElementElementIterator(BSONElement()); return new SingleElementElementIterator(BSONElement());
} }
virtual void releaseIterator( ElementIterator* iterator ) const {
delete iterator;
}
private: private:
WorkingSetMember* _wsm; WorkingSetMember* _wsm;
}; };
/** /**
* Used by every stage with a filter. * Used by every stage with a filter.
*/ */
class Filter { class Filter {
public: public:
/** /**
 End of changes. 5 change blocks. 
3 lines changed or deleted 27 lines changed or added


 find_and_modify.h   find_and_modify.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/db/auth/privilege.h" #include "mongo/db/auth/privilege.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
class Command;
namespace find_and_modify { namespace find_and_modify {
void addPrivilegesRequiredForFindAndModify(const std::string& dbnam void addPrivilegesRequiredForFindAndModify(Command* commandTemplate,
e, const std::string& dbname,
const BSONObj& cmdObj, const BSONObj& cmdObj,
std::vector<Privilege>* std::vector<Privilege>* out)
out); ;
} // namespace find_and_modify } // namespace find_and_modify
} // namespace mongo } // namespace mongo
 End of changes. 3 change blocks. 
5 lines changed or deleted 28 lines changed or added


 finding_start_cursor.h   finding_start_cursor.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <memory> #include <memory>
#include "mongo/db/clientcursor.h" #include "mongo/db/clientcursor.h"
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 fine_clock.h   fine_clock.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#ifndef DB_STATS_FINE_CLOCK_HEADER #ifndef DB_STATS_FINE_CLOCK_HEADER
#define DB_STATS_FINE_CLOCK_HEADER #define DB_STATS_FINE_CLOCK_HEADER
#include <time.h> // struct timespec #include <time.h> // struct timespec
namespace mongo { namespace mongo {
/** /**
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 framework.h   framework.h 
skipping to change at line 28 skipping to change at line 28
/* /*
simple portable regression system simple portable regression system
*/ */
#include <string> #include <string>
namespace mongo { namespace mongo {
namespace dbtests { namespace dbtests {
int runDbTests( int argc, char ** argv, string default_dbpath ); int runDbTests(int argc, char ** argv);
} // dbtests } // dbtests
} // namespace mongo } // namespace mongo
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 fsync.h   fsync.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/util/concurrency/mutex.h" #include "mongo/util/concurrency/mutex.h"
namespace mongo { namespace mongo {
// Use this for blocking during an fsync-and-lock // Use this for blocking during an fsync-and-lock
extern SimpleMutex filesLockedFsync; extern SimpleMutex filesLockedFsync;
bool lockedForWriting(); bool lockedForWriting();
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 fts_access_method.h   fts_access_method.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/fts/fts_spec.h" #include "mongo/db/fts/fts_spec.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/index/btree_access_method_internal.h" #include "mongo/db/index/btree_access_method_internal.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
// Because they're in another namespace, FTSAccessMethod can't be frien
ds w/them unless they're
// forward declared.
namespace fts {
class FTSCommand;
class FTSSearch;
}
class FTSAccessMethod : public BtreeBasedAccessMethod { class FTSAccessMethod : public BtreeBasedAccessMethod {
public: public:
FTSAccessMethod(IndexDescriptor* descriptor); FTSAccessMethod(IndexDescriptor* descriptor);
virtual ~FTSAccessMethod() { } virtual ~FTSAccessMethod() { }
// Not implemented: // Not implemented:
virtual Status newCursor(IndexCursor** out); virtual Status newCursor(IndexCursor** out);
protected:
friend class fts::FTSCommand;
friend class fts::FTSSearch;
fts::FTSSpec& getSpec() { return _ftsSpec; } fts::FTSSpec& getSpec() { return _ftsSpec; }
private: private:
// Implemented: // Implemented:
virtual void getKeys(const BSONObj& obj, BSONObjSet* keys); virtual void getKeys(const BSONObj& obj, BSONObjSet* keys);
fts::FTSSpec _ftsSpec; fts::FTSSpec _ftsSpec;
}; };
} //namespace mongo } // namespace mongo
 End of changes. 6 change blocks. 
12 lines changed or deleted 21 lines changed or added


 fts_command.h   fts_command.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/db/commands.h" #include "mongo/db/commands.h"
// mongo::fts::FTSCommand is deprecated: the "text" command is deprecated i
n favor of the $text
// query operator.
namespace mongo { namespace mongo {
namespace fts { namespace fts {
class FTSCommand : public Command { class FTSCommand : public Command {
public: public:
FTSCommand(); FTSCommand();
bool slaveOk() const { return true; } bool slaveOk() const { return true; }
bool slaveOverrideOk() const { return true; } bool slaveOverrideOk() const { return true; }
 End of changes. 2 change blocks. 
0 lines changed or deleted 24 lines changed or added


 fts_enabled.h   fts_enabled.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
namespace fts { namespace fts {
bool isTextSearchEnabled(); bool isTextSearchEnabled();
} }
} }
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 fts_index_format.h   fts_index_format.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/fts/fts_spec.h" #include "mongo/db/fts/fts_spec.h"
namespace mongo { namespace mongo {
namespace fts { namespace fts {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 fts_matcher.h   fts_matcher.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/fts/fts_query.h" #include "mongo/db/fts/fts_query.h"
#include "mongo/db/fts/fts_spec.h" #include "mongo/db/fts/fts_spec.h"
#include "mongo/db/fts/tokenizer.h" #include "mongo/db/fts/tokenizer.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 fts_query.h   fts_query.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/fts/stemmer.h" #include "mongo/db/fts/stemmer.h"
#include "mongo/db/fts/stop_words.h" #include "mongo/db/fts/stop_words.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 fts_search.h   fts_search.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <map> #include <map>
#include <set> #include <set>
#include <vector> #include <vector>
#include <queue> #include <queue>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/db/fts/fts_matcher.h" #include "mongo/db/fts/fts_matcher.h"
#include "mongo/db/fts/fts_query.h" #include "mongo/db/fts/fts_query.h"
#include "mongo/db/fts/fts_util.h" #include "mongo/db/fts/fts_util.h"
#include "mongo/db/index/index_descriptor.h" #include "mongo/db/index/index_descriptor.h"
#include "mongo/db/matcher.h" #include "mongo/db/matcher.h"
// mongo::fts::FTSSearch is deprecated: the "text" command is deprecated in
favor of the $text
// query operator.
namespace mongo { namespace mongo {
class BtreeCursor; class BtreeCursor;
namespace fts { namespace fts {
// priority queue template, for use when we're populating results // priority queue template, for use when we're populating results
// vector returned to the user. extends the default priority_queue // vector returned to the user. extends the default priority_queue
// by providing direct access to the underlying vector, which shoul d // by providing direct access to the underlying vector, which shoul d
// be used CAREFULLY because you can get into trouble.. // be used CAREFULLY because you can get into trouble..
 End of changes. 2 change blocks. 
0 lines changed or deleted 24 lines changed or added


 fts_spec.h   fts_spec.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <map> #include <map>
#include <vector> #include <vector>
#include <string> #include <string>
#include "mongo/db/fts/fts_util.h" #include "mongo/db/fts/fts_util.h"
#include "mongo/db/fts/stemmer.h" #include "mongo/db/fts/stemmer.h"
skipping to change at line 44 skipping to change at line 56
extern const double MAX_WEIGHT; extern const double MAX_WEIGHT;
typedef std::map<string,double> Weights; // TODO cool map typedef std::map<string,double> Weights; // TODO cool map
typedef unordered_map<string,double> TermFrequencyMap; typedef unordered_map<string,double> TermFrequencyMap;
class FTSSpec { class FTSSpec {
struct Tools { struct Tools {
Tools( string language ) Tools( string _language,
: language( language ){} const Stemmer* _stemmer,
const StopWords* _stopwords )
: language( _language )
, stemmer( _stemmer )
, stopwords( _stopwords ) {}
const std::string& language; const std::string& language;
const Stemmer* stemmer; const Stemmer* stemmer;
const StopWords* stopwords; const StopWords* stopwords;
}; };
public: public:
FTSSpec( const BSONObj& indexInfo ); FTSSpec( const BSONObj& indexInfo );
bool wildcard() const { return _wildcard; } bool wildcard() const { return _wildcard; }
const string& defaultLanguage() const { return _defaultLanguage ; } const string& defaultLanguage() const { return _defaultLanguage ; }
const string& languageOverrideField() const { return _languageO verrideField; } const string& languageOverrideField() const { return _languageO verrideField; }
size_t numExtraBefore() const { return _extraBefore.size(); } size_t numExtraBefore() const { return _extraBefore.size(); }
const std::string& extraBefore( unsigned i ) const { return _ex traBefore[i]; } const std::string& extraBefore( unsigned i ) const { return _ex traBefore[i]; }
size_t numExtraAfter() const { return _extraAfter.size(); } size_t numExtraAfter() const { return _extraAfter.size(); }
const std::string& extraAfter( unsigned i ) const { return _ext raAfter[i]; } const std::string& extraAfter( unsigned i ) const { return _ext raAfter[i]; }
string getLanguageToUse( const BSONObj& userDoc ) const; /**
* Find a "language" field, if any, in a given BSON doc. If th
e language is not on the
* list of valid languages, return current.
*/
string getLanguageToUse( const BSONObj& userDoc,
const std::string& currentLanguage ) c
onst;
void scoreDocument( const BSONObj& obj, TermFrequencyMap* score /**
s ) const; * Calculates term/score pairs for a BSONObj as applied to this
spec.
* - "obj": the BSONObj to traverse; can be a subdocument or ar
ray
* - "parentLanguage": nearest enclosing document "language" sp
ec for obj
* - "parentPath": obj's dotted path in containing document
* - "isArray": true if obj is an array
* - "term_freqs": out-parameter to store results
*/
void scoreDocument( const BSONObj& obj,
const string& parentLanguage,
const string& parentPath,
bool isArray,
TermFrequencyMap* term_freqs ) const;
/** /**
* given a query, pulls out the pieces (in order) that go in th e index first * given a query, pulls out the pieces (in order) that go in th e index first
*/ */
Status getIndexPrefix( const BSONObj& filter, BSONObj* out ) co nst; Status getIndexPrefix( const BSONObj& filter, BSONObj* out ) co nst;
const Weights& weights() const { return _weights; } const Weights& weights() const { return _weights; }
/**
* @param out - untouched if field isn't present
* @return if field is here
*/
bool weight( const StringData& field, double* out ) const;
static BSONObj fixSpec( const BSONObj& spec ); static BSONObj fixSpec( const BSONObj& spec );
private: private:
void _scoreRecurse(const Tools& tools,
const BSONObj& obj,
TermFrequencyMap* term_freqs ) const;
void _scoreString( const Tools& tools, void _scoreString( const Tools& tools,
const StringData& raw, const StringData& raw,
TermFrequencyMap* term_freqs, TermFrequencyMap* term_freqs,
double weight ) const; double weight ) const;
string _defaultLanguage; string _defaultLanguage;
string _languageOverrideField; string _languageOverrideField;
bool _wildcard; bool _wildcard;
// _weights stores a mapping between the fields and the value a s a double // _weights stores a mapping between the fields and the value a s a double
 End of changes. 6 change blocks. 
15 lines changed or deleted 51 lines changed or added


 fts_util.h   fts_util.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/db/hasher.h" #include "mongo/db/hasher.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/storage/record.h" #include "mongo/db/storage/record.h"
#include "mongo/util/unordered_fast_key_table.h" #include "mongo/util/unordered_fast_key_table.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 geonear.h   geonear.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
// Arguments in common between 2d and 2dsphere geoNear. // Arguments in common between 2d and 2dsphere geoNear.
class GeoNearArguments { class GeoNearArguments {
public: public:
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 geoparser.h   geoparser.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/geo/shapes.h" #include "mongo/db/geo/shapes.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
// This class parses geographic data. // This class parses geographic data.
// It parses a subset of GeoJSON and creates S2 shapes from it. // It parses a subset of GeoJSON and creates S2 shapes from it.
// See http://geojson.org/geojson-spec.html for the spec. // See http://geojson.org/geojson-spec.html for the spec.
// //
// This class also parses the ad-hoc geo formats that MongoDB introduce d. // This class also parses the ad-hoc geo formats that MongoDB introduce d.
// //
// We assume that if you're trying to parse something, you know it's va // parse* methods may do some more validation than the is* methods; the
lid. y return false if they
// encounter invalid geometry and true if the geometry is parsed succes
sfully.
class GeoParser { class GeoParser {
public: public:
static bool isPoint(const BSONObj &obj); static bool isPoint(const BSONObj &obj);
static void parsePoint(const BSONObj &obj, PointWithCRS *out); static bool parsePoint(const BSONObj &obj, PointWithCRS *out);
static bool isLine(const BSONObj &obj); static bool isLine(const BSONObj &obj);
static void parseLine(const BSONObj &obj, LineWithCRS *out); static bool parseLine(const BSONObj &obj, LineWithCRS *out);
static bool isBox(const BSONObj &obj); static bool isBox(const BSONObj &obj);
static void parseBox(const BSONObj &obj, BoxWithCRS *out); static bool parseBox(const BSONObj &obj, BoxWithCRS *out);
static bool isPolygon(const BSONObj &obj); static bool isPolygon(const BSONObj &obj);
static void parsePolygon(const BSONObj &obj, PolygonWithCRS *out); static bool parsePolygon(const BSONObj &obj, PolygonWithCRS *out);
// AKA $center or $centerSphere // AKA $center or $centerSphere
static bool isCap(const BSONObj &obj); static bool isCap(const BSONObj &obj);
static void parseCap(const BSONObj &obj, CapWithCRS *out); static bool parseCap(const BSONObj &obj, CapWithCRS *out);
static bool isMultiPoint(const BSONObj &obj); static bool isMultiPoint(const BSONObj &obj);
static void parseMultiPoint(const BSONObj &obj, MultiPointWithCRS * out); static bool parseMultiPoint(const BSONObj &obj, MultiPointWithCRS * out);
static bool isMultiLine(const BSONObj &obj); static bool isMultiLine(const BSONObj &obj);
static void parseMultiLine(const BSONObj &obj, MultiLineWithCRS *ou t); static bool parseMultiLine(const BSONObj &obj, MultiLineWithCRS *ou t);
static bool isMultiPolygon(const BSONObj &obj); static bool isMultiPolygon(const BSONObj &obj);
static void parseMultiPolygon(const BSONObj &obj, MultiPolygonWithC RS *out); static bool parseMultiPolygon(const BSONObj &obj, MultiPolygonWithC RS *out);
static bool isGeometryCollection(const BSONObj &obj); static bool isGeometryCollection(const BSONObj &obj);
static void parseGeometryCollection(const BSONObj &obj, GeometryCol lection *out); static bool parseGeometryCollection(const BSONObj &obj, GeometryCol lection *out);
// Return true if the CRS field is 1. missing, or 2. is well-formed and // Return true if the CRS field is 1. missing, or 2. is well-formed and
// has a datum we accept. Otherwise, return false. // has a datum we accept. Otherwise, return false.
// NOTE(hk): If this is ever used anywhere but internally, consider // NOTE(hk): If this is ever used anywhere but internally, consider
// returning states: missing, invalid, unknown, ok, etc. -- whateve r // returning states: missing, invalid, unknown, ok, etc. -- whateve r
// needed. // needed.
static bool crsIsOK(const BSONObj& obj); static bool crsIsOK(const BSONObj& obj);
}; };
} // namespace mongo } // namespace mongo
 End of changes. 11 change blocks. 
11 lines changed or deleted 33 lines changed or added


 geoquery.h   geoquery.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/geo/geoparser.h" #include "mongo/db/geo/geoparser.h"
#include "mongo/db/geo/shapes.h" #include "mongo/db/geo/shapes.h"
#include "mongo/util/mongoutils/str.h" #include "mongo/util/mongoutils/str.h"
#include "third_party/s2/s2regionunion.h" #include "third_party/s2/s2regionunion.h"
namespace mongo { namespace mongo {
skipping to change at line 51 skipping to change at line 63
* the entire otherContainer. * the entire otherContainer.
*/ */
bool contains(const GeometryContainer& otherContainer) const; bool contains(const GeometryContainer& otherContainer) const;
/** /**
* Only polygons (and aggregate types thereof) support contains. * Only polygons (and aggregate types thereof) support contains.
*/ */
bool supportsContains() const; bool supportsContains() const;
bool hasS2Region() const; bool hasS2Region() const;
bool hasFlatRegion() const;
// Used by s2cursor only to generate a covering of the query object . // Used by s2cursor only to generate a covering of the query object .
// One region is not NULL and this returns it. // One region is not NULL and this returns it.
const S2Region& getRegion() const; const S2Region& getRegion() const;
private: private:
// Does 'this' intersect with the provided type? // Does 'this' intersect with the provided type?
bool intersects(const S2Cell& otherPoint) const; bool intersects(const S2Cell& otherPoint) const;
bool intersects(const S2Polyline& otherLine) const; bool intersects(const S2Polyline& otherLine) const;
bool intersects(const S2Polygon& otherPolygon) const; bool intersects(const S2Polygon& otherPolygon) const;
// These three just iterate over the geometries and call the 3 meth ods above. // These three just iterate over the geometries and call the 3 meth ods above.
skipping to change at line 87 skipping to change at line 100
shared_ptr<CapWithCRS> _cap; shared_ptr<CapWithCRS> _cap;
shared_ptr<MultiPointWithCRS> _multiPoint; shared_ptr<MultiPointWithCRS> _multiPoint;
shared_ptr<MultiLineWithCRS> _multiLine; shared_ptr<MultiLineWithCRS> _multiLine;
shared_ptr<MultiPolygonWithCRS> _multiPolygon; shared_ptr<MultiPolygonWithCRS> _multiPolygon;
shared_ptr<GeometryCollection> _geometryCollection; shared_ptr<GeometryCollection> _geometryCollection;
shared_ptr<BoxWithCRS> _box; shared_ptr<BoxWithCRS> _box;
shared_ptr<S2RegionUnion> _region; shared_ptr<S2RegionUnion> _region;
}; };
// TODO: Make a struct, turn parse stuff into something like
// static Status parseNearQuery(const BSONObj& obj, NearQuery** out);
class NearQuery { class NearQuery {
public: public:
NearQuery() : minDistance(0), maxDistance(std::numeric_limits<doubl NearQuery()
e>::max()), : minDistance(0),
fromRadians(false) {} maxDistance(std::numeric_limits<double>::max()),
NearQuery(const string& f) : field(f), minDistance(0), isNearSphere(false) { }
maxDistance(std::numeric_limits<double
>::max()), NearQuery(const string& f)
fromRadians(false) {} : field(f),
minDistance(0),
maxDistance(std::numeric_limits<double>::max()),
isNearSphere(false) { }
/**
* If fromRadians is true after a parseFrom, minDistance and maxDis
tance are returned in
* radians, not meters. The distances must be multiplied by the un
derlying index's radius
* to convert them to meters.
*
* This is annoying but useful when we don't know what index we're
using at parse time.
*/
bool parseFrom(const BSONObj &obj); bool parseFrom(const BSONObj &obj);
bool parseFromGeoNear(const BSONObj &obj, double radius); bool parseFromGeoNear(const BSONObj &obj, double radius);
// The name of the field that contains the geometry.
string field; string field;
// The starting point of the near search.
PointWithCRS centroid; PointWithCRS centroid;
// Min and max distance IN METERS from centroid that we're willing // Min and max distance from centroid that we're willing to search.
to search. // Distance is in whatever units the centroid's CRS implies.
// If centroid.crs == FLAT these are radians.
// If centroid.crs == SPHERE these are meters.
double minDistance; double minDistance;
double maxDistance; double maxDistance;
// Did we convert to this distance from radians? (If so, we output // It's either $near or $nearSphere.
distances in radians.) bool isNearSphere;
bool fromRadians;
string toString() const {
stringstream ss;
ss << " field=" << field;
return ss.str();
}
private:
bool parseLegacyQuery(const BSONObj &obj);
bool parseNewQuery(const BSONObj &obj);
}; };
// This represents either a $within or a $geoIntersects. // This represents either a $within or a $geoIntersects.
class GeoQuery { class GeoQuery {
public: public:
GeoQuery() : field(""), predicate(INVALID) {} GeoQuery() : field(""), predicate(INVALID) {}
GeoQuery(const string& f) : field(f), predicate(INVALID) {} GeoQuery(const string& f) : field(f), predicate(INVALID) {}
enum Predicate { enum Predicate {
WITHIN, WITHIN,
INTERSECT, INTERSECT,
INVALID INVALID
}; };
bool parseFrom(const BSONObj &obj); bool parseFrom(const BSONObj &obj);
bool satisfiesPredicate(const GeometryContainer &otherContainer) co nst; bool satisfiesPredicate(const GeometryContainer &otherContainer) co nst;
bool hasS2Region() const; bool hasS2Region() const;
const S2Region& getRegion() const; const S2Region& getRegion() const;
string getField() const { return field; } string getField() const { return field; }
Predicate getPred() const { return predicate; }
const GeometryContainer& getGeometry() const { return geoContainer;
}
private: private:
// Try to parse the provided object into the right place. // Try to parse the provided object into the right place.
bool parseLegacyQuery(const BSONObj &obj); bool parseLegacyQuery(const BSONObj &obj);
bool parseNewQuery(const BSONObj &obj); bool parseNewQuery(const BSONObj &obj);
// Name of the field in the query. // Name of the field in the query.
string field; string field;
GeometryContainer geoContainer; GeometryContainer geoContainer;
Predicate predicate; Predicate predicate;
}; };
 End of changes. 10 change blocks. 
22 lines changed or deleted 57 lines changed or added


 goodies.h   goodies.h 
skipping to change at line 21 skipping to change at line 21
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
#include <iostream>
#include <sstream> #include <sstream>
#include <boost/detail/endian.hpp> #include <boost/detail/endian.hpp>
#include <boost/intrusive_ptr.hpp>
#include <boost/scoped_array.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include "mongo/bson/util/misc.h" #include "mongo/bson/util/misc.h"
namespace mongo { namespace mongo {
/* @return a dump of the buffer as hex byte ascii output */ /* @return a dump of the buffer as hex byte ascii output */
string hexdump(const char *data, unsigned len); string hexdump(const char *data, unsigned len);
template<class T> template<class T>
inline string ToString(const T& t) { inline string ToString(const T& t) {
stringstream s; std::stringstream s;
s << t; s << t;
return s.str(); return s.str();
} }
bool isPrime(int n); bool isPrime(int n);
int nextPrime(int n); int nextPrime(int n);
inline void dumpmemory(const char *data, int len) { inline void dumpmemory(const char *data, int len) {
if ( len > 1024 ) if ( len > 1024 )
len = 1024; len = 1024;
try { try {
const char *q = data; const char *q = data;
const char *p = q; const char *p = q;
while ( len > 0 ) { while ( len > 0 ) {
for ( int i = 0; i < 16; i++ ) { for ( int i = 0; i < 16; i++ ) {
if ( *p >= 32 && *p <= 126 ) if ( *p >= 32 && *p <= 126 )
cout << *p; std::cout << *p;
else else
cout << '.'; std::cout << '.';
p++; p++;
} }
cout << " "; std::cout << " ";
p -= 16; p -= 16;
for ( int i = 0; i < 16; i++ ) for ( int i = 0; i < 16; i++ )
cout << (unsigned) ((unsigned char)*p++) << ' '; std::cout << (unsigned) ((unsigned char)*p++) << ' ';
cout << endl; std::cout << std::endl;
len -= 16; len -= 16;
} }
} }
catch (...) { catch (...) {
} }
} }
// PRINT(2+2); prints "2+2: 4" // PRINT(2+2); prints "2+2: 4"
#define MONGO_PRINT(x) cout << #x ": " << (x) << endl #define MONGO_PRINT(x) std::cout << #x ": " << (x) << std::endl
#define PRINT MONGO_PRINT #define PRINT MONGO_PRINT
// PRINTFL; prints file:line // PRINTFL; prints file:line
#define MONGO_PRINTFL cout << __FILE__ ":" << __LINE__ << endl #define MONGO_PRINTFL std::cout << __FILE__ ":" << __LINE__ << std::endl
#define PRINTFL MONGO_PRINTFL #define PRINTFL MONGO_PRINTFL
#define MONGO_FLOG log() << __FILE__ ":" << __LINE__ << endl #define MONGO_FLOG log() << __FILE__ ":" << __LINE__ << std::endl
#define FLOG MONGO_FLOG #define FLOG MONGO_FLOG
inline bool startsWith(const char *str, const char *prefix) { inline bool startsWith(const char *str, const char *prefix) {
size_t l = strlen(prefix); size_t l = strlen(prefix);
if ( strlen(str) < l ) return false; if ( strlen(str) < l ) return false;
return strncmp(str, prefix, l) == 0; return strncmp(str, prefix, l) == 0;
} }
inline bool startsWith(const std::string& s, const std::string& p) { inline bool startsWith(const std::string& s, const std::string& p) {
return startsWith(s.c_str(), p.c_str()); return startsWith(s.c_str(), p.c_str());
} }
skipping to change at line 179 skipping to change at line 184
bool empty() const { bool empty() const {
return _buf == 0 || _buf[0] == 0; return _buf == 0 || _buf[0] == 0;
} }
private: private:
size_t _size; size_t _size;
char * _buf; char * _buf;
}; };
ostream& operator<<( ostream &s, const ThreadSafeString &o ); std::ostream& operator<<(std::ostream &s, const ThreadSafeString &o);
/** A generic pointer type for function arguments. /** A generic pointer type for function arguments.
* It will convert from any pointer type except auto_ptr. * It will convert from any pointer type except auto_ptr.
* Semantics are the same as passing the pointer returned from get() * Semantics are the same as passing the pointer returned from get()
* const ptr<T> => T * const * const ptr<T> => T * const
* ptr<const T> => T const * or const T* * ptr<const T> => T const * or const T*
*/ */
template <typename T> template <typename T>
struct ptr { struct ptr {
 End of changes. 11 change blocks. 
10 lines changed or deleted 15 lines changed or added


 grid.h   grid.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/posix_time/posix_time.hpp>
#include "mongo/util/time_support.h" #include "mongo/util/time_support.h"
#include "mongo/util/concurrency/mutex.h" #include "mongo/util/concurrency/mutex.h"
#include "config.h" // DBConfigPtr #include "config.h" // DBConfigPtr
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 hash.h   hash.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include <iostream> #include <iostream>
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 hash_access_method.h   hash_access_method.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/hasher.h" // For HashSeed. #include "mongo/db/hasher.h" // For HashSeed.
#include "mongo/db/index/index_descriptor.h" #include "mongo/db/index/index_descriptor.h"
#include "mongo/db/index/btree_access_method_internal.h" #include "mongo/db/index/btree_access_method_internal.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 hash_index_cursor.h   hash_index_cursor.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <vector> #include <vector>
#include "mongo/db/btreecursor.h" #include "mongo/db/btreecursor.h"
#include "mongo/db/hasher.h" #include "mongo/db/hasher.h"
#include "mongo/db/index/index_cursor.h" #include "mongo/db/index/index_cursor.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 hash_namespace.h   hash_namespace.h 
skipping to change at line 18 skipping to change at line 18
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
// NOTE(acm): Before gcc-4.7, __cplusplus is always defined to be 1, // We need to drag in a C++ header so we can examine __GXX_EXPERIMENTAL_CXX
// so we can't reliably detect C++11 support by exclusively checking 0X__ or
// the value of __cplusplus. // _LIBCPP_VERSION meaningfully. The <new> header is pretty lightweight, mo
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) stly unavoidable,
// and almost certain to bring in the standard library configuration macros
.
#include <new>
// NOTE(acm): Before gcc-4.7, __cplusplus is always defined to be 1, so we
can't reliably
// detect C++11 support by exclusively checking the value of __cplusplus.
Additionaly, libc++,
// whether in C++11 or C++03 mode, doesn't use TR1 and drops things into st
d instead.
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || define
d(_LIBCPP_VERSION)
#include <functional> #include <functional>
#define MONGO_HASH_NAMESPACE_START namespace std { #define MONGO_HASH_NAMESPACE_START namespace std {
#define MONGO_HASH_NAMESPACE_END } #define MONGO_HASH_NAMESPACE_END }
#define MONGO_HASH_NAMESPACE std
#elif defined(_MSC_VER) && _MSC_VER >= 1500 #elif defined(_MSC_VER) && _MSC_VER >= 1500
#if _MSC_VER >= 1600 /* Visual Studio 2010+ */ #if _MSC_VER >= 1600 /* Visual Studio 2010+ */
#include <functional> #include <functional>
#define MONGO_HASH_NAMESPACE_START namespace std { #define MONGO_HASH_NAMESPACE_START namespace std {
#define MONGO_HASH_NAMESPACE_END } #define MONGO_HASH_NAMESPACE_END }
#define MONGO_HASH_NAMESPACE std
#else /* Older Visual Studio */ #else /* Older Visual Studio */
#include <tr1/functional> #include <tr1/functional>
#define MONGO_HASH_NAMESPACE_START namespace std { namespace tr1 { #define MONGO_HASH_NAMESPACE_START namespace std { namespace tr1 {
#define MONGO_HASH_NAMESPACE_END }} #define MONGO_HASH_NAMESPACE_END }}
#define MONGO_HASH_NAMESPACE std::tr1
#endif #endif
#elif defined(__GNUC__) #elif defined(__GNUC__)
#include <tr1/functional> #include <tr1/functional>
#define MONGO_HASH_NAMESPACE_START namespace std { namespace tr1 { #define MONGO_HASH_NAMESPACE_START namespace std { namespace tr1 {
#define MONGO_HASH_NAMESPACE_END }} #define MONGO_HASH_NAMESPACE_END }}
#define MONGO_HASH_NAMESPACE std::tr1
#else #else
#error "Cannot determine namespace for 'hash'" #error "Cannot determine namespace for 'hash'"
#endif #endif
 End of changes. 5 change blocks. 
4 lines changed or deleted 20 lines changed or added


 hasher.h   hasher.h 
skipping to change at line 20 skipping to change at line 20
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/bson/bsonelement.h" #include "mongo/bson/bsonelement.h"
#include "mongo/util/md5.hpp" #include "mongo/util/md5.hpp"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 haystack_access_method.h   haystack_access_method.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/index/btree_access_method_internal.h" #include "mongo/db/index/btree_access_method_internal.h"
#include "mongo/db/index/index_descriptor.h" #include "mongo/db/index/index_descriptor.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 haystack_access_method_internal.h   haystack_access_method_internal.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <vector> #include <vector>
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/geo/core.h" #include "mongo/db/geo/core.h"
#include "mongo/db/geo/shapes.h" #include "mongo/db/geo/shapes.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 health.h   health.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
/* throws */ /* throws */
bool requestHeartbeat(const std::string& setname, bool requestHeartbeat(const std::string& setname,
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 heapcheck.h   heapcheck.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#if defined(HEAP_CHECKING) #if defined(HEAP_CHECKING)
#include <google/heap-checker.h> #include <google/heap-checker.h>
#define IGNORE_OBJECT( a ) HeapLeakChecker::IgnoreObject( a ) #define IGNORE_OBJECT( a ) HeapLeakChecker::IgnoreObject( a )
#define UNIGNORE_OBJECT( a ) HeapLeakChecker::UnIgnoreObject( a ) #define UNIGNORE_OBJECT( a ) HeapLeakChecker::UnIgnoreObject( a )
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 histogram.h   histogram.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#ifndef UTIL_HISTOGRAM_HEADER #ifndef UTIL_HISTOGRAM_HEADER
#define UTIL_HISTOGRAM_HEADER #define UTIL_HISTOGRAM_HEADER
#include <string> #include <string>
#include <stdint.h> #include <stdint.h>
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 hostandport.h   hostandport.h 
skipping to change at line 21 skipping to change at line 21
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
#include "mongo/bson/util/builder.h" #include "mongo/bson/util/builder.h"
#include "mongo/db/cmdline.h" #include "mongo/db/server_options.h"
#include "mongo/util/mongoutils/str.h" #include "mongo/util/mongoutils/str.h"
#include "mongo/util/net/sock.h" #include "mongo/util/net/sock.h"
namespace mongo { namespace mongo {
using namespace mongoutils; using namespace mongoutils;
/** helper for manipulating host:port connection endpoints. /** helper for manipulating host:port connection endpoints.
*/ */
struct HostAndPort { struct HostAndPort {
HostAndPort() : _port(-1) { } HostAndPort() : _port(-1) { }
/** From a string hostname[:portnumber] /** From a string hostname[:portnumber]
Throws user assertion if bad config string or bad port #. Throws user assertion if bad config string or bad port #.
*/ */
HostAndPort(const std::string& s); HostAndPort(const std::string& s);
/** @param p port number. -1 is ok to use default. */ /** @param p port number. -1 is ok to use default. */
HostAndPort(const std::string& h, int p /*= -1*/) : _host(h), _port (p) { HostAndPort(const std::string& h, int p /*= -1*/) : _host(h), _port (p) {
verify( !str::startsWith(h, '#') ); verify(!mongoutils::str::startsWith(h, '#'));
} }
HostAndPort(const SockAddr& sock ) : _host( sock.getAddr() ) , _por t( sock.getPort() ) { } HostAndPort(const SockAddr& sock ) : _host( sock.getAddr() ) , _por t( sock.getPort() ) { }
static HostAndPort me(); static HostAndPort me();
bool operator<(const HostAndPort& r) const { bool operator<(const HostAndPort& r) const {
string h = host(); string h = host();
string rh = r.host(); string rh = r.host();
if( h < rh ) if( h < rh )
skipping to change at line 87 skipping to change at line 87
bool empty() const { bool empty() const {
return _host.empty() && _port < 0; return _host.empty() && _port < 0;
} }
string host() const { string host() const {
return _host; return _host;
} }
int port() const { int port() const {
if (hasPort()) if (hasPort())
return _port; return _port;
return CmdLine::DefaultDBPort; return ServerGlobalParams::DefaultDBPort;
} }
bool hasPort() const { bool hasPort() const {
return _port >= 0; return _port >= 0;
} }
void setPort( int port ) { void setPort( int port ) {
_port = port; _port = port;
} }
private: private:
void init(const char *); void init(const char *);
string _host; string _host;
int _port; // -1 indicates unspecified int _port; // -1 indicates unspecified
}; };
inline HostAndPort HostAndPort::me() { inline HostAndPort HostAndPort::me() {
const char* ips = cmdLine.bind_ip.c_str(); const char* ips = serverGlobalParams.bind_ip.c_str();
while(*ips) { while(*ips) {
string ip; string ip;
const char * comma = strchr(ips, ','); const char * comma = strchr(ips, ',');
if (comma) { if (comma) {
ip = string(ips, comma - ips); ip = string(ips, comma - ips);
ips = comma + 1; ips = comma + 1;
} }
else { else {
ip = string(ips); ip = string(ips);
ips = ""; ips = "";
} }
HostAndPort h = HostAndPort(ip, cmdLine.port); HostAndPort h = HostAndPort(ip, serverGlobalParams.port);
if (!h.isLocalHost()) { if (!h.isLocalHost()) {
return h; return h;
} }
} }
string h = getHostName(); string h = getHostName();
verify( !h.empty() ); verify( !h.empty() );
verify( h != "localhost" ); verify( h != "localhost" );
return HostAndPort(h, cmdLine.port); return HostAndPort(h, serverGlobalParams.port);
} }
inline string HostAndPort::toString( bool includePort ) const { inline string HostAndPort::toString( bool includePort ) const {
if ( ! includePort ) if ( ! includePort )
return host(); return host();
StringBuilder ss; StringBuilder ss;
append( ss ); append( ss );
return ss.str(); return ss.str();
} }
inline void HostAndPort::append( StringBuilder& ss ) const { inline void HostAndPort::append( StringBuilder& ss ) const {
ss << host(); ss << host();
int p = port(); int p = port();
if ( p != -1 ) { if ( p != -1 ) {
ss << ':'; ss << ':';
#if defined(_DEBUG) #if defined(_DEBUG)
if( p >= 44000 && p < 44100 ) { if( p >= 44000 && p < 44100 ) {
log() << "warning: special debug port 44xxx used" << endl; log() << "warning: special debug port 44xxx used" << std::e ndl;
ss << p+1; ss << p+1;
} }
else else
ss << p; ss << p;
#else #else
ss << p; ss << p;
#endif #endif
} }
} }
inline bool HostAndPort::isLocalHost() const { inline bool HostAndPort::isLocalHost() const {
string _host = host(); string _host = host();
return ( _host == "localhost" return ( _host == "localhost"
|| startsWith(_host.c_str(), "127.") || mongoutils::str::startsWith(_host.c_str(), "127.")
|| _host == "::1" || _host == "::1"
|| _host == "anonymous unix socket" || _host == "anonymous unix socket"
|| _host.c_str()[0] == '/' // unix socket || _host.c_str()[0] == '/' // unix socket
); );
} }
inline void HostAndPort::init(const char *p) { inline void HostAndPort::init(const char *p) {
massert(13110, "HostAndPort: host is empty", *p); massert(13110, "HostAndPort: host is empty", *p);
const char *colon = strrchr(p, ':'); const char *colon = strrchr(p, ':');
if( colon ) { if( colon ) {
 End of changes. 8 change blocks. 
8 lines changed or deleted 8 lines changed or added


 html.h   html.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
/* Things in the mongoutils namespace /* Things in the mongoutils namespace
(1) are not database specific, rather, true utilities (1) are not database specific, rather, true utilities
(2) are cross platform (2) are cross platform
(3) may require boost headers, but not libs (3) may require boost headers, but not libs
(4) are clean and easy to use in any c++ project without pulling in lots of other stuff (4) are clean and easy to use in any c++ project without pulling in lots of other stuff
*/ */
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 index.h   index.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include <vector> #include <vector>
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
skipping to change at line 108 skipping to change at line 120
s += ".$"; s += ".$";
s += io.getStringField("name"); s += io.getStringField("name");
return s; return s;
} }
string indexName() const { // e.g. "ts_1" string indexName() const { // e.g. "ts_1"
BSONObj io = info.obj(); BSONObj io = info.obj();
return io.getStringField("name"); return io.getStringField("name");
} }
// TODO: Move elsewhere. Currently also lives in db/query/query_pl anner.cpp.
static bool isIdIndexPattern( const BSONObj &pattern ) { static bool isIdIndexPattern( const BSONObj &pattern ) {
BSONObjIterator i(pattern); BSONObjIterator i(pattern);
BSONElement e = i.next(); BSONElement e = i.next();
//_id index must have form exactly {_id : 1} or {_id : -1}. //_id index must have form exactly {_id : 1} or {_id : -1}.
//Allows an index of form {_id : "hashed"} to exist but //Allows an index of form {_id : "hashed"} to exist but
//do not consider it to be the primary _id index //do not consider it to be the primary _id index
if(! ( strcmp(e.fieldName(), "_id") == 0 if(! ( strcmp(e.fieldName(), "_id") == 0
&& (e.numberInt() == 1 || e.numberInt() == -1))) && (e.numberInt() == 1 || e.numberInt() == -1)))
return false; return false;
return i.next().eoo(); return i.next().eoo();
skipping to change at line 179 skipping to change at line 192
/** @return true if supported. supported means we can use the inde x, including adding new keys. /** @return true if supported. supported means we can use the inde x, including adding new keys.
it may not mean we can build the index version in quest ion: we may not maintain building it may not mean we can build the index version in quest ion: we may not maintain building
of indexes in old formats in the future. of indexes in old formats in the future.
*/ */
static bool isASupportedIndexVersionNumber(int v) { return (v&1)==v ; } // v == 0 || v == 1 static bool isASupportedIndexVersionNumber(int v) { return (v&1)==v ; } // v == 0 || v == 1
}; };
class NamespaceDetails; class NamespaceDetails;
// changedId should be initialized to false // changedId should be initialized to false
// @return how many things were deleted // @return how many things were deleted
int assureSysIndexesEmptied(const char *ns, IndexDetails *exceptForIdIn int assureSysIndexesEmptied(const StringData& ns, IndexDetails *exceptF
dex); orIdIndex);
int removeFromSysIndexes(const char *ns, const char *idxName); int removeFromSysIndexes(const StringData& ns, const StringData& idxNam
e);
/** /**
* Prepare to build an index. Does not actually build it (except for a special _id case). * Prepare to build an index. Does not actually build it (except for a special _id case).
* - We validate that the params are good * - We validate that the params are good
* - That the index does not already exist * - That the index does not already exist
* - Creates the source collection if it DNE * - Creates the source collection if it DNE
* *
* example of 'io': * example of 'io':
* { ns : 'test.foo', name : 'z', key : { z : 1 } } * { ns : 'test.foo', name : 'z', key : { z : 1 } }
* *
 End of changes. 3 change blocks. 
3 lines changed or deleted 25 lines changed or added


 index_access_method.h   index_access_method.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/index/index_cursor.h" #include "mongo/db/index/index_cursor.h"
#include "mongo/db/index/index_descriptor.h" #include "mongo/db/index/index_descriptor.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/namespace_details.h" #include "mongo/db/namespace_details.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 index_bounds.h   index_bounds.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/query/interval.h"
namespace mongo { namespace mongo {
/** /**
* A range of values for one field.
*/
struct Interval {
// Start and End must be ordered according to the index order.
BSONElement start;
bool startInclusive;
BSONElement end;
bool endInclusive;
// No BSONValue means we have to keep a BSONObj and pointers (BSONE
lement) into it.
// 'start' may not point at the first field in _intervalData.
// 'end' may not point at the last field in _intervalData.
// 'start' and 'end' may point at the same field.
BSONObj _intervalData;
};
/**
* An ordered list of intervals for one field. * An ordered list of intervals for one field.
*/ */
struct OrderedIntervalList { struct OrderedIntervalList {
OrderedIntervalList() { }
OrderedIntervalList(const string& n) : name(n) { } OrderedIntervalList(const string& n) : name(n) { }
// Must be ordered according to the index order. // Must be ordered according to the index order.
vector<Interval> intervals; vector<Interval> intervals;
// TODO: We could drop this. Only used in IndexBounds::isValidFor. // TODO: We could drop this. Only used in IndexBounds::isValidFor.
string name; string name;
bool isValidFor(int expectedOrientation) const;
std::string toString() const;
}; };
/** /**
* Tied to an index. Permissible values for all fields in the index. Requires the index to * Tied to an index. Permissible values for all fields in the index. Requires the index to
* interpret. Previously known as FieldRangeVector. * interpret. Previously known as FieldRangeVector.
*/ */
struct IndexBounds { struct IndexBounds {
IndexBounds() : isSimpleRange(false) { }
// For each indexed field, the values that the field is allowed to take on. // For each indexed field, the values that the field is allowed to take on.
vector<OrderedIntervalList> fields; vector<OrderedIntervalList> fields;
string toString() const;
// Debugging check. // Debugging check.
// We must have as many fields the key pattern does. // We must have as many fields the key pattern does.
// The fields must be oriented in the direction we'd encounter them given the indexing // The fields must be oriented in the direction we'd encounter them given the indexing
// direction (the value of the field in keyPattern) and index trave rsal direction provided // direction (the value of the field in keyPattern) and index trave rsal direction provided
// by 'direction'. // by 'direction'.
// //
// An example: [7, 20] // An example: [7, 20]
// We can traverse this forward if indexed ascending // We can traverse this forward if indexed ascending
// We can traverse this backwards if indexed descending. // We can traverse this backwards if indexed descending.
bool isValidFor(const BSONObj& keyPattern, int direction); bool isValidFor(const BSONObj& keyPattern, int direction);
// Methods below used for debugging purpose only. Do not use outsid
e testing code.
size_t size() const;
std::string getFieldName(size_t i) const;
size_t getNumIntervals(size_t i) const;
Interval getInterval(size_t i, size_t j) const;
std::string toString() const;
BSONObj toBSON() const;
// TODO: KILL THIS? // TODO: KILL THIS?
// We need this for legacy non-index indices (2d/2dsphere) that tak e a BSONObj and don't // We need this for legacy non-index indices (2d/2dsphere) that tak e a BSONObj and don't
// deal with the kind of absurd Btree-only behavior of IndexBoundsC hecker. // deal with the kind of absurd Btree-only behavior of IndexBoundsC hecker.
bool isSimpleRange; bool isSimpleRange;
BSONObj startKey; BSONObj startKey;
BSONObj endKey; BSONObj endKey;
bool endKeyInclusive; bool endKeyInclusive;
}; };
/** /**
skipping to change at line 103 skipping to change at line 110
* keyPattern is the index that we're iterating over. * keyPattern is the index that we're iterating over.
* bounds are the bounds we're allowed to iterate over. * bounds are the bounds we're allowed to iterate over.
* direction is the direction we're moving over the index, 1 or -1. * direction is the direction we're moving over the index, 1 or -1.
* *
* Bounds not owned by us. * Bounds not owned by us.
*/ */
IndexBoundsChecker(const IndexBounds* bounds, const BSONObj& keyPat tern, int direction); IndexBoundsChecker(const IndexBounds* bounds, const BSONObj& keyPat tern, int direction);
/** /**
* Get the key that we should with. * Get the key that we should with.
*
* Returns true if there is a valid start key. Returns false other
wise.
*/ */
void getStartKey(vector<const BSONElement*>* valueOut, vector<bool> * inclusiveOut); bool getStartKey(vector<const BSONElement*>* valueOut, vector<bool> * inclusiveOut);
/** /**
* The states of a key from an index scan. See checkKey below. * The states of a key from an index scan. See checkKey below.
*/ */
enum KeyState { enum KeyState {
VALID, VALID,
MUST_ADVANCE, MUST_ADVANCE,
DONE, DONE,
}; };
 End of changes. 10 change blocks. 
22 lines changed or deleted 40 lines changed or added


 index_builder.h   index_builder.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/util/background.h" #include "mongo/util/background.h"
/** /**
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 index_cursor.h   index_cursor.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <vector> #include <vector>
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 index_descriptor.h   index_descriptor.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/db/index.h" // For IndexDetails. #include "mongo/db/index.h" // For IndexDetails.
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/namespace_details.h" // For NamespaceDetails. #include "mongo/db/namespace_details.h" // For NamespaceDetails.
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 index_legacy.h   index_legacy.h 
skipping to change at line 16 skipping to change at line 16
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
class IndexDetails; class IndexDetails;
class NamespaceDetails; class NamespaceDetails;
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 index_names.h   index_names.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
namespace mongo { namespace mongo {
using std::string; using std::string;
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 index_rebuilder.h   index_rebuilder.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/namespace_details.h" #include "mongo/db/namespace_details.h"
#include "mongo/util/background.h" #include "mongo/util/background.h"
namespace mongo { namespace mongo {
// This is a job that's only run at startup. It finds all incomplete in dices and // This is a job that's only run at startup. It finds all incomplete in dices and
// finishes rebuilding them. After they complete rebuilding, the thread terminates. // finishes rebuilding them. After they complete rebuilding, the thread terminates.
class IndexRebuilder : public BackgroundJob { class IndexRebuilder : public BackgroundJob {
public: public:
IndexRebuilder(); IndexRebuilder();
std::string name() const; std::string name() const;
void run(); void run();
private: private:
/** /**
* Check each collection in a database to see if it has any in-prog * Check each collection in the passed in vector to see if it has a
ress index builds that ny in-progress index
* need to be retried. If so, calls retryIndexBuild. * builds that need to be retried. If so, calls retryIndexBuild.
*/ */
void checkDB(const std::string& dbname, bool* firstTime); void checkNS(const std::vector<std::string>& nsToCheck);
/** /**
* Actually retry an index build on a given namespace. * Actually retry an index build on a given namespace.
* @param dbName the name of the database for accessing db.system.i ndexes * @param dbName the name of the database for accessing db.system.i ndexes
* @param nsd the namespace details of the namespace building the i ndex * @param nsd the namespace details of the namespace building the i ndex
* @param index the offset into nsd's index array of the partially- built index * @param index the offset into nsd's index array of the partially- built index
*/ */
void retryIndexBuild(const std::string& dbName, void retryIndexBuild(const std::string& dbName,
NamespaceDetails* nsd ); NamespaceDetails* nsd );
}; };
 End of changes. 3 change blocks. 
4 lines changed or deleted 24 lines changed or added


 index_scan.h   index_scan.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/exec/plan_stage.h" #include "mongo/db/exec/plan_stage.h"
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/index/btree_index_cursor.h" #include "mongo/db/index/btree_index_cursor.h"
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/matcher/expression.h" #include "mongo/db/matcher/expression.h"
#include "mongo/db/query/index_bounds.h" #include "mongo/db/query/index_bounds.h"
#include "mongo/platform/unordered_set.h" #include "mongo/platform/unordered_set.h"
namespace mongo { namespace mongo {
class IndexAccessMethod; class IndexAccessMethod;
class IndexCursor; class IndexCursor;
class IndexDescriptor; class IndexDescriptor;
 End of changes. 2 change blocks. 
0 lines changed or deleted 21 lines changed or added


 index_selection.h   index_selection.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
class BSONObj; class BSONObj;
class FieldRangeSet; class FieldRangeSet;
enum IndexSuitability { USELESS = 0 , HELPFUL = 1 , OPTIMAL = 2 }; enum IndexSuitability { USELESS = 0 , HELPFUL = 1 , OPTIMAL = 2 };
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 index_set.h   index_set.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <set> #include <set>
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 index_update.h   index_update.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/index.h" #include "mongo/db/index.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/platform/cstdint.h" #include "mongo/platform/cstdint.h"
namespace mongo { namespace mongo {
skipping to change at line 43 skipping to change at line 55
// If background is false, uses fast index builder // If background is false, uses fast index builder
// If background is true, uses background index builder; blocks until d one. // If background is true, uses background index builder; blocks until d one.
void buildAnIndex(const std::string& ns, void buildAnIndex(const std::string& ns,
NamespaceDetails *d, NamespaceDetails *d,
IndexDetails& idx, IndexDetails& idx,
bool mayInterrupt); bool mayInterrupt);
// add index keys for a newly inserted record // add index keys for a newly inserted record
void indexRecord(const char *ns, NamespaceDetails *d, const BSONObj& ob j, const DiskLoc &loc); void indexRecord(const char *ns, NamespaceDetails *d, const BSONObj& ob j, const DiskLoc &loc);
bool dropIndexes(NamespaceDetails *d, const char *ns, const char *name, string &errmsg, bool dropIndexes(NamespaceDetails *d, const StringData& ns, const Strin gData& name, string &errmsg,
BSONObjBuilder &anObjBuilder, bool maydeleteIdIndex ); BSONObjBuilder &anObjBuilder, bool maydeleteIdIndex );
/** /**
* Add an _id index to namespace @param 'ns' if not already present. * Add an _id index to namespace @param 'ns' if not already present.
* @param mayInterrupt When true, killop may interrupt the function cal l. * @param mayInterrupt When true, killop may interrupt the function cal l.
*/ */
void ensureHaveIdIndex(const char* ns, bool mayInterrupt); void ensureHaveIdIndex(const char* ns, bool mayInterrupt);
} // namespace mongo } // namespace mongo
 End of changes. 2 change blocks. 
1 lines changed or deleted 21 lines changed or added


 init.h   init.h 
skipping to change at line 17 skipping to change at line 17
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
/** /**
* Utility macros for declaring global initializers and configurable variab les. * Utility macros for declaring global initializers
* *
* Should NOT be included by other header files. Include only in source fi les. * Should NOT be included by other header files. Include only in source fi les.
* *
* Initializers are arranged in an acyclic directed dependency graph. Decl aring * Initializers are arranged in an acyclic directed dependency graph. Decl aring
* a cycle will lead to a runtime error. * a cycle will lead to a runtime error.
* *
* Initializer functions take a parameter of type ::mongo::InitializerConte xt*, and return * Initializer functions take a parameter of type ::mongo::InitializerConte xt*, and return
* a Status. Any status other than Status::OK() is considered a failure th at will stop further * a Status. Any status other than Status::OK() is considered a failure th at will stop further
* intializer processing. * intializer processing.
*
* Global configuration variables are declared and set using initializers a
nd a few groups. All
* global configuration declarations have "globalVariableConfigurationStart
ed" as a prerequisite,
* and "globalVariablesDeclared" as a dependent. The easiest way for progr
ams to then configure
* those values to non-default settings is to use the MONGO_CONFIG_VARIABLE
_SETTER macro
* to declare exactly one function that has "globalVariablesDeclared" as a
prerequisite and
* "globalVariablesSet" as a dependent.
*
* Initializers that wish to use configurable global variables must have "g
lobalVariablesConfigured"
* as a direct or indirect prerequisite. The "default" prerequisite depend
s on
* "globalVariablesConfigured", so most initializer functions can safely us
e global configurable
* variables.
*
* Programmers may validate global variables after they are set using an in
itializer declared as
* MONGO_CONFIG_VARIABLE_VALIDATOR, which has "globalVariablesSet" as prere
quisite and
* "globalVariablesConfigured" as dependent.
*
* In summary, the following partial order is provided:
* All MONGO_CONFIG_VARIABLE_REGISTER()s are evaluated before
* The MONGO_CONFIG_VARIABLE_SETTER is evaluated before
* All MONGO_CONFIG_VARIABLE_VALIDATORs are evaluated before
* Things dependent on "default" are evaluated.
*/ */
#pragma once #pragma once
#include "mongo/base/configuration_variable_manager.h"
#include "mongo/base/initializer.h" #include "mongo/base/initializer.h"
#include "mongo/base/initializer_context.h" #include "mongo/base/initializer_context.h"
#include "mongo/base/initializer_function.h" #include "mongo/base/initializer_function.h"
#include "mongo/base/global_initializer.h" #include "mongo/base/global_initializer.h"
#include "mongo/base/global_initializer_registerer.h" #include "mongo/base/global_initializer_registerer.h"
#include "mongo/base/make_string_vector.h" #include "mongo/base/make_string_vector.h"
#include "mongo/base/status.h" #include "mongo/base/status.h"
/** /**
* Convenience parameter representing an empty set of prerequisites for an initializer function. * Convenience parameter representing an empty set of prerequisites for an initializer function.
skipping to change at line 152 skipping to change at line 129
* *
* An initializer group is an initializer that performs no actions. It is useful for organizing * An initializer group is an initializer that performs no actions. It is useful for organizing
* initialization steps into phases, such as "all global parameter declarat ions completed", "all * initialization steps into phases, such as "all global parameter declarat ions completed", "all
* global parameters initialized". * global parameters initialized".
*/ */
#define MONGO_INITIALIZER_GROUP(NAME, PREREQUISITES, DEPENDENTS) \ #define MONGO_INITIALIZER_GROUP(NAME, PREREQUISITES, DEPENDENTS) \
MONGO_INITIALIZER_GENERAL(NAME, PREREQUISITES, DEPENDENTS)( \ MONGO_INITIALIZER_GENERAL(NAME, PREREQUISITES, DEPENDENTS)( \
::mongo::InitializerContext*) { return ::mongo::Status::OK(); } ::mongo::InitializerContext*) { return ::mongo::Status::OK(); }
/** /**
* Macro to register a configurable global variable.
*
* "NAME" is the string name through which the variable's storage may be ac
cessed
* in the ConfigurationVariableManager supplied as part of the InitializerC
ontext
* to global initializer functions. "STORAGE" is a pointer to the location
in
* memory where the variable is stored, and "DEFAULT_VALUE" is the value to
be
* assigned as the default, at registration time (once main has started).
This
* allows DEFAULT_VALUE to be constructed after main() begins, so some opti
ons
* that are not available to static initializers may be available here.
*/
#define MONGO_CONFIG_VARIABLE_REGISTER(NAME, STORAGE, DEFAULT_VALUE) \
MONGO_INITIALIZER_GENERAL(cvr_##NAME, \
("globalVariableConfigurationStarted"), \
("globalVariablesDeclared"))( \
::mongo::InitializerContext* context)
{ \
*(STORAGE) = (DEFAULT_VALUE); \
return ::mongo::getGlobalInitializer().getConfigurationVariableMana
ger().registerVariable( \
#NAME, (STORAGE)); \
}
/**
* Convenience macro for functions that validate already-set values of glob
al
* variables. Run after the MONGO_CONFIG_VARIABLE_SETTER completes.
*/
#define MONGO_CONFIG_VARIABLE_VALIDATOR(NAME) \
MONGO_INITIALIZER_GENERAL(NAME, ("globalVariablesConfigured"), ("defaul
t"))
/**
* Convenience macro for declaring the global variable setting function.
*/
#define MONGO_CONFIG_VARIABLE_SETTER \
MONGO_INITIALIZER_GENERAL(globalVariableSetter, \
("globalVariablesDeclared"), \
("globalVariablesSet"))
/**
* Macro to produce a name for a mongo initializer function for an initiali zer operation * Macro to produce a name for a mongo initializer function for an initiali zer operation
* named "NAME". * named "NAME".
*/ */
#define _MONGO_INITIALIZER_FUNCTION_NAME(NAME) _mongoInitializerFunction_## NAME #define _MONGO_INITIALIZER_FUNCTION_NAME(NAME) _mongoInitializerFunction_## NAME
 End of changes. 4 change blocks. 
80 lines changed or deleted 1 lines changed or added


 initialize_server_global_state.h   initialize_server_global_state.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
/** /**
* Perform initialization activity common across all mongo server types . * Perform initialization activity common across all mongo server types .
* *
* Set up logging, daemonize the process, configure SSL, etc. * Set up logging, daemonize the process, configure SSL, etc.
*/ */
bool initializeServerGlobalState(); bool initializeServerGlobalState();
/** /**
* Forks and detaches the server, on platforms that support it, if cmdL * Forks and detaches the server, on platforms that support it, if serv
ine.doFork is true. erGlobalParams.doFork is
* true.
* *
* Call after processing the command line but before running mongo init ializers. * Call after processing the command line but before running mongo init ializers.
*/ */
void forkServerOrDie(); void forkServerOrDie();
/**
* Notify the parent that we forked from that we have successfully comp
leted basic
* initialization so it can stop waiting and exit.
*/
void signalForkSuccess();
void setupCoreSignals(); void setupCoreSignals();
} // namespace mongo } // namespace mongo
 End of changes. 3 change blocks. 
2 lines changed or deleted 30 lines changed or added


 initializer.h   initializer.h 
skipping to change at line 21 skipping to change at line 21
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/base/configuration_variable_manager.h"
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/initializer_context.h" #include "mongo/base/initializer_context.h"
#include "mongo/base/initializer_dependency_graph.h" #include "mongo/base/initializer_dependency_graph.h"
#include "mongo/base/status.h" #include "mongo/base/status.h"
namespace mongo { namespace mongo {
/** /**
* Class representing an initialization process. * Class representing an initialization process.
* *
* Such a process is described by a directed acyclic graph of initializ ation operations, the * Such a process is described by a directed acyclic graph of initializ ation operations, the
* InitializerDependencyGraph, and a collection of mutable global state * InitializerDependencyGraph. One constructs an initialization proces
, the s by adding nodes and
* ConfigurationVariableManager. One constructs an initialization proc * edges to the graph. Then, one executes the process, causing each in
ess by adding nodes and itialization operation to
* edges to the graph, and variable mappings in the variable manager. * execute in an order that respects the programmer-established prerequ
Then, one executes the istes.
* process, causing each initialization operation to execute in an orde
r that respects the
* programmer-established prerequistes.
*/ */
class Initializer { class Initializer {
MONGO_DISALLOW_COPYING(Initializer); MONGO_DISALLOW_COPYING(Initializer);
public: public:
Initializer(); Initializer();
~Initializer(); ~Initializer();
/** /**
* Get the initializer dependency graph, presumably for the purpose of adding more nodes. * Get the initializer dependency graph, presumably for the purpose of adding more nodes.
*/ */
InitializerDependencyGraph& getInitializerDependencyGraph() { retur n _graph; } InitializerDependencyGraph& getInitializerDependencyGraph() { retur n _graph; }
/** /**
* Get the configuration variable manager, for the purpose of descr
ibing more configurable
* variables.
*/
ConfigurationVariableManager& getConfigurationVariableManager() { r
eturn _configVariables; }
/**
* Execute the initializer process, using the given argv and enviro nment data as input. * Execute the initializer process, using the given argv and enviro nment data as input.
* *
* Returns Status::OK on success. All other returns constitute ini tialization failures, * Returns Status::OK on success. All other returns constitute ini tialization failures,
* and the thing being initialized should be considered dead in the water. * and the thing being initialized should be considered dead in the water.
*/ */
Status execute(const InitializerContext::ArgumentVector& args, Status execute(const InitializerContext::ArgumentVector& args,
const InitializerContext::EnvironmentMap& env) const ; const InitializerContext::EnvironmentMap& env) const ;
private: private:
InitializerDependencyGraph _graph; InitializerDependencyGraph _graph;
ConfigurationVariableManager _configVariables;
}; };
/** /**
* Run the global initializers. * Run the global initializers.
* *
* It's a programming error for this to fail, but if it does it will re turn a status other * It's a programming error for this to fail, but if it does it will re turn a status other
* than Status::OK. * than Status::OK.
* *
* This means that the few initializers that might want to terminate th e program by failing * This means that the few initializers that might want to terminate th e program by failing
* should probably arrange to terminate the process themselves. * should probably arrange to terminate the process themselves.
 End of changes. 4 change blocks. 
19 lines changed or deleted 6 lines changed or added


 initializer_context.h   initializer_context.h 
skipping to change at line 22 skipping to change at line 22
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
#include <map> #include <map>
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/base/configuration_variable_manager.h"
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
namespace mongo { namespace mongo {
/** /**
* Context of an initialization process. Passed as a parameter to init ialization functions. * Context of an initialization process. Passed as a parameter to init ialization functions.
* *
* See mongo/base/initializer.h and mongo/base/initializer_dependency_g raph.h for more details. * See mongo/base/initializer.h and mongo/base/initializer_dependency_g raph.h for more details.
*/ */
class InitializerContext { class InitializerContext {
MONGO_DISALLOW_COPYING(InitializerContext); MONGO_DISALLOW_COPYING(InitializerContext);
public: public:
typedef std::vector<std::string> ArgumentVector; typedef std::vector<std::string> ArgumentVector;
typedef std::map<std::string, std::string> EnvironmentMap; typedef std::map<std::string, std::string> EnvironmentMap;
InitializerContext(const ArgumentVector& args, InitializerContext(const ArgumentVector& args,
const EnvironmentMap& env, const EnvironmentMap& env);
const ConfigurationVariableManager* configVariab
les);
const ArgumentVector& args() const { return _args; } const ArgumentVector& args() const { return _args; }
const EnvironmentMap& env() const { return _env; } const EnvironmentMap& env() const { return _env; }
const ConfigurationVariableManager* configurationVariables() { retu rn _configVariables; }
private: private:
ArgumentVector _args; ArgumentVector _args;
EnvironmentMap _env; EnvironmentMap _env;
const ConfigurationVariableManager* _configVariables;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 4 change blocks. 
6 lines changed or deleted 1 lines changed or added


 instance.h   instance.h 
skipping to change at line 18 skipping to change at line 18
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/client/dbclientinterface.h" #include "mongo/client/dbclientinterface.h"
#include "mongo/db/client.h" #include "mongo/db/client.h"
#include "mongo/db/cmdline.h"
#include "mongo/db/curop-inl.h" #include "mongo/db/curop-inl.h"
#include "mongo/db/dbmessage.h" #include "mongo/db/dbmessage.h"
#include "mongo/db/storage_options.h"
namespace mongo { namespace mongo {
extern string dbExecCommand; extern string dbExecCommand;
/** a high level recording of operations to the database - sometimes us ed for diagnostics /** a high level recording of operations to the database - sometimes us ed for diagnostics
and debugging. and debugging.
*/ */
class DiagLog { class DiagLog {
ofstream *f; // note this is never freed ofstream *f; // note this is never freed
skipping to change at line 60 skipping to change at line 72
int setLevel( int newLevel ); int setLevel( int newLevel );
void flush(); void flush();
void writeop(char *data,int len); void writeop(char *data,int len);
void readop(char *data, int len); void readop(char *data, int len);
}; };
extern DiagLog _diaglog; extern DiagLog _diaglog;
void assembleResponse( Message &m, DbResponse &dbresponse, const HostAn dPort &client ); void assembleResponse( Message &m, DbResponse &dbresponse, const HostAn dPort &client );
void getDatabaseNames( vector< string > &names , const string& usePath void getDatabaseNames(vector<std::string> &names,
= dbpath ); const std::string& usePath = storageGlobalParams.
dbpath);
/* returns true if there is no data on this server. useful when starti ng replication. /* returns true if there is no data on this server. useful when starti ng replication.
local database does NOT count. local database does NOT count.
*/ */
bool replHasDatabases(); bool replHasDatabases();
/** "embedded" calls to the local server directly. /** "embedded" calls to the local server directly.
Caller does not need to lock, that is handled within. Caller does not need to lock, that is handled within.
*/ */
class DBDirectClient : public DBClientBase { class DBDirectClient : public DBClientBase {
 End of changes. 4 change blocks. 
3 lines changed or deleted 24 lines changed or added


 internal_plans.h   internal_plans.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/exec/collection_scan.h" #include "mongo/db/exec/collection_scan.h"
#include "mongo/db/query/eof_runner.h" #include "mongo/db/query/eof_runner.h"
#include "mongo/db/exec/fetch.h" #include "mongo/db/exec/fetch.h"
#include "mongo/db/exec/index_scan.h" #include "mongo/db/exec/index_scan.h"
#include "mongo/db/index/catalog_hack.h" #include "mongo/db/index/catalog_hack.h"
#include "mongo/db/query/internal_runner.h" #include "mongo/db/query/internal_runner.h"
#include "mongo/db/query/query_projection.h"
namespace mongo { namespace mongo {
/** /**
* The internal planner is a one-stop shop for "off-the-shelf" plans. Most internal procedures * The internal planner is a one-stop shop for "off-the-shelf" plans. Most internal procedures
* that do not require advanced queries could be served by plans alread y in here. * that do not require advanced queries could be served by plans alread y in here.
*/ */
class InternalPlanner { class InternalPlanner {
public: public:
enum Direction { enum Direction {
skipping to change at line 57 skipping to change at line 68
IXSCAN_FETCH = 1, IXSCAN_FETCH = 1,
}; };
/** /**
* Return a collection scan. Caller owns pointer. * Return a collection scan. Caller owns pointer.
*/ */
static Runner* collectionScan(const StringData& ns, static Runner* collectionScan(const StringData& ns,
const Direction direction = FORWARD, const Direction direction = FORWARD,
const DiskLoc startLoc = DiskLoc()) { const DiskLoc startLoc = DiskLoc()) {
NamespaceDetails* nsd = nsdetails(ns); NamespaceDetails* nsd = nsdetails(ns);
if (NULL == nsd) { return new EOFRunner(ns.toString()); } if (NULL == nsd) { return new EOFRunner(NULL, ns.toString()); }
CollectionScanParams params; CollectionScanParams params;
params.ns = ns.toString(); params.ns = ns.toString();
params.start = startLoc; params.start = startLoc;
if (FORWARD == direction) { if (FORWARD == direction) {
params.direction = CollectionScanParams::FORWARD; params.direction = CollectionScanParams::FORWARD;
} }
else { else {
params.direction = CollectionScanParams::BACKWARD; params.direction = CollectionScanParams::BACKWARD;
 End of changes. 3 change blocks. 
2 lines changed or deleted 21 lines changed or added


 internal_runner.h   internal_runner.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/clientcursor.h" #include <boost/scoped_ptr.hpp>
#include "mongo/db/query/canonical_query.h" #include <string>
#include "mongo/db/query/lite_parsed_query.h"
#include "mongo/db/query/plan_cache.h" #include "mongo/base/status.h"
#include "mongo/db/query/plan_executor.h"
#include "mongo/db/query/runner.h" #include "mongo/db/query/runner.h"
#include "mongo/db/query/stage_builder.h"
namespace mongo { namespace mongo {
class BSONObj;
class CanonicalQuery;
class DiskLoc;
class PlanExecutor;
class PlanStage;
struct QuerySolution;
class TypeExplain;
class WorkingSet;
/** /**
* This is a runner that was requested by an internal client of the que ry system, as opposed to * This is a runner that was requested by an internal client of the que ry system, as opposed to
* runners that are built in response to a query entering the system. I t is only used by * runners that are built in response to a query entering the system. I t is only used by
* internal clients of the query systems (e.g., chunk migration, index building, commands that * internal clients of the query systems (e.g., chunk migration, index building, commands that
* traverse data such as md5, ... ) * traverse data such as md5, ... )
* *
* The salient feature of this Runner is that it does not interact with the cache at all. * The salient feature of this Runner is that it does not interact with the cache at all.
*/ */
class InternalRunner : public Runner { class InternalRunner : public Runner {
public: public:
/**
* Takes ownership of all arguments.
*/
InternalRunner(const string& ns, PlanStage* root, WorkingSet* ws)
: _ns(ns), _exec(new PlanExecutor(ws, root)), _policy(Runner:
:YIELD_MANUAL) { }
virtual ~InternalRunner() { /** Takes ownership of all arguments. */
if (Runner::YIELD_AUTO == _policy) { InternalRunner(const string& ns, PlanStage* root, WorkingSet* ws);
ClientCursor::deregisterRunner(this);
}
}
Runner::RunnerState getNext(BSONObj* objOut, DiskLoc* dlOut) { virtual ~InternalRunner();
return _exec->getNext(objOut, dlOut);
}
virtual bool isEOF() { return _exec->isEOF(); } Runner::RunnerState getNext(BSONObj* objOut, DiskLoc* dlOut);
virtual void saveState() { _exec->saveState(); } virtual bool isEOF();
virtual bool restoreState() { return _exec->restoreState(); } virtual void saveState();
virtual const string& ns() { return _ns; } virtual bool restoreState();
virtual void invalidate(const DiskLoc& dl) { _exec->invalidate(dl); } virtual const std::string& ns();
virtual void setYieldPolicy(Runner::YieldPolicy policy) { virtual void invalidate(const DiskLoc& dl);
// No-op.
if (_policy == policy) { return; }
if (Runner::YIELD_AUTO == policy) { virtual void setYieldPolicy(Runner::YieldPolicy policy);
// Going from manual to auto.
ClientCursor::registerRunner(this);
}
else {
// Going from auto to manual.
ClientCursor::deregisterRunner(this);
}
_policy = policy; virtual void kill();
_exec->setYieldPolicy(policy);
}
virtual void kill() { _exec->kill(); } /**
* Returns OK, allocating and filling in '*explain' with details of
the plan used by
* this runner. Caller takes ownership of '*explain'. Otherwise, re
turn a status
* describing the error.
*
* Strictly speaking, an InternalRunner's explain is never exposed,
simply because an
* InternalRunner itself is not exposed. But we implement the expla
in here anyway so
* to help in debugging situations.
*/
virtual Status getExplainPlan(TypeExplain** explain) const;
private: private:
string _ns; std::string _ns;
scoped_ptr<PlanExecutor> _exec; boost::scoped_ptr<PlanExecutor> _exec;
Runner::YieldPolicy _policy; Runner::YieldPolicy _policy;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 18 change blocks. 
42 lines changed or deleted 60 lines changed or added


 interrupt_status.h   interrupt_status.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link th
e
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the GNU Affero General Public License in all respects f
or
* all of the code used other than as permitted herein. If you modify file(
s)
* with this exception, you may extend this exception to your version of th
e
* file(s), but you are not obligated to do so. If you do not wish to do so
,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also dele
te
* it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
/** /**
Abstraction for checking on interrupt status. Abstraction for checking on interrupt status.
The killCurrentOp object (currently declared in curop.h, and defined The killCurrentOp object (currently declared in curop.h, and defined
 End of changes. 1 change blocks. 
0 lines changed or deleted 18 lines changed or added


 interrupt_status_mongod.h   interrupt_status_mongod.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link th
e
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the GNU Affero General Public License in all respects f
or
* all of the code used other than as permitted herein. If you modify file(
s)
* with this exception, you may extend this exception to your version of th
e
* file(s), but you are not obligated to do so. If you do not wish to do so
,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also dele
te
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/interrupt_status.h" #include "mongo/db/interrupt_status.h"
namespace mongo { namespace mongo {
class InterruptStatusMongod : class InterruptStatusMongod :
public InterruptStatus, public InterruptStatus,
 End of changes. 1 change blocks. 
0 lines changed or deleted 18 lines changed or added


 interrupt_status_mongos.h   interrupt_status_mongos.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link th
e
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do no
t
* wish to do so, delete this exception statement from your version. If you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/interrupt_status.h" #include "mongo/db/interrupt_status.h"
namespace mongo { namespace mongo {
class InterruptStatusMongos : class InterruptStatusMongos :
public InterruptStatus, public InterruptStatus,
 End of changes. 1 change blocks. 
0 lines changed or deleted 14 lines changed or added


 intervalbtreecursor.h   intervalbtreecursor.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/btreeposition.h" #include "mongo/db/btreeposition.h"
#include "mongo/db/cursor.h" #include "mongo/db/cursor.h"
#include "mongo/db/namespace_details.h" #include "mongo/db/namespace_details.h"
#include "mongo/platform/cstdint.h" #include "mongo/platform/cstdint.h"
#include "mongo/platform/unordered_set.h" #include "mongo/platform/unordered_set.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 introspect.h   introspect.h 
skipping to change at line 18 skipping to change at line 18
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/pdfile.h" #include "mongo/db/pdfile.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 intrusive_counter.h   intrusive_counter.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link th
e
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do no
t
* wish to do so, delete this exception statement from your version. If you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <boost/intrusive_ptr.hpp> #include <boost/intrusive_ptr.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include "mongo/platform/atomic_word.h" #include "mongo/platform/atomic_word.h"
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 14 lines changed or added


 is_master.h   is_master.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/client.h" #include "mongo/db/client.h"
#include "mongo/db/database.h" #include "mongo/db/database.h"
#include "mongo/db/repl/master_slave.h" // replAllDead #include "mongo/db/repl/master_slave.h" // replAllDead
#include "mongo/db/repl/replication_server_status.h" // replSettings #include "mongo/db/repl/replication_server_status.h" // replSettings
#include "mongo/db/repl/rs.h" #include "mongo/db/repl/rs.h"
#include "mongo/util/mongoutils/str.h" #include "mongo/util/mongoutils/str.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 jsobjmanipulator.h   jsobjmanipulator.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
/** Manipulate the binary representation of a BSONElement in-place. /** Manipulate the binary representation of a BSONElement in-place.
Careful, this casts away const. Careful, this casts away const.
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 json.h   json.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonobj.h"
#include "mongo/base/status.h" #include "mongo/base/status.h"
namespace mongo { namespace mongo {
skipping to change at line 62 skipping to change at line 74
/* /*
* Notation: All-uppercase symbols denote non-terminals; all ot her * Notation: All-uppercase symbols denote non-terminals; all ot her
* symbols are literals. * symbols are literals.
*/ */
/* /*
* VALUE : * VALUE :
* STRING * STRING
* | NUMBER * | NUMBER
* | NUMBERINT
* | NUMBERLONG
* | OBJECT * | OBJECT
* | ARRAY * | ARRAY
* *
* | true * | true
* | false * | false
* | null * | null
* | undefined * | undefined
* *
* | NaN * | NaN
* | Infinity * | Infinity
skipping to change at line 208 skipping to change at line 222
*/ */
Status timestamp(const StringData& fieldName, BSONObjBuilder&); Status timestamp(const StringData& fieldName, BSONObjBuilder&);
/* /*
* OBJECTID : * OBJECTID :
* ObjectId( <24 character hex string> ) * ObjectId( <24 character hex string> )
*/ */
Status objectId(const StringData& fieldName, BSONObjBuilder&); Status objectId(const StringData& fieldName, BSONObjBuilder&);
/* /*
* NUMBERLONG :
* NumberLong( <number> )
*/
Status numberLong(const StringData& fieldName, BSONObjBuilder&)
;
/*
* NUMBERINT :
* NumberInt( <number> )
*/
Status numberInt(const StringData& fieldName, BSONObjBuilder&);
/*
* DBREF : * DBREF :
* Dbref( <namespace string> , <24 character hex string> ) * Dbref( <namespace string> , <24 character hex string> )
*/ */
Status dbRef(const StringData& fieldName, BSONObjBuilder&); Status dbRef(const StringData& fieldName, BSONObjBuilder&);
/* /*
* REGEX : * REGEX :
* / REGEXCHARS / REGEXOPTIONS * / REGEXCHARS / REGEXOPTIONS
* *
* REGEXCHARS : * REGEXCHARS :
skipping to change at line 329 skipping to change at line 355
* encoding representation. This function returns a string bec ause * encoding representation. This function returns a string bec ause
* UTF8 encodings for code points from 0x0000 to 0xFFFF can ran ge * UTF8 encodings for code points from 0x0000 to 0xFFFF can ran ge
* from one to three characters. * from one to three characters.
*/ */
std::string encodeUTF8(unsigned char first, unsigned char secon d) const; std::string encodeUTF8(unsigned char first, unsigned char secon d) const;
/** /**
* @return true if the given token matches the next non whitesp ace * @return true if the given token matches the next non whitesp ace
* sequence in our buffer, and false if the token doesn't match or * sequence in our buffer, and false if the token doesn't match or
* we reach the end of our buffer. Do not update the pointer t o our * we reach the end of our buffer. Do not update the pointer t o our
* buffer (same as calling readTokenImpl with advance=false).
*/
inline bool peekToken(const char* token);
/**
* @return true if the given token matches the next non whitesp
ace
* sequence in our buffer, and false if the token doesn't match
or
* we reach the end of our buffer. Updates the pointer to our
* buffer (same as calling readTokenImpl with advance=true).
*/
inline bool readToken(const char* token);
/**
* @return true if the given token matches the next non whitesp
ace
* sequence in our buffer, and false if the token doesn't match
or
* we reach the end of our buffer. Do not update the pointer t
o our
* buffer if advance is false. * buffer if advance is false.
*/ */
bool accept(const char* token, bool advance=true); bool readTokenImpl(const char* token, bool advance=true);
/** /**
* @return true if the next field in our stream matches field. * @return true if the next field in our stream matches field.
* Handles single quoted, double quoted, and unquoted field nam es * Handles single quoted, double quoted, and unquoted field nam es
*/ */
bool acceptField(const StringData& field); bool readField(const StringData& field);
/** /**
* @return true if matchChar is in matchSet * @return true if matchChar is in matchSet
* @return true if matchSet is NULL and false if it is an empty string * @return true if matchSet is NULL and false if it is an empty string
*/ */
bool match(char matchChar, const char* matchSet) const; bool match(char matchChar, const char* matchSet) const;
/** /**
* @return true if every character in the string is a hex digit * @return true if every character in the string is a hex digit
*/ */
 End of changes. 6 change blocks. 
2 lines changed or deleted 58 lines changed or added


 key.h   key.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "jsobj.h" #include "jsobj.h"
namespace mongo { namespace mongo {
/** Key class for precomputing a small format index key that is denser than a traditional BSONObj. /** Key class for precomputing a small format index key that is denser than a traditional BSONObj.
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 keypattern.h   keypattern.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/platform/unordered_set.h" #include "mongo/platform/unordered_set.h"
#include "mongo/util/mongoutils/str.h" #include "mongo/util/mongoutils/str.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 kill_current_op.h   kill_current_op.h 
skipping to change at line 16 skipping to change at line 16
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/thread/condition.hpp> #include <boost/thread/condition.hpp>
#include <boost/thread/mutex.hpp> #include <boost/thread/mutex.hpp>
#include "mongo/bson/util/atomic_int.h" #include "mongo/bson/util/atomic_int.h"
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 lasterror.h   lasterror.h 
skipping to change at line 23 skipping to change at line 23
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
#include <boost/thread/tss.hpp> #include <boost/thread/tss.hpp>
#include <string> #include <string>
#include "mongo/db/jsobj.h"
#include "mongo/bson/oid.h" #include "mongo/bson/oid.h"
#include "mongo/util/log.h" #include "mongo/util/log.h"
namespace mongo { namespace mongo {
class BSONObjBuilder; class BSONObjBuilder;
class Message; class Message;
static const char kUpsertedFieldName[] = "upserted";
struct LastError { struct LastError {
int code; int code;
std::string msg; std::string msg;
enum UpdatedExistingType { NotUpdate, True, False } updatedExisting ; enum UpdatedExistingType { NotUpdate, True, False } updatedExisting ;
OID upsertedId; // _id field value from inserted doc, returned as kUpsertedFieldNam
e (above)
BSONObj upsertedId;
OID writebackId; // this shouldn't get reset so that old GLE are ha ndled OID writebackId; // this shouldn't get reset so that old GLE are ha ndled
int writebackSince; int writebackSince;
long long nObjects; long long nObjects;
int nPrev; int nPrev;
bool valid; bool valid;
bool disabled; bool disabled;
void writeback(const OID& oid) { void writeback(const OID& oid) {
reset( true ); reset( true );
writebackId = oid; writebackId = oid;
writebackSince = 0; writebackSince = 0;
} }
void raiseError(int _code , const char *_msg) { void raiseError(int _code , const char *_msg) {
reset( true ); reset( true );
code = _code; code = _code;
msg = _msg; msg = _msg;
} }
void recordUpdate( bool _updateObjects , long long _nObjects , OID _upsertedId ) { void recordUpdate( bool _updateObjects , long long _nObjects , BSON Obj _upsertedId ) {
reset( true ); reset( true );
nObjects = _nObjects; nObjects = _nObjects;
updatedExisting = _updateObjects ? True : False; updatedExisting = _updateObjects ? True : False;
if ( _upsertedId.isSet() ) if ( _upsertedId.valid() && _upsertedId.hasField(kUpsertedField Name) )
upsertedId = _upsertedId; upsertedId = _upsertedId;
} }
void recordDelete( long long nDeleted ) { void recordDelete( long long nDeleted ) {
reset( true ); reset( true );
nObjects = nDeleted; nObjects = nDeleted;
} }
LastError() { LastError() {
reset(); reset();
writebackSince = 0; writebackSince = 0;
} }
void reset( bool _valid = false ) { void reset( bool _valid = false ) {
code = 0; code = 0;
msg.clear(); msg.clear();
updatedExisting = NotUpdate; updatedExisting = NotUpdate;
nObjects = 0; nObjects = 0;
nPrev = 1; nPrev = 1;
valid = _valid; valid = _valid;
disabled = false; disabled = false;
upsertedId.clear(); upsertedId = BSONObj();
} }
/** /**
* @return if there is an err * @return if there is an err
*/ */
bool appendSelf( BSONObjBuilder &b , bool blankErr = true ); bool appendSelf( BSONObjBuilder &b , bool blankErr = true );
/** /**
* appends fields which are not "error" related * appends fields which are not "error" related
* this whole mechanism needs to be re-written * this whole mechanism needs to be re-written
 End of changes. 6 change blocks. 
4 lines changed or deleted 9 lines changed or added


 limit.h   limit.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/exec/plan_stage.h" #include "mongo/db/exec/plan_stage.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 listen.h   listen.h 
skipping to change at line 55 skipping to change at line 55
virtual void accepted(boost::shared_ptr<Socket> psocket, long long connectionId ); virtual void accepted(boost::shared_ptr<Socket> psocket, long long connectionId );
virtual void acceptedMP(MessagingPort *mp); virtual void acceptedMP(MessagingPort *mp);
const int _port; const int _port;
/** /**
* @return a rough estimate of elapsed time since the server starte d * @return a rough estimate of elapsed time since the server starte d
*/ */
long long getMyElapsedTimeMillis() const { return _elapsedTime; } long long getMyElapsedTimeMillis() const { return _elapsedTime; }
/**
* Allocate sockets for the listener and set _setupSocketsSuccessfu
l to true
* iff the process was successful.
*/
void setupSockets();
void setAsTimeTracker() { void setAsTimeTracker() {
_timeTracker = this; _timeTracker = this;
} }
static const Listener* getTimeTracker() { static const Listener* getTimeTracker() {
return _timeTracker; return _timeTracker;
} }
static long long getElapsedTimeMillis() { static long long getElapsedTimeMillis() {
if ( _timeTracker ) if ( _timeTracker )
return _timeTracker->getMyElapsedTimeMillis(); return _timeTracker->getMyElapsedTimeMillis();
// should this assert or throw? seems like callers may not exp ect to get zero back, certainly not forever. // should this assert or throw? seems like callers may not exp ect to get zero back, certainly not forever.
return 0; return 0;
} }
private: private:
std::vector<SockAddr> _mine;
std::vector<SOCKET> _socks;
std::string _name; std::string _name;
std::string _ip; std::string _ip;
bool _setupSocketsSuccessful;
bool _logConnect; bool _logConnect;
long long _elapsedTime; long long _elapsedTime;
#ifdef MONGO_SSL #ifdef MONGO_SSL
SSLManagerInterface* _ssl; SSLManagerInterface* _ssl;
#endif #endif
/**
* @return true iff everything went ok
*/
bool _setupSockets( const std::vector<SockAddr>& mine , std::vector
<SOCKET>& socks );
void _logListen( int port , bool ssl ); void _logListen( int port , bool ssl );
static const Listener* _timeTracker; static const Listener* _timeTracker;
virtual bool useUnixSockets() const { return false; } virtual bool useUnixSockets() const { return false; }
public: public:
/** the "next" connection number. every connection to this process has a unique number */ /** the "next" connection number. every connection to this process has a unique number */
static AtomicInt64 globalConnectionNumber; static AtomicInt64 globalConnectionNumber;
 End of changes. 4 change blocks. 
6 lines changed or deleted 10 lines changed or added


 lite_parsed_query.h   lite_parsed_query.h 
skipping to change at line 28 skipping to change at line 28
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
class QueryMessage; class QueryMessage;
/** /**
* Parses the QueryMessage received from the user and makes the various fields more easily * Parses the QueryMessage received from the user and makes the various fields more easily
* accessible. * accessible.
*
* TODO: Projection.
* TODO: Tailable + Capped.
*/ */
class LiteParsedQuery { class LiteParsedQuery {
public: public:
/** /**
* Parse the provided QueryMessage and set *out to point to the out put. * Parse the provided QueryMessage and set *out to point to the out put.
* *
* Return Status::OK() if parsing succeeded. Caller owns *out. * Return Status::OK() if parsing succeeded. Caller owns *out.
* Otherwise, *out is invalid and the returned Status indicates why parsing failed. * Otherwise, *out is invalid and the returned Status indicates why parsing failed.
*/ */
static Status make(const QueryMessage& qm, LiteParsedQuery** out); static Status make(const QueryMessage& qm, LiteParsedQuery** out);
/** /**
* Fills out a LiteParsedQuery. Used for debugging and testing, wh en we don't have a * Fills out a LiteParsedQuery. Used for debugging and testing, wh en we don't have a
* QueryMessage. * QueryMessage.
*/ */
static Status make(const string& ns, static Status make(const string& ns,
int ntoskip, int ntoskip,
int ntoreturn, int ntoreturn,
int queryoptions, int queryoptions,
const BSONObj& query, const BSONObj& query,
const BSONObj& proj,
const BSONObj& sort,
LiteParsedQuery** out); LiteParsedQuery** out);
/**
* Helper function to parse a "maxTimeMS" BSONElement. Returns the
contained value, or an
* error on parsing fail. When passed an EOO-type element, returns
0 (special value for
* "allow to run indefinitely").
*/
static StatusWith<int> parseMaxTimeMS(const BSONElement& maxTimeMSE
lt);
const string& ns() const { return _ns; } const string& ns() const { return _ns; }
bool isLocalDB() const { return _ns.compare(0, 6, "local.") == 0; } bool isLocalDB() const { return _ns.compare(0, 6, "local.") == 0; }
const BSONObj& getFilter() const { return _filter; } const BSONObj& getFilter() const { return _filter; }
const BSONObj& getProj() const { return _proj; }
const BSONObj& getSort() const { return _sort; }
const BSONObj& getHint() const { return _hint; }
int getSkip() const { return _ntoskip; } int getSkip() const { return _ntoskip; }
int getNumToReturn() const { return _ntoreturn; } int getNumToReturn() const { return _ntoreturn; }
bool wantMore() const { return _wantMore; } bool wantMore() const { return _wantMore; }
int getOptions() const { return _options; } int getOptions() const { return _options; }
bool hasOption(int x) const { return ( x & _options ) != 0; } bool hasOption(int x) const { return ( x & _options ) != 0; }
bool hasReadPref() const { return _hasReadPref; } bool hasReadPref() const { return _hasReadPref; }
bool isExplain() const { return _explain; } bool isExplain() const { return _explain; }
bool isSnapshot() const { return _snapshot; } bool isSnapshot() const { return _snapshot; }
bool returnKey() const { return _returnKey; } bool returnKey() const { return _returnKey; }
bool showDiskLoc() const { return _showDiskLoc; } bool showDiskLoc() const { return _showDiskLoc; }
const BSONObj& getMin() const { return _min; } const BSONObj& getMin() const { return _min; }
const BSONObj& getMax() const { return _max; } const BSONObj& getMax() const { return _max; }
const BSONObj& getOrder() const { return _order; }
const BSONObj& getHint() const { return _hint; }
int getMaxScan() const { return _maxScan; } int getMaxScan() const { return _maxScan; }
int getMaxTimeMS() const { return _maxTimeMS; } int getMaxTimeMS() const { return _maxTimeMS; }
private: private:
LiteParsedQuery(); LiteParsedQuery();
Status init(const string& ns, int ntoskip, int ntoreturn, int query Options, Status init(const string& ns, int ntoskip, int ntoreturn, int query Options,
const BSONObj& queryObj, bool fromQueryMessage); const BSONObj& queryObj, const BSONObj& proj, bool from QueryMessage);
Status initFullQuery(const BSONObj& top); Status initFullQuery(const BSONObj& top);
string _ns; string _ns;
int _ntoskip; int _ntoskip;
int _ntoreturn; int _ntoreturn;
BSONObj _filter; BSONObj _filter;
BSONObj _order; BSONObj _sort;
BSONObj _proj;
int _options; int _options;
bool _wantMore; bool _wantMore;
bool _explain; bool _explain;
bool _snapshot; bool _snapshot;
bool _returnKey; bool _returnKey;
bool _showDiskLoc; bool _showDiskLoc;
bool _hasReadPref; bool _hasReadPref;
BSONObj _min; BSONObj _min;
BSONObj _max; BSONObj _max;
BSONObj _hint; BSONObj _hint;
 End of changes. 7 change blocks. 
7 lines changed or deleted 18 lines changed or added


 lockstat.h   lockstat.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/platform/atomic_word.h" #include "mongo/platform/atomic_word.h"
#include "mongo/util/timer.h" #include "mongo/util/timer.h"
namespace mongo { namespace mongo {
class BSONObj; class BSONObj;
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 lockstate.h   lockstate.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/d_concurrency.h" #include "mongo/db/d_concurrency.h"
namespace mongo { namespace mongo {
class Acquiring; class Acquiring;
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 log.h   log.h 
skipping to change at line 105 skipping to change at line 105
#define MONGO_TLOG(DLEVEL) \ #define MONGO_TLOG(DLEVEL) \
if ((!::mongo::debug && ((DLEVEL) > tlogLevel)) || !::mongo::logger::gl obalLogDomain()->shouldLog(::mongo::LogstreamBuilder::severityCast(DLEVEL)) ) {} \ if ((!::mongo::debug && ((DLEVEL) > tlogLevel)) || !::mongo::logger::gl obalLogDomain()->shouldLog(::mongo::LogstreamBuilder::severityCast(DLEVEL)) ) {} \
else LogstreamBuilder(::mongo::logger::globalLogDomain(), getThreadName (), ::mongo::LogstreamBuilder::severityCast(DLEVEL)) else LogstreamBuilder(::mongo::logger::globalLogDomain(), getThreadName (), ::mongo::LogstreamBuilder::severityCast(DLEVEL))
/* default impl returns "" -- mongod overrides */ /* default impl returns "" -- mongod overrides */
extern const char * (*getcurns)(); extern const char * (*getcurns)();
inline LogstreamBuilder problem() { inline LogstreamBuilder problem() {
std::string curns = getcurns(); std::string curns = getcurns();
curns.push_back(' ');
return log().setBaseMessage(curns); return log().setBaseMessage(curns);
} }
/** /**
* Rotates the log files. Returns true if all logs rotate successfully . * Rotates the log files. Returns true if all logs rotate successfully .
*/ */
bool rotateLogs(); bool rotateLogs();
/** output the error # and error message with prefix. /** output the error # and error message with prefix.
handy for use as parm in uassert/massert. handy for use as parm in uassert/massert.
 End of changes. 1 change blocks. 
1 lines changed or deleted 0 lines changed or added


 log_builder.h   log_builder.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <mongo/base/status.h> #include <mongo/base/status.h>
#include <mongo/bson/mutable/document.h> #include <mongo/bson/mutable/document.h>
namespace mongo { namespace mongo {
/** LogBuilder abstracts away some of the details of producing a proper ly constructed oplog /** LogBuilder abstracts away some of the details of producing a proper ly constructed oplog
skipping to change at line 55 skipping to change at line 67
return _logRoot.getDocument(); return _logRoot.getDocument();
} }
/** Add the given Element as a new entry in the '$set' section of t he log. If a $set /** Add the given Element as a new entry in the '$set' section of t he log. If a $set
* section does not yet exist, it will be created. If this LogBuil der is currently * section does not yet exist, it will be created. If this LogBuil der is currently
* configured to contain an object replacement, the request to add to the $set section * configured to contain an object replacement, the request to add to the $set section
* will return an Error. * will return an Error.
*/ */
Status addToSets(mutablebson::Element elt); Status addToSets(mutablebson::Element elt);
/**
* Convenience method which calls addToSets after
* creating a new Element to wrap the SafeNum value.
*
* If any problem occurs then the operation will stop and return th
at error Status.
*/
Status addToSets(const StringData& name, const SafeNum& val);
/**
* Convenience method which calls addToSets after
* creating a new Element to wrap the old one.
*
* If any problem occurs then the operation will stop and return th
at error Status.
*/
Status addToSetsWithNewFieldName(const StringData& name, const muta
blebson::Element val);
/**
* Convenience method which calls addToSets after
* creating a new Element to wrap the old one.
*
* If any problem occurs then the operation will stop and return th
at error Status.
*/
Status addToSetsWithNewFieldName(const StringData& name, const BSON
Element& val);
/** Add the given Element as a new entry in the '$unset' section of the log. If an /** Add the given Element as a new entry in the '$unset' section of the log. If an
* '$unset' section does not yet exist, it will be created. If thi s LogBuilder is * '$unset' section does not yet exist, it will be created. If thi s LogBuilder is
* currently configured to contain an object replacement, the requ est to add to the * currently configured to contain an object replacement, the requ est to add to the
* $unset section will return an Error. * $unset section will return an Error.
*/ */
Status addToUnsets(mutablebson::Element elt); Status addToUnsets(mutablebson::Element elt);
/**
* Convenience method which calls addToUnsets after
* creating a new Element to wrap the old one.
*
* If any problem occurs then the operation will stop and return th
at error Status.
*/
Status addToUnsetsWithNewFieldName(const StringData& name, const mu
tablebson::Element val);
/**
* Convenience method which calls addToUnsets after
* creating a new Element to wrap the old one.
*
* If any problem occurs then the operation will stop and return th
at error Status.
*/
Status addToUnsetsWithNewFieldName(const StringData& name, const BS
ONElement& val);
/** Obtain, via the out parameter 'outElt', a pointer to the mongo: :Object type Element /** Obtain, via the out parameter 'outElt', a pointer to the mongo: :Object type Element
* to which the components of an object replacement should be reco rded. It is an error * to which the components of an object replacement should be reco rded. It is an error
* to call this if any Elements have been added by calling either addToSets or * to call this if any Elements have been added by calling either addToSets or
* addToUnsets, and attempts to do so will return a non-OK Status. Similarly, if there * addToUnsets, and attempts to do so will return a non-OK Status. Similarly, if there
* is already object replacement data recorded for this log, the c all will fail. * is already object replacement data recorded for this log, the c all will fail.
*/ */
Status getReplacementObject(mutablebson::Element* outElt); Status getReplacementObject(mutablebson::Element* outElt);
private: private:
// Returns true if the object replacement accumulator is valid and has children, false // Returns true if the object replacement accumulator is valid and has children, false
 End of changes. 3 change blocks. 
0 lines changed or deleted 69 lines changed or added


 logfile.h   logfile.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
class LogFile { class LogFile {
public: public:
/** create the file and open. must not already exist. /** create the file and open. must not already exist.
throws UserAssertion on i/o error throws UserAssertion on i/o error
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 mapsf.h   mapsf.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#include "mongo/platform/unordered_map.h" #include "mongo/platform/unordered_map.h"
namespace mongo { namespace mongo {
/** Thread safe map. /** Thread safe map.
Be careful not to use this too much or it could make things slow; Be careful not to use this too much or it could make things slow;
if not a hot code path no problem. if not a hot code path no problem.
Examples: Examples:
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 master_slave.h   master_slave.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/repl/oplogreader.h" #include "mongo/db/repl/oplogreader.h"
/* replication data overview /* replication data overview
at the slave: at the slave:
local.sources { host: ..., source: ..., only: ..., syncedTo: ..., loca lLogTs: ..., dbsNextPass: { ... }, incompleteCloneDbs: { ... } } local.sources { host: ..., source: ..., only: ..., syncedTo: ..., loca lLogTs: ..., dbsNextPass: { ... }, incompleteCloneDbs: { ... } }
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 match_details.h   match_details.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <string> #include <string>
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 matchable.h   matchable.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonobj.h"
#include "mongo/db/field_ref.h" #include "mongo/db/field_ref.h"
#include "mongo/db/matcher/path.h" #include "mongo/db/matcher/path.h"
namespace mongo { namespace mongo {
class MatchableDocument { class MatchableDocument {
public: public:
virtual ~MatchableDocument(); virtual ~MatchableDocument();
virtual BSONObj toBSON() const = 0; virtual BSONObj toBSON() const = 0;
virtual ElementIterator* getIterator( const ElementPath& path ) con /**
st = 0; * The neewly returned ElementIterator is allowed to keep a pointer
to path.
* So the caller of this function should make sure path is in scope
until
* the ElementIterator is deallocated
*/
virtual ElementIterator* allocateIterator( const ElementPath* path
) const = 0;
virtual void releaseIterator( ElementIterator* iterator ) const = 0
;
class IteratorHolder {
public:
IteratorHolder( const MatchableDocument* doc, const ElementPath
* path ) {
_doc = doc;
_iterator = _doc->allocateIterator( path );
}
~IteratorHolder() {
_doc->releaseIterator( _iterator );
}
ElementIterator* operator->() const {
return _iterator;
}
private:
const MatchableDocument* _doc;
ElementIterator* _iterator;
};
}; };
class BSONMatchableDocument : public MatchableDocument { class BSONMatchableDocument : public MatchableDocument {
public: public:
BSONMatchableDocument( const BSONObj& obj ); BSONMatchableDocument( const BSONObj& obj );
virtual ~BSONMatchableDocument(); virtual ~BSONMatchableDocument();
virtual BSONObj toBSON() const { return _obj; } virtual BSONObj toBSON() const { return _obj; }
virtual ElementIterator* getIterator( const ElementPath& path ) con virtual ElementIterator* allocateIterator( const ElementPath* path
st { ) const {
return new BSONElementIterator( path, _obj ); if ( _iteratorUsed )
return new BSONElementIterator( path, _obj );
_iteratorUsed = true;
_iterator.reset( path, _obj );
return &_iterator;
}
virtual void releaseIterator( ElementIterator* iterator ) const {
if ( iterator == &_iterator ) {
_iteratorUsed = false;
}
else {
delete iterator;
}
} }
private: private:
BSONObj _obj; BSONObj _obj;
mutable BSONElementIterator _iterator;
mutable bool _iteratorUsed;
}; };
} }
 End of changes. 4 change blocks. 
6 lines changed or deleted 70 lines changed or added


 matcher.h   matcher.h 
skipping to change at line 19 skipping to change at line 19
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
class Cursor; class Cursor;
class CoveredIndexMatcher; class CoveredIndexMatcher;
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 matcher_covered.h   matcher_covered.h 
skipping to change at line 19 skipping to change at line 19
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/geo/geoquery.h" #include "mongo/db/geo/geoquery.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/matcher.h" #include "mongo/db/matcher.h"
#include "mongo/db/matcher/match_details.h" #include "mongo/db/matcher/match_details.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 memconcept.h   memconcept.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
/* The idea here is to 'name' memory pointers so that we can do diagnostics . /* The idea here is to 'name' memory pointers so that we can do diagnostics .
these diagnostics might involve concurrency or other things. mainly wou ld these diagnostics might involve concurrency or other things. mainly wou ld
be for _DEBUG builds. Experimental we'll see how useful. be for _DEBUG builds. Experimental we'll see how useful.
*/ */
#pragma once #pragma once
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 merge_sort.h   merge_sort.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <list> #include <list>
#include <queue> #include <queue>
#include <vector> #include <vector>
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/exec/plan_stage.h" #include "mongo/db/exec/plan_stage.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 message.h   message.h 
skipping to change at line 20 skipping to change at line 20
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
#include <vector>
#include "mongo/bson/util/atomic_int.h" #include "mongo/bson/util/atomic_int.h"
#include "mongo/util/goodies.h"
#include "mongo/util/net/hostandport.h" #include "mongo/util/net/hostandport.h"
#include "mongo/util/net/sock.h" #include "mongo/util/net/sock.h"
namespace mongo { namespace mongo {
/** /**
* Maximum accepted message size on the wire protocol. * Maximum accepted message size on the wire protocol.
*/ */
const int MaxMessageSizeBytes = 48 * 1000 * 1000; const int MaxMessageSizeBytes = 48 * 1000 * 1000;
skipping to change at line 204 skipping to change at line 207
// concat multiple buffers - noop if <2 buffers already, otherwise can be expensive copy // concat multiple buffers - noop if <2 buffers already, otherwise can be expensive copy
// can get rid of this if we make response handling smarter // can get rid of this if we make response handling smarter
void concat() { void concat() {
if ( _buf || empty() ) { if ( _buf || empty() ) {
return; return;
} }
verify( _freeIt ); verify( _freeIt );
int totalSize = 0; int totalSize = 0;
for( vector< pair< char *, int > >::const_iterator i = _data.be for (std::vector< std::pair< char *, int > >::const_iterator i
gin(); i != _data.end(); ++i ) { = _data.begin();
i != _data.end(); ++i) {
totalSize += i->second; totalSize += i->second;
} }
char *buf = (char*)malloc( totalSize ); char *buf = (char*)malloc( totalSize );
char *p = buf; char *p = buf;
for( vector< pair< char *, int > >::const_iterator i = _data.be for (std::vector< std::pair< char *, int > >::const_iterator i
gin(); i != _data.end(); ++i ) { = _data.begin();
i != _data.end(); ++i) {
memcpy( p, i->first, i->second ); memcpy( p, i->first, i->second );
p += i->second; p += i->second;
} }
reset(); reset();
_setData( (MsgData*)buf, true ); _setData( (MsgData*)buf, true );
} }
// vector swap() so this is fast // vector swap() so this is fast
Message& operator=(Message& r) { Message& operator=(Message& r) {
verify( empty() ); verify( empty() );
skipping to change at line 236 skipping to change at line 241
r._freeIt = false; r._freeIt = false;
_freeIt = true; _freeIt = true;
return *this; return *this;
} }
void reset() { void reset() {
if ( _freeIt ) { if ( _freeIt ) {
if ( _buf ) { if ( _buf ) {
free( _buf ); free( _buf );
} }
for( vector< pair< char *, int > >::const_iterator i = _dat for (std::vector< std::pair< char *, int > >::const_iterato
a.begin(); i != _data.end(); ++i ) { r i = _data.begin();
i != _data.end(); ++i) {
free(i->first); free(i->first);
} }
} }
_buf = 0; _buf = 0;
_data.clear(); _data.clear();
_freeIt = false; _freeIt = false;
} }
// use to add a buffer // use to add a buffer
// assumes message will free everything // assumes message will free everything
skipping to change at line 259 skipping to change at line 265
return; return;
} }
if ( empty() ) { if ( empty() ) {
MsgData *md = (MsgData*)d; MsgData *md = (MsgData*)d;
md->len = size; // can be updated later if more buffers add ed md->len = size; // can be updated later if more buffers add ed
_setData( md, true ); _setData( md, true );
return; return;
} }
verify( _freeIt ); verify( _freeIt );
if ( _buf ) { if ( _buf ) {
_data.push_back( make_pair( (char*)_buf, _buf->len ) ); _data.push_back(std::make_pair((char*)_buf, _buf->len));
_buf = 0; _buf = 0;
} }
_data.push_back( make_pair( d, size ) ); _data.push_back(std::make_pair(d, size));
header()->len += size; header()->len += size;
} }
// use to set first buffer if empty // use to set first buffer if empty
void setData(MsgData *d, bool freeIt) { void setData(MsgData *d, bool freeIt) {
verify( empty() ); verify( empty() );
_setData( d, freeIt ); _setData( d, freeIt );
} }
void setData(int operation, const char *msgtxt) { void setData(int operation, const char *msgtxt) {
setData(operation, msgtxt, strlen(msgtxt)+1); setData(operation, msgtxt, strlen(msgtxt)+1);
skipping to change at line 300 skipping to change at line 306
string toString() const; string toString() const;
private: private:
void _setData( MsgData *d, bool freeIt ) { void _setData( MsgData *d, bool freeIt ) {
_freeIt = freeIt; _freeIt = freeIt;
_buf = d; _buf = d;
} }
// if just one buffer, keep it in _buf, otherwise keep a sequence o f buffers in _data // if just one buffer, keep it in _buf, otherwise keep a sequence o f buffers in _data
MsgData * _buf; MsgData * _buf;
// byte buffer(s) - the first must contain at least a full MsgData unless using _buf for storage instead // byte buffer(s) - the first must contain at least a full MsgData unless using _buf for storage instead
typedef vector< pair< char*, int > > MsgVec; typedef std::vector< std::pair< char*, int > > MsgVec;
MsgVec _data; MsgVec _data;
bool _freeIt; bool _freeIt;
}; };
MSGID nextMessageId(); MSGID nextMessageId();
} // namespace mongo } // namespace mongo
 End of changes. 8 change blocks. 
9 lines changed or deleted 15 lines changed or added


 message_port.h   message_port.h 
skipping to change at line 20 skipping to change at line 20
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
#include <vector>
#include "mongo/util/net/message.h" #include "mongo/util/net/message.h"
#include "mongo/util/net/sock.h" #include "mongo/util/net/sock.h"
namespace mongo { namespace mongo {
class MessagingPort; class MessagingPort;
class PiggyBackData; class PiggyBackData;
typedef AtomicUInt MSGID; typedef AtomicUInt MSGID;
skipping to change at line 42 skipping to change at line 44
AbstractMessagingPort() : tag(0), _connectionId(0) {} AbstractMessagingPort() : tag(0), _connectionId(0) {}
virtual ~AbstractMessagingPort() { } virtual ~AbstractMessagingPort() { }
virtual void reply(Message& received, Message& response, MSGID resp onseTo) = 0; // like the reply below, but doesn't rely on received.data sti ll being available virtual void reply(Message& received, Message& response, MSGID resp onseTo) = 0; // like the reply below, but doesn't rely on received.data sti ll being available
virtual void reply(Message& received, Message& response) = 0; virtual void reply(Message& received, Message& response) = 0;
virtual HostAndPort remote() const = 0; virtual HostAndPort remote() const = 0;
virtual unsigned remotePort() const = 0; virtual unsigned remotePort() const = 0;
virtual SockAddr remoteAddr() const = 0; virtual SockAddr remoteAddr() const = 0;
virtual SockAddr localAddr() const = 0; virtual SockAddr localAddr() const = 0;
long long connectionId() const { return _connectionId; } void setX509SubjectName(const std::string& x509SubjectName) {
void setConnectionId( long long connectionId );
void setX509SubjectName(const std::string& x509SubjectName){
_x509SubjectName = x509SubjectName; _x509SubjectName = x509SubjectName;
} }
std::string getX509SubjectName(){ std::string getX509SubjectName() {
return _x509SubjectName; return _x509SubjectName;
} }
long long connectionId() const { return _connectionId; }
void setConnectionId( long long connectionId );
public: public:
// TODO make this private with some helpers // TODO make this private with some helpers
/* ports can be tagged with various classes. see closeAllSockets(t ag). defaults to 0. */ /* ports can be tagged with various classes. see closeAllSockets(t ag). defaults to 0. */
unsigned tag; unsigned tag;
private: private:
long long _connectionId; long long _connectionId;
std::string _x509SubjectName; std::string _x509SubjectName;
}; };
skipping to change at line 90 skipping to change at line 92
void shutdown(); void shutdown();
/* it's assumed if you reuse a message object, that it doesn't cros s MessagingPort's. /* it's assumed if you reuse a message object, that it doesn't cros s MessagingPort's.
also, the Message data will go out of scope on the subsequent re cv call. also, the Message data will go out of scope on the subsequent re cv call.
*/ */
bool recv(Message& m); bool recv(Message& m);
void reply(Message& received, Message& response, MSGID responseTo); void reply(Message& received, Message& response, MSGID responseTo);
void reply(Message& received, Message& response); void reply(Message& received, Message& response);
bool call(Message& toSend, Message& response); bool call(Message& toSend, Message& response);
void say(Message& toSend, int responseTo = -1); void say(Message& toSend, int responseTo = 0);
/** /**
* this is used for doing 'async' queries * this is used for doing 'async' queries
* instead of doing call( to , from ) * instead of doing call( to , from )
* you would do * you would do
* say( to ) * say( to )
* recv( from ) * recv( from )
* Note: if you fail to call recv and someone else uses this port, * Note: if you fail to call recv and someone else uses this port,
* horrible things will happen * horrible things will happen
*/ */
bool recv( const Message& sent , Message& response ); bool recv( const Message& sent , Message& response );
void piggyBack( Message& toSend , int responseTo = -1 ); void piggyBack( Message& toSend , int responseTo = 0 );
unsigned remotePort() const { return psock->remotePort(); } unsigned remotePort() const { return psock->remotePort(); }
virtual HostAndPort remote() const; virtual HostAndPort remote() const;
virtual SockAddr remoteAddr() const; virtual SockAddr remoteAddr() const;
virtual SockAddr localAddr() const; virtual SockAddr localAddr() const;
boost::shared_ptr<Socket> psock; boost::shared_ptr<Socket> psock;
void send( const char * data , int len, const char *context ) { void send( const char * data , int len, const char *context ) {
psock->send( data, len, context ); psock->send( data, len, context );
} }
void send( const vector< pair< char *, int > > &data, const char *c ontext ) { void send(const std::vector< std::pair< char *, int > > &data, cons t char *context) {
psock->send( data, context ); psock->send( data, context );
} }
bool connect(SockAddr& farEnd) { bool connect(SockAddr& farEnd) {
return psock->connect( farEnd ); return psock->connect( farEnd );
} }
#ifdef MONGO_SSL #ifdef MONGO_SSL
/** /**
* Initiates the TLS/SSL handshake on this MessagingPort. * Initiates the TLS/SSL handshake on this MessagingPort.
* When this function returns, further communication on this * When this function returns, further communication on this
* MessagingPort will be encrypted. * MessagingPort will be encrypted.
*/ */
void secure( SSLManagerInterface* ssl ) { bool secure( SSLManagerInterface* ssl ) {
psock->secure( ssl ); return psock->secure( ssl );
} }
#endif #endif
bool isStillConnected() { bool isStillConnected() {
return psock->isStillConnected(); return psock->isStillConnected();
} }
uint64_t getSockCreationMicroSec() const { uint64_t getSockCreationMicroSec() const {
return psock->getSockCreationMicroSec(); return psock->getSockCreationMicroSec();
} }
 End of changes. 8 change blocks. 
10 lines changed or deleted 12 lines changed or added


 message_server.h   message_server.h 
skipping to change at line 64 skipping to change at line 64
struct Options { struct Options {
int port; // port to bind to int port; // port to bind to
string ipList; // addresses to bind to string ipList; // addresses to bind to
Options() : port(0), ipList("") {} Options() : port(0), ipList("") {}
}; };
virtual ~MessageServer() {} virtual ~MessageServer() {}
virtual void run() = 0; virtual void run() = 0;
virtual void setAsTimeTracker() = 0; virtual void setAsTimeTracker() = 0;
virtual void setupSockets() = 0;
}; };
// TODO use a factory here to decide between port and asio variations // TODO use a factory here to decide between port and asio variations
MessageServer * createServer( const MessageServer::Options& opts , Mess ageHandler * handler ); MessageServer * createServer( const MessageServer::Options& opts , Mess ageHandler * handler );
} }
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 metadata_loader.h   metadata_loader.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/client/dbclientinterface.h" #include "mongo/client/dbclientinterface.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 minilex.h   minilex.h 
skipping to change at line 18 skipping to change at line 18
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#error does anything use this? #error does anything use this?
namespace mongo { namespace mongo {
#if defined(_WIN32) #if defined(_WIN32)
} // namespace mongo } // namespace mongo
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 mock_stage.h   mock_stage.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <queue> #include <queue>
#include "mongo/db/exec/plan_stage.h" #include "mongo/db/exec/plan_stage.h"
#include "mongo/db/exec/working_set.h" #include "mongo/db/exec/working_set.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 modifier_add_to_set.h   modifier_add_to_set.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/bson/mutable/document.h" #include "mongo/bson/mutable/document.h"
#include "mongo/db/field_ref.h" #include "mongo/db/field_ref.h"
#include "mongo/db/ops/modifier_interface.h" #include "mongo/db/ops/modifier_interface.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 modifier_bit.h   modifier_bit.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/bson/mutable/element.h" #include "mongo/bson/mutable/element.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 modifier_inc.h   modifier_inc.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/bson/mutable/element.h" #include "mongo/bson/mutable/element.h"
#include "mongo/db/field_ref.h" #include "mongo/db/field_ref.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 modifier_interface.h   modifier_interface.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/bson/mutable/element.h" #include "mongo/bson/mutable/element.h"
#include "mongo/db/field_ref.h" #include "mongo/db/field_ref.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 modifier_object_replace.h   modifier_object_replace.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/bson/mutable/element.h" #include "mongo/bson/mutable/element.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/ops/modifier_interface.h" #include "mongo/db/ops/modifier_interface.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 modifier_pop.h   modifier_pop.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/bson/mutable/element.h" #include "mongo/bson/mutable/element.h"
#include "mongo/db/field_ref.h" #include "mongo/db/field_ref.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 modifier_pull.h   modifier_pull.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/bson/mutable/document.h" #include "mongo/bson/mutable/document.h"
#include "mongo/db/field_ref.h" #include "mongo/db/field_ref.h"
#include "mongo/db/ops/modifier_interface.h" #include "mongo/db/ops/modifier_interface.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 modifier_pull_all.h   modifier_pull_all.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/bson/mutable/element.h" #include "mongo/bson/mutable/element.h"
#include "mongo/db/field_ref.h" #include "mongo/db/field_ref.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 modifier_push.h   modifier_push.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/bson/mutable/element.h" #include "mongo/bson/mutable/element.h"
#include "mongo/db/field_ref.h" #include "mongo/db/field_ref.h"
skipping to change at line 104 skipping to change at line 116
// 0 or index for $-positional in _fieldRef. // 0 or index for $-positional in _fieldRef.
size_t _posDollar; size_t _posDollar;
// Clauses for the $push that are filled when the $each variation o f the command is used. // Clauses for the $push that are filled when the $each variation o f the command is used.
bool _eachMode; bool _eachMode;
BSONElement _eachElem; BSONElement _eachElem;
bool _slicePresent; bool _slicePresent;
int64_t _slice; int64_t _slice;
bool _sortPresent; bool _sortPresent;
size_t _startPosition;
PatternElementCmp _sort; PatternElementCmp _sort;
// Whether this mod is supposed to be parsed as a $pushAll. // Whether this mod is supposed to be parsed as a $pushAll.
const ModifierPushMode _pushMode; const ModifierPushMode _pushMode;
// Simple (old style) push value when the $each variation of the co mmand is not // Simple (old style) push value when the $each variation of the co mmand is not
// used. The _eachMode flag would be off if we're this mode. // used. The _eachMode flag would be off if we're this mode.
BSONElement _val; BSONElement _val;
// The instance of the field in the provided doc. This state is val id after a // The instance of the field in the provided doc. This state is val id after a
 End of changes. 2 change blocks. 
0 lines changed or deleted 22 lines changed or added


 modifier_push_sorter.h   modifier_push_sorter.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/bson/mutable/document.h" #include "mongo/bson/mutable/document.h"
#include "mongo/bson/mutable/element.h" #include "mongo/bson/mutable/element.h"
namespace mongo { namespace mongo {
// Extracts the value for 'pattern' for both 'lhs' and 'rhs' and return true if 'lhs' < // Extracts the value for 'pattern' for both 'lhs' and 'rhs' and return true if 'lhs' <
// 'rhs'. We expect that both 'lhs' and 'rhs' be key patterns. // 'rhs'. We expect that both 'lhs' and 'rhs' be key patterns.
struct PatternElementCmp { struct PatternElementCmp {
BSONObj sortPattern; BSONObj sortPattern;
bool useWholeValue;
PatternElementCmp() : sortPattern(BSONObj()) {} PatternElementCmp()
: sortPattern(BSONObj())
PatternElementCmp(const BSONObj& pattern) : sortPattern(pattern) {} , useWholeValue(true) {}
PatternElementCmp(const BSONObj& pattern)
: sortPattern(pattern)
, useWholeValue(pattern.hasField("")){
}
bool operator()(const mutablebson::Element& lhs, const mutablebson: :Element& rhs) const { bool operator()(const mutablebson::Element& lhs, const mutablebson: :Element& rhs) const {
BSONObj lhsObj = lhs.getValueObject(); if (useWholeValue) {
BSONObj rhsObj = rhs.getValueObject(); const int comparedValue = lhs.compareWithElement( rhs, fals
e );
const bool reversed = (sortPattern.firstElement().number()
< 0 );
return (reversed ? comparedValue > 0 : comparedValue < 0);
}
else {
//TODO: Push on to mutable in the future, and to support no
n-contiguous Elements.
BSONObj lhsObj = lhs.getType() == Object ?
lhs.getValueObject() :
lhs.getValue().wrap("");
BSONObj rhsObj = rhs.getType() == Object ?
rhs.getValueObject() :
rhs.getValue().wrap("");
BSONObj lhsKey = lhsObj.extractFields(sortPattern, true); BSONObj lhsKey = lhsObj.extractFields(sortPattern, true);
BSONObj rhsKey = rhsObj.extractFields(sortPattern, true); BSONObj rhsKey = rhsObj.extractFields(sortPattern, true);
return lhsKey.woCompare(rhsKey, sortPattern) < 0; return lhsKey.woCompare(rhsKey, sortPattern) < 0;
}
} }
}; };
} // namespace mongo } // namespace mongo
 End of changes. 6 change blocks. 
8 lines changed or deleted 51 lines changed or added


 modifier_rename.h   modifier_rename.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/bson/mutable/element.h" #include "mongo/bson/mutable/element.h"
#include "mongo/db/field_ref.h" #include "mongo/db/field_ref.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 modifier_set.h   modifier_set.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/bson/mutable/element.h" #include "mongo/bson/mutable/element.h"
#include "mongo/db/field_ref.h" #include "mongo/db/field_ref.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 modifier_table.h   modifier_table.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/ops/modifier_interface.h" #include "mongo/db/ops/modifier_interface.h"
namespace mongo { namespace mongo {
namespace modifiertable { namespace modifiertable {
// NOTE: Please update jstests/verify_update_mods.js or include a jstes t for any new mods
enum ModifierType { enum ModifierType {
MOD_ADD_TO_SET, MOD_ADD_TO_SET,
MOD_BIT, MOD_BIT,
MOD_CURRENTDATE,
MOD_INC, MOD_INC,
MOD_MAX,
MOD_MIN,
MOD_MUL, MOD_MUL,
MOD_POP, MOD_POP,
MOD_PULL, MOD_PULL,
MOD_PULL_ALL, MOD_PULL_ALL,
MOD_PUSH, MOD_PUSH,
MOD_PUSH_ALL, MOD_PUSH_ALL,
MOD_SET, MOD_SET,
MOD_SET_ON_INSERT, MOD_SET_ON_INSERT,
MOD_RENAME, MOD_RENAME,
MOD_UNSET, MOD_UNSET,
 End of changes. 4 change blocks. 
0 lines changed or deleted 24 lines changed or added


 modifier_unset.h   modifier_unset.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/bson/mutable/element.h" #include "mongo/bson/mutable/element.h"
#include "mongo/db/field_ref.h" #include "mongo/db/field_ref.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 mongo_version_range.h   mongo_version_range.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 mr.h   mr.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/db/auth/privilege.h" #include "mongo/db/auth/privilege.h"
#include "mongo/db/curop.h" #include "mongo/db/curop.h"
skipping to change at line 337 skipping to change at line 349
bool _jsMode; bool _jsMode;
ScriptingFunction _reduceAll; ScriptingFunction _reduceAll;
ScriptingFunction _reduceAndEmit; ScriptingFunction _reduceAndEmit;
ScriptingFunction _reduceAndFinalize; ScriptingFunction _reduceAndFinalize;
ScriptingFunction _reduceAndFinalizeAndInsert; ScriptingFunction _reduceAndFinalizeAndInsert;
}; };
BSONObj fast_emit( const BSONObj& args, void* data ); BSONObj fast_emit( const BSONObj& args, void* data );
BSONObj _bailFromJS( const BSONObj& args, void* data ); BSONObj _bailFromJS( const BSONObj& args, void* data );
void addPrivilegesRequiredForMapReduce(const std::string& dbname, void addPrivilegesRequiredForMapReduce(Command* commandTemplate,
const std::string& dbname,
const BSONObj& cmdObj, const BSONObj& cmdObj,
std::vector<Privilege>* out) ; std::vector<Privilege>* out) ;
} // end mr namespace } // end mr namespace
} }
 End of changes. 2 change blocks. 
1 lines changed or deleted 22 lines changed or added


 msg.h   msg.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful,b * This program is distributed in the hope that it will be useful,b
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <deque> #include <deque>
#include <boost/thread/condition.hpp> #include <boost/thread/condition.hpp>
#include <boost/function.hpp> #include <boost/function.hpp>
#include "task.h" #include "task.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 multi_plan_runner.h   multi_plan_runner.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <queue> #include <deque>
#include <vector> #include <vector>
#include "mongo/base/status.h"
#include "mongo/db/exec/working_set.h" #include "mongo/db/exec/working_set.h"
#include "mongo/db/exec/plan_stage.h" #include "mongo/db/query/plan_ranker.h" // for CandidatePlan
#include "mongo/db/jsobj.h"
#include "mongo/db/query/canonical_query.h"
#include "mongo/db/query/lite_parsed_query.h"
#include "mongo/db/query/plan_ranker.h"
#include "mongo/db/query/plan_executor.h"
#include "mongo/db/query/runner.h" #include "mongo/db/query/runner.h"
#include "mongo/platform/cstdint.h" #include "mongo/db/query/runner_yield_policy.h"
namespace mongo { namespace mongo {
using std::queue; class BSONObj;
using std::size_t; class CanonicalQuery;
using std::vector; class DiskLoc;
class PlanExecutor;
class PlanStage;
struct QuerySolution;
class TypeExplain;
class WorkingSet;
/** /**
* Runs several plans in parallel and picks the best one. Caches the s election for future use. * Runs several plans in parallel and picks the best one. Caches the s election for future use.
*/ */
class MultiPlanRunner : public Runner { class MultiPlanRunner : public Runner {
public: public:
/** /**
* Takes ownership of query. * Takes ownership of query.
*/ */
MultiPlanRunner(CanonicalQuery* query); MultiPlanRunner(CanonicalQuery* query);
skipping to change at line 79 skipping to change at line 92
* If out is not-NULL, set *out to the index of the picked plan. * If out is not-NULL, set *out to the index of the picked plan.
*/ */
bool pickBestPlan(size_t* out); bool pickBestPlan(size_t* out);
virtual void saveState(); virtual void saveState();
virtual bool restoreState(); virtual bool restoreState();
virtual void invalidate(const DiskLoc& dl); virtual void invalidate(const DiskLoc& dl);
virtual void setYieldPolicy(Runner::YieldPolicy policy); virtual void setYieldPolicy(Runner::YieldPolicy policy);
virtual const string& ns() { return _query->getParsed().ns(); } virtual const std::string& ns();
virtual void kill(); virtual void kill();
/**
* Returns OK, allocating and filling in '*explain' with details of
the "winner"
* plan. Caller takes ownership of '*explain'. Otherwise, return a
status describing
* the error.
*
* TOOD: fill in the explain of all candidate plans
*/
virtual Status getExplainPlan(TypeExplain** explain) const;
private: private:
/** /**
* Have all our candidate plans do something. * Have all our candidate plans do something.
*/ */
bool workAllPlans(); bool workAllPlans();
void allPlansSaveState(); void allPlansSaveState();
void allPlansRestoreState(); void allPlansRestoreState();
// Did some plan fail while we were running it to compare against o // Were we killed by an invalidate?
ther plans? Just give up bool _killed;
// if so. Also set if we were killed during a yield.
// Did all plans fail while we were running them? Note that one pl
an can fail
// during normal execution of the plan competition. Here is an exa
mple:
//
// Plan 1: collection scan with sort. Sort runs out of memory.
// Plan 2: ixscan that provides sort. Won't run out of memory.
//
// We want to choose plan 2 even if plan 1 fails.
bool _failure; bool _failure;
// If everything fails during the plan competition, we can't pick o
ne.
size_t _failureCount;
// We need to cache this so that when we switch from running our ca ndidates to using a // We need to cache this so that when we switch from running our ca ndidates to using a
// PlanExecutor, we can set the right yielding policy on it. // PlanExecutor, we can set the right yielding policy on it.
Runner::YieldPolicy _policy; Runner::YieldPolicy _policy;
// The winner of the plan competition... // The winner of the plan competition...
scoped_ptr<PlanExecutor> _bestPlan; boost::scoped_ptr<PlanExecutor> _bestPlan;
// ...and any results it produced while working toward winning. // ...and any results it produced while working toward winning.
std::queue<WorkingSetID> _alreadyProduced; std::deque<WorkingSetID> _alreadyProduced;
// ...and the solution, for caching.
boost::scoped_ptr<QuerySolution> _bestSolution;
// Candidate plans. // Candidate plans.
vector<CandidatePlan> _candidates; std::vector<CandidatePlan> _candidates;
// Candidate plans' stats. Owned here.
std::vector<PlanStageStats*> _candidateStats;
// Yielding policy we use when we're running candidates. // Yielding policy we use when we're running candidates.
scoped_ptr<RunnerYieldPolicy> _yieldPolicy; boost::scoped_ptr<RunnerYieldPolicy> _yieldPolicy;
// The query that we're trying to figure out the best solution to. // The query that we're trying to figure out the best solution to.
scoped_ptr<CanonicalQuery> _query; boost::scoped_ptr<CanonicalQuery> _query;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 15 change blocks. 
20 lines changed or deleted 73 lines changed or added


 multicmd.h   multicmd.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/repl/connections.h" #include "mongo/db/repl/connections.h"
#include "mongo/util/background.h" #include "mongo/util/background.h"
namespace mongo { namespace mongo {
struct Target { struct Target {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 mutexdebugger.h   mutexdebugger.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/client/undef_macros.h" #include "mongo/client/undef_macros.h"
#include <iostream> #include <iostream>
#include <map> #include <map>
#include <set> #include <set>
#include <sstream> #include <sstream>
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 namespace-inl.h   namespace-inl.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
inline Namespace& Namespace::operator=(const StringData& ns) { inline Namespace& Namespace::operator=(const StringData& ns) {
// we fill the remaining space with all zeroes here. as the full N amespace struct is in // we fill the remaining space with all zeroes here. as the full N amespace struct is in
// the datafiles (the .ns files specifically), that is helpful as t hen they are deterministic // the datafiles (the .ns files specifically), that is helpful as t hen they are deterministic
// in the bytes they have for a given sequence of operations. that makes testing and debugging // in the bytes they have for a given sequence of operations. that makes testing and debugging
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 namespace.h   namespace.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <cstring> #include <cstring>
#include <string> #include <string>
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 namespace_details-inl.h   namespace_details-inl.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/namespace_details.h" #include "mongo/db/namespace_details.h"
namespace mongo { namespace mongo {
inline IndexDetails& NamespaceDetails::idx(int idxNo, bool missingExpec ted ) { inline IndexDetails& NamespaceDetails::idx(int idxNo, bool missingExpec ted ) {
if( idxNo < NIndexesBase ) { if( idxNo < NIndexesBase ) {
skipping to change at line 87 skipping to change at line 99
return &currentIndex; return &currentIndex;
} else { } else {
bestMultiKeyIndex = &currentIndex; bestMultiKeyIndex = &currentIndex;
} }
} }
} }
return requireSingleKey ? NULL : bestMultiKeyIndex; return requireSingleKey ? NULL : bestMultiKeyIndex;
} }
// @return offset in indexes[] // @return offset in indexes[]
inline int NamespaceDetails::findIndexByName(const char *name, inline int NamespaceDetails::findIndexByName(const StringData& name,
bool includeBackgroundInPr ogress) { bool includeBackgroundInPr ogress) {
IndexIterator i = ii(includeBackgroundInProgress); IndexIterator i = ii(includeBackgroundInProgress);
while( i.more() ) { while( i.more() ) {
if ( strcmp(i.next().info.obj().getStringField("name"),name) == 0 ) if ( name == i.next().info.obj().getStringField("name") )
return i.pos()-1; return i.pos()-1;
} }
return -1; return -1;
} }
inline NamespaceDetails::IndexIterator::IndexIterator(NamespaceDetails *_d, inline NamespaceDetails::IndexIterator::IndexIterator(NamespaceDetails *_d,
bool includeBackg roundInProgress) { bool includeBackg roundInProgress) {
d = _d; d = _d;
i = 0; i = 0;
n = includeBackgroundInProgress ? d->getTotalIndexCount() : d->_nIn dexes; n = includeBackgroundInProgress ? d->getTotalIndexCount() : d->_nIn dexes;
 End of changes. 3 change blocks. 
2 lines changed or deleted 22 lines changed or added


 namespace_details.h   namespace_details.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/db/d_concurrency.h" #include "mongo/db/d_concurrency.h"
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/index.h" #include "mongo/db/index.h"
#include "mongo/db/index_names.h" #include "mongo/db/index_names.h"
#include "mongo/db/index_set.h" #include "mongo/db/index_set.h"
skipping to change at line 40 skipping to change at line 52
#include "mongo/db/storage/namespace_index.h" #include "mongo/db/storage/namespace_index.h"
#include "mongo/platform/unordered_map.h" #include "mongo/platform/unordered_map.h"
namespace mongo { namespace mongo {
class Database; class Database;
/** @return true if a client can modify this namespace even though it i s under ".system." /** @return true if a client can modify this namespace even though it i s under ".system."
For example <dbname>.system.users is ok for regular clients to upda te. For example <dbname>.system.users is ok for regular clients to upda te.
@param write used when .system.js @param write used when .system.js
*/ */
bool legalClientSystemNS( const string& ns , bool write ); bool legalClientSystemNS( const StringData& ns , bool write );
/* deleted lists -- linked lists of deleted records -- are placed in 'b uckets' of various sizes /* deleted lists -- linked lists of deleted records -- are placed in 'b uckets' of various sizes
so you can look for a deleterecord about the right size. so you can look for a deleterecord about the right size.
*/ */
const int Buckets = 19; const int Buckets = 19;
const int MaxBucket = 18; const int MaxBucket = 18;
extern int bucketSizes[]; extern int bucketSizes[];
#pragma pack(1) #pragma pack(1)
skipping to change at line 280 skipping to change at line 292
bool isMultikey(int i) const { return (_multiKeyIndexBits & (((unsi gned long long) 1) << i)) != 0; } bool isMultikey(int i) const { return (_multiKeyIndexBits & (((unsi gned long long) 1) << i)) != 0; }
void setIndexIsMultikey(const char *thisns, int i, bool multikey = true); void setIndexIsMultikey(const char *thisns, int i, bool multikey = true);
/** /**
* This fetches the IndexDetails for the next empty index slot. The caller must populate * This fetches the IndexDetails for the next empty index slot. The caller must populate
* returned object. This handles allocating extra index space, if necessary. * returned object. This handles allocating extra index space, if necessary.
*/ */
IndexDetails& getNextIndexDetails(const char* thisns); IndexDetails& getNextIndexDetails(const char* thisns);
/** /**
* Add a new index. This does not add it to system.indexes etc. - * incremements _nIndexes
just to NamespaceDetails.
* This resets the transient namespace details.
*/ */
void addIndex(const char* thisns); void addIndex();
void aboutToDeleteAnIndex() { void aboutToDeleteAnIndex() {
clearSystemFlag( Flag_HaveIdIndex ); clearSystemFlag( Flag_HaveIdIndex );
} }
/* returns index of the first index in which the field is present. -1 if not present. */ /* returns index of the first index in which the field is present. -1 if not present. */
int fieldIsIndexed(const char *fieldName); int fieldIsIndexed(const char *fieldName);
/** /**
* @return the actual size to create * @return the actual size to create
skipping to change at line 340 skipping to change at line 351
*/ */
double N = min(_nIndexes,7) + 3; double N = min(_nIndexes,7) + 3;
double x = _paddingFactor + (0.001 * N); double x = _paddingFactor + (0.001 * N);
if ( x <= 2.0 ) { if ( x <= 2.0 ) {
setPaddingFactor( x ); setPaddingFactor( x );
} }
} }
} }
// @return offset in indexes[] // @return offset in indexes[]
int findIndexByName(const char *name, bool includeBackgroundInProgr ess = false); int findIndexByName(const StringData& name, bool includeBackgroundI nProgress = false);
// @return offset in indexes[] // @return offset in indexes[]
int findIndexByKeyPattern(const BSONObj& keyPattern, int findIndexByKeyPattern(const BSONObj& keyPattern,
bool includeBackgroundInProgress = false) ; bool includeBackgroundInProgress = false) ;
void findIndexByType( const string& name , vector<int>& matches ) { void findIndexByType( const string& name , vector<int>& matches ) {
IndexIterator i = ii(); IndexIterator i = ii();
while ( i.more() ) { while ( i.more() ) {
if ( IndexNames::findPluginName(i.next().keyPattern()) == n ame ) if ( IndexNames::findPluginName(i.next().keyPattern()) == n ame )
matches.push_back( i.pos() - 1 ); matches.push_back( i.pos() - 1 );
skipping to change at line 516 skipping to change at line 527
}; };
/** Update cappedLastDelRecLastExtent() after capExtent changed in cappedTruncateAfter() */ /** Update cappedLastDelRecLastExtent() after capExtent changed in cappedTruncateAfter() */
void cappedTruncateLastDelUpdate(); void cappedTruncateLastDelUpdate();
BOOST_STATIC_ASSERT( NIndexesMax <= NIndexesBase + NIndexesExtra*2 ); BOOST_STATIC_ASSERT( NIndexesMax <= NIndexesBase + NIndexesExtra*2 );
BOOST_STATIC_ASSERT( NIndexesMax <= 64 ); // multiKey bits BOOST_STATIC_ASSERT( NIndexesMax <= 64 ); // multiKey bits
BOOST_STATIC_ASSERT( sizeof(NamespaceDetails::ExtraOld) == 496 ); BOOST_STATIC_ASSERT( sizeof(NamespaceDetails::ExtraOld) == 496 );
BOOST_STATIC_ASSERT( sizeof(NamespaceDetails::Extra) == 496 ); BOOST_STATIC_ASSERT( sizeof(NamespaceDetails::Extra) == 496 );
}; // NamespaceDetails }; // NamespaceDetails
#pragma pack() #pragma pack()
/* NamespaceDetailsTransient
these are things we know / compute about a namespace that are transi
ent -- things
we don't actually store in the .ns file. so mainly caching of frequ
ently used
information.
CAUTION: Are you maintaining this properly on a collection drop()?
A dropdatabase()? Be careful.
The current field "allIndexKeys" may have too many keys in
it on such an occurrence;
as currently used that does not cause anything terrible to
happen.
todo: cleanup code, need abstractions and separation
*/
// todo: multiple db's with the same name (repairDatabase) is not handl
ed herein. that may be
// the way to go, if not used by repair, but need some sort of en
forcement / asserts.
class NamespaceDetailsTransient : boost::noncopyable {
BOOST_STATIC_ASSERT( sizeof(NamespaceDetails) == 496 );
//Database *database;
const string _ns;
void reset();
// < db -> < fullns -> NDT > >
typedef unordered_map< string, shared_ptr<NamespaceDetailsTransient
> > CMap;
typedef unordered_map< string, CMap*, NamespaceDBHash, NamespaceDBE
quals > DMap;
static DMap _nsdMap;
NamespaceDetailsTransient(Database*,const string& ns);
public:
~NamespaceDetailsTransient();
void addedIndex() { reset(); }
void deletedIndex() { reset(); }
/**
* reset stats for a given collection
*/
static void resetCollection(const string& ns );
/**
* remove entry for a collection
*/
static void eraseCollection(const string& ns);
/**
* remove all entries for db
*/
static void eraseDB(const string& db);
/* indexKeys() cache ----------------------------------------------
------ */
/* assumed to be in write lock for this */
private:
bool _keysComputed;
IndexPathSet _indexedPaths;
void computeIndexKeys();
public:
/* get set of index keys for this namespace. handy to quickly chec
k if a given
field is indexed (Note it might be a secondary component of a co
mpound index.)
*/
const IndexPathSet& indexKeys() {
DEV Lock::assertWriteLocked(_ns);
if ( !_keysComputed )
computeIndexKeys();
return _indexedPaths;
}
/* query cache (for query optimizer) ------------------------------
------- */
private:
int _qcWriteCount;
map<QueryPattern,CachedQueryPlan> _qcCache;
static NamespaceDetailsTransient& make_inlock(const string& ns);
static CMap& get_cmap_inlock(const string& ns);
public:
static SimpleMutex _qcMutex;
/* you must be in the qcMutex when calling this.
A NamespaceDetailsTransient object will not go out of scope on y
ou if you are
d.dbMutex.atLeastReadLocked(), so you do't have to stay locked.
Creates a NamespaceDetailsTransient before returning if one DNE.
todo: avoid creating too many on erroneous ns queries.
*/
static NamespaceDetailsTransient& get_inlock(const string& ns);
static NamespaceDetailsTransient& get(const char *ns) {
// todo : _qcMutex will create bottlenecks in our parallelism
SimpleMutex::scoped_lock lk(_qcMutex);
return get_inlock(ns);
}
void clearQueryCache() {
_qcCache.clear();
_qcWriteCount = 0;
}
/* you must notify the cache if you are doing writes, as query plan
utility will change */
void notifyOfWriteOp() {
if ( _qcCache.empty() )
return;
if ( ++_qcWriteCount >= 100 )
clearQueryCache();
}
CachedQueryPlan cachedQueryPlanForPattern( const QueryPattern &patt
ern ) {
return _qcCache[ pattern ];
}
void registerCachedQueryPlanForPattern( const QueryPattern &pattern
,
const CachedQueryPlan &cache
dQueryPlan ) {
_qcCache[ pattern ] = cachedQueryPlan;
}
}; /* NamespaceDetailsTransient */
inline NamespaceDetailsTransient& NamespaceDetailsTransient::get_inlock
(const string& ns) {
CMap& m = get_cmap_inlock(ns);
CMap::iterator i = m.find( ns );
if ( i != m.end() &&
i->second.get() ) { // could be null ptr from clearForPrefix
return *i->second;
}
return make_inlock(ns);
}
extern string dbpath; // --dbpath parm
extern bool directoryperdb;
// Rename a namespace within current 'client' db.
// (Arguments should include db name)
void renameNamespace( const char *from, const char *to, bool stayTemp);
} // namespace mongo } // namespace mongo
 End of changes. 6 change blocks. 
150 lines changed or deleted 24 lines changed or added


 namespace_index.h   namespace_index.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <list> #include <list>
#include <string> #include <string>
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/storage/namespace.h" #include "mongo/db/storage/namespace.h"
#include "mongo/util/hashtab.h" #include "mongo/util/hashtab.h"
skipping to change at line 48 skipping to change at line 60
_ht( 0 ), _dir( dir ), _database( database ) {} _ht( 0 ), _dir( dir ), _database( database ) {}
/* returns true if new db will be created if we init lazily */ /* returns true if new db will be created if we init lazily */
bool exists() const; bool exists() const;
void init() { void init() {
if( !_ht ) if( !_ht )
_init(); _init();
} }
void add_ns( const StringData& ns, DiskLoc& loc, bool capped); void add_ns( const StringData& ns, const DiskLoc& loc, bool capped) ;
void add_ns( const StringData& ns, const NamespaceDetails* details ); void add_ns( const StringData& ns, const NamespaceDetails* details );
void add_ns( const Namespace& ns, const NamespaceDetails* details ) ; void add_ns( const Namespace& ns, const NamespaceDetails* details ) ;
NamespaceDetails* details(const StringData& ns); NamespaceDetails* details(const StringData& ns);
NamespaceDetails* details(const Namespace& ns); NamespaceDetails* details(const Namespace& ns);
void kill_ns(const char *ns); void kill_ns(const StringData& ns);
bool allocated() const { return _ht != 0; } bool allocated() const { return _ht != 0; }
void getNamespaces( std::list<std::string>& tofill , bool onlyColle ctions = true ) const; void getNamespaces( std::list<std::string>& tofill , bool onlyColle ctions = true ) const;
boost::filesystem::path path() const; boost::filesystem::path path() const;
unsigned long long fileLength() const { return _f.length(); } unsigned long long fileLength() const { return _f.length(); }
private: private:
 End of changes. 3 change blocks. 
2 lines changed or deleted 22 lines changed or added


 namespace_string-inl.h   namespace_string-inl.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
namespace mongo { namespace mongo {
inline StringData NamespaceString::db() const { inline StringData NamespaceString::db() const {
return _dotIndex == string::npos ? return _dotIndex == std::string::npos ?
StringData() : StringData() :
StringData( _ns.c_str(), _dotIndex ); StringData( _ns.c_str(), _dotIndex );
} }
inline StringData NamespaceString::coll() const { inline StringData NamespaceString::coll() const {
return _dotIndex == string::npos ? return _dotIndex == std::string::npos ?
StringData() : StringData() :
StringData( _ns.c_str() + _dotIndex + 1, _ns.size() - 1 - _dotI ndex ); StringData( _ns.c_str() + _dotIndex + 1, _ns.size() - 1 - _dotI ndex );
} }
inline bool NamespaceString::normal(const StringData& ns) { inline bool NamespaceString::normal(const StringData& ns) {
if ( ns.find( '$' ) == string::npos ) if ( ns.find( '$' ) == std::string::npos )
return true; return true;
return oplog(ns); return oplog(ns);
} }
inline bool NamespaceString::oplog(const StringData& ns) { inline bool NamespaceString::oplog(const StringData& ns) {
return ns == "local.oplog.rs" || ns == "local.oplog.$main"; return ns == "local.oplog.rs" || ns == "local.oplog.$main";
} }
inline bool NamespaceString::special(const StringData& ns) { inline bool NamespaceString::special(const StringData& ns) {
return !normal(ns) || ns.find( ".system." ) != string::npos; return !normal(ns) || ns.substr(ns.find('.')).startsWith(".system." );
} }
inline bool NamespaceString::validDBName( const StringData& dbin ) { inline bool NamespaceString::validDBName( const StringData& db ) {
// XXX
string db = dbin.toString();
if ( db.size() == 0 || db.size() > 64 ) if ( db.size() == 0 || db.size() > 64 )
return false; return false;
for (StringData::const_iterator iter = db.begin(), end = db.end();
iter != end; ++iter) {
switch (*iter) {
case '\0':
case '/':
case '\\':
case '.':
case ' ':
case '"':
return false;
#ifdef _WIN32 #ifdef _WIN32
// We prohibit all FAT32-disallowed characters on Windows // We prohibit all FAT32-disallowed characters on Windows
size_t good = strcspn( db.c_str() , "/\\. \"*<>:|?" ); case '*':
#else case '<':
// For non-Windows platforms we are much more lenient case '>':
size_t good = strcspn( db.c_str() , "/\\. \"" ); case ':':
case '|':
case '?':
return false;
#endif #endif
return good == db.size(); default:
continue;
}
}
return true;
} }
inline bool NamespaceString::validCollectionName(const StringData& ns){ inline bool NamespaceString::validCollectionComponent(const StringData& ns){
size_t idx = ns.find( '.' ); size_t idx = ns.find( '.' );
if ( idx == string::npos ) if ( idx == std::string::npos )
return false; return false;
if ( idx + 1 >= ns.size() ) return validCollectionName(ns.substr(idx + 1)) || oplog(ns);
}
inline bool NamespaceString::validCollectionName(const StringData& coll
){
if (coll.empty())
return false; return false;
return normal( ns ); return coll.find('$') == std::string::npos;
} }
inline NamespaceString::NamespaceString() : _ns(), _dotIndex(0) {}
inline NamespaceString::NamespaceString( const StringData& nsIn ) { inline NamespaceString::NamespaceString( const StringData& nsIn ) {
_ns = nsIn.toString(); // copy to our buffer _ns = nsIn.toString(); // copy to our buffer
_dotIndex = _ns.find( '.' ); _dotIndex = _ns.find( '.' );
} }
inline int nsDBHash( const string& ns ) { inline NamespaceString::NamespaceString( const StringData& dbName,
const StringData& collectionNa
me )
: _ns(dbName.size() + collectionName.size() + 1, '\0') {
dassert(dbName.find('.') == std::string::npos);
dassert(collectionName.empty() || collectionName[0] != '.');
std::string::iterator it = std::copy(dbName.begin(), dbName.end(),
_ns.begin());
*it = '.';
++it;
it = std::copy(collectionName.begin(), collectionName.end(), it);
_dotIndex = dbName.size();
dassert(it == _ns.end());
dassert(_ns[_dotIndex] == '.');
dassert(_ns.find('\0') == std::string::npos);
}
inline int nsDBHash( const std::string& ns ) {
int hash = 7; int hash = 7;
for ( size_t i = 0; i < ns.size(); i++ ) { for ( size_t i = 0; i < ns.size(); i++ ) {
if ( ns[i] == '.' ) if ( ns[i] == '.' )
break; break;
hash += 11 * ( ns[i] ); hash += 11 * ( ns[i] );
hash *= 3; hash *= 3;
} }
return hash; return hash;
} }
inline bool nsDBEquals( const string& a, const string& b ) { inline bool nsDBEquals( const std::string& a, const std::string& b ) {
for ( size_t i = 0; i < a.size(); i++ ) { for ( size_t i = 0; i < a.size(); i++ ) {
if ( a[i] == '.' ) { if ( a[i] == '.' ) {
// b has to either be done or a '.' // b has to either be done or a '.'
if ( b.size() == i ) if ( b.size() == i )
return true; return true;
if ( b[i] == '.' ) if ( b[i] == '.' )
return true; return true;
skipping to change at line 123 skipping to change at line 171
// a is done // a is done
// make sure b is done // make sure b is done
if ( b.size() == a.size() || if ( b.size() == a.size() ||
b[a.size()] == '.' ) b[a.size()] == '.' )
return true; return true;
return false; return false;
} }
/* future : this doesn't need to be an inline. */ /* future : this doesn't need to be an inline. */
inline string NamespaceString::getSisterNS( const StringData& local ) c onst { inline std::string NamespaceString::getSisterNS( const StringData& loca l ) const {
verify( local.size() && local[0] != '.' ); verify( local.size() && local[0] != '.' );
return db().toString() + "." + local.toString(); return db().toString() + "." + local.toString();
} }
inline string NamespaceString::getSystemIndexesCollection() const { inline std::string NamespaceString::getSystemIndexesCollection() const {
return db().toString() + ".system.indexes"; return db().toString() + ".system.indexes";
} }
} }
 End of changes. 18 change blocks. 
22 lines changed or deleted 82 lines changed or added


 namespace_string.h   namespace_string.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <algorithm>
#include <string> #include <string>
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/util/assert_util.h" #include "mongo/util/assert_util.h"
namespace mongo { namespace mongo {
using std::string;
/* in the mongo source code, "client" means "database". */ /* in the mongo source code, "client" means "database". */
const size_t MaxDatabaseNameLen = 128; // max str len for the db name, including null char const size_t MaxDatabaseNameLen = 128; // max str len for the db name, including null char
/* e.g. /* e.g.
NamespaceString ns("acme.orders"); NamespaceString ns("acme.orders");
cout << ns.coll; // "orders" cout << ns.coll; // "orders"
*/ */
class NamespaceString { class NamespaceString {
public: public:
/**
* Constructs an empty NamespaceString.
*/
NamespaceString();
/**
* Constructs a NamespaceString from the fully qualified namespace
named in "ns".
*/
NamespaceString( const StringData& ns ); NamespaceString( const StringData& ns );
/**
* Constructs a NamespaceString for the given database and collecti
on names.
* "dbName" must not contain a ".", and "collectionName" must not s
tart with one.
*/
NamespaceString( const StringData& dbName, const StringData& collec
tionName );
StringData db() const; StringData db() const;
StringData coll() const; StringData coll() const;
const string& ns() const { return _ns; } const std::string& ns() const { return _ns; }
operator string() const { return _ns; } operator std::string() const { return _ns; }
string toString() const { return _ns; } std::string toString() const { return _ns; }
size_t size() const { return _ns.size(); } size_t size() const { return _ns.size(); }
bool isSystem() const { return coll().startsWith( "system." ); } bool isSystem() const { return coll().startsWith( "system." ); }
bool isSystemDotIndexes() const { return coll() == "system.indexes" ; }
bool isConfigDB() const { return db() == "config"; } bool isConfigDB() const { return db() == "config"; }
bool isCommand() const { return coll() == "$cmd"; } bool isCommand() const { return coll() == "$cmd"; }
bool isSpecialCommand() const { return coll().startsWith("$cmd.sys" ); } bool isSpecialCommand() const { return coll().startsWith("$cmd.sys" ); }
bool isSpecial() const { return special( _ns ); }
/** /**
* @return true if the namespace is valid. Special namespaces for i nternal use are considered as valid. * @return true if the namespace is valid. Special namespaces for i nternal use are considered as valid.
*/ */
bool isValid() const { return validDBName( db() ) && !coll().empty( ); } bool isValid() const { return validDBName( db() ) && !coll().empty( ); }
bool operator==( const string& nsIn ) const { return nsIn == _ns; } bool operator==( const std::string& nsIn ) const { return nsIn == _ ns; }
bool operator==( const NamespaceString& nsIn ) const { return nsIn. _ns == _ns; } bool operator==( const NamespaceString& nsIn ) const { return nsIn. _ns == _ns; }
bool operator!=( const string& nsIn ) const { return nsIn != _ns; } bool operator!=( const std::string& nsIn ) const { return nsIn != _ ns; }
bool operator!=( const NamespaceString& nsIn ) const { return nsIn. _ns != _ns; } bool operator!=( const NamespaceString& nsIn ) const { return nsIn. _ns != _ns; }
bool operator<( const NamespaceString& rhs ) const { return _ns < r
hs._ns; }
/** ( foo.bar ).getSisterNS( "blah" ) == foo.blah /** ( foo.bar ).getSisterNS( "blah" ) == foo.blah
*/ */
string getSisterNS( const StringData& local ) const; std::string getSisterNS( const StringData& local ) const;
// @return db() + ".system.indexes" // @return db() + ".system.indexes"
string getSystemIndexesCollection() const; std::string getSystemIndexesCollection() const;
/** /**
* @return true if ns is 'normal'. A "$" is used for namespaces ho lding index data, * @return true if ns is 'normal'. A "$" is used for namespaces ho lding index data,
* which do not contain BSON objects in their records. ("oplog.$mai n" is the exception) * which do not contain BSON objects in their records. ("oplog.$mai n" is the exception)
*/ */
static bool normal(const StringData& ns); static bool normal(const StringData& ns);
/** /**
* @return true if the ns is an oplog one, otherwise false. * @return true if the ns is an oplog one, otherwise false.
*/ */
skipping to change at line 105 skipping to change at line 133
* foo bar * foo bar
* foo.bar * foo.bar
* foo"bar * foo"bar
* *
* @param db - a possible database name * @param db - a possible database name
* @return if db is an allowed database name * @return if db is an allowed database name
*/ */
static bool validDBName( const StringData& dbin ); static bool validDBName( const StringData& dbin );
/** /**
* Takes a fully qualified namespace (ie dbname.collectionName), an
d returns true if
* the collection name component of the namespace is valid.
* samples: * samples:
* good: * good:
* foo.bar * foo.bar
* bad: * bad:
* foo. * foo.
* *
* @param ns - a full namesapce (a.b) * @param ns - a full namespace (a.b)
* @return if db.coll is an allowed collection name * @return if db.coll is an allowed collection name
*/ */
static bool validCollectionName(const StringData& ns); static bool validCollectionComponent(const StringData& ns);
/**
* Takes a collection name and returns true if it is a valid collec
tion name.
* samples:
* good:
* foo
* system.indexes
* bad:
* $foo
* @param coll - a collection name component of a namespace
* @return if the input is a valid collection name
*/
static bool validCollectionName(const StringData& coll);
private: private:
string _ns; std::string _ns;
size_t _dotIndex; size_t _dotIndex;
}; };
// "database.a.b.c" -> "database" // "database.a.b.c" -> "database"
inline StringData nsToDatabaseSubstring( const StringData& ns ) { inline StringData nsToDatabaseSubstring( const StringData& ns ) {
size_t i = ns.find( '.' ); size_t i = ns.find( '.' );
if ( i == string::npos ) { if ( i == std::string::npos ) {
massert(10078, "nsToDatabase: ns too long", ns.size() < MaxData baseNameLen ); massert(10078, "nsToDatabase: ns too long", ns.size() < MaxData baseNameLen );
return ns; return ns;
} }
massert(10088, "nsToDatabase: ns too long", i < static_cast<size_t> (MaxDatabaseNameLen)); massert(10088, "nsToDatabase: ns too long", i < static_cast<size_t> (MaxDatabaseNameLen));
return ns.substr( 0, i ); return ns.substr( 0, i );
} }
// "database.a.b.c" -> "database" // "database.a.b.c" -> "database"
inline void nsToDatabase(const StringData& ns, char *database) { inline void nsToDatabase(const StringData& ns, char *database) {
StringData db = nsToDatabaseSubstring( ns ); StringData db = nsToDatabaseSubstring( ns );
db.copyTo( database, true ); db.copyTo( database, true );
} }
// TODO: make this return a StringData // TODO: make this return a StringData
inline string nsToDatabase(const StringData& ns) { inline std::string nsToDatabase(const StringData& ns) {
return nsToDatabaseSubstring( ns ).toString(); return nsToDatabaseSubstring( ns ).toString();
} }
// "database.a.b.c" -> "a.b.c" // "database.a.b.c" -> "a.b.c"
inline StringData nsToCollectionSubstring( const StringData& ns ) { inline StringData nsToCollectionSubstring( const StringData& ns ) {
size_t i = ns.find( '.' ); size_t i = ns.find( '.' );
massert(16886, "nsToCollectionSubstring: no .", i != string::npos ) ; massert(16886, "nsToCollectionSubstring: no .", i != std::string::n pos );
return ns.substr( i + 1 ); return ns.substr( i + 1 );
} }
/** /**
* NamespaceDBHash and NamespaceDBEquals allow you to do something like * NamespaceDBHash and NamespaceDBEquals allow you to do something like
* unordered_map<string,int,NamespaceDBHash,NamespaceDBEquals> * unordered_map<string,int,NamespaceDBHash,NamespaceDBEquals>
* and use the full namespace for the string * and use the full namespace for the string
* but comparisons are done only on the db piece * but comparisons are done only on the db piece
*/ */
/** /**
* this can change, do not store on disk * this can change, do not store on disk
*/ */
int nsDBHash( const string& ns ); int nsDBHash( const std::string& ns );
bool nsDBEquals( const string& a, const string& b ); bool nsDBEquals( const std::string& a, const std::string& b );
struct NamespaceDBHash { struct NamespaceDBHash {
int operator()( const string& ns ) const { int operator()( const std::string& ns ) const {
return nsDBHash( ns ); return nsDBHash( ns );
} }
}; };
struct NamespaceDBEquals { struct NamespaceDBEquals {
bool operator()( const string& a, const string& b ) const { bool operator()( const std::string& a, const std::string& b ) const {
return nsDBEquals( a, b ); return nsDBEquals( a, b );
} }
}; };
} }
#include "mongo/db/namespace_string-inl.h" #include "mongo/db/namespace_string-inl.h"
 End of changes. 25 change blocks. 
20 lines changed or deleted 78 lines changed or added


 new_find.h   new_find.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/db/curop.h" #include "mongo/db/curop.h"
#include "mongo/db/dbmessage.h" #include "mongo/db/dbmessage.h"
#include "mongo/db/query/canonical_query.h"
#include "mongo/util/net/message.h" #include "mongo/util/net/message.h"
namespace mongo { namespace mongo {
/** /**
* A switch to choose between old Cursor-based code and new Runner-base d code. * A switch to choose between old Cursor-based code and new Runner-base d code.
*/ */
bool isNewQueryFrameworkEnabled(); bool isNewQueryFrameworkEnabled();
/** /**
skipping to change at line 45 skipping to change at line 58
void enableNewQueryFramework(); void enableNewQueryFramework();
/** /**
* Called from the getMore entry point in ops/query.cpp. * Called from the getMore entry point in ops/query.cpp.
*/ */
QueryResult* newGetMore(const char* ns, int ntoreturn, long long cursor id, CurOp& curop, QueryResult* newGetMore(const char* ns, int ntoreturn, long long cursor id, CurOp& curop,
int pass, bool& exhaust, bool* isCursorAuthoriz ed); int pass, bool& exhaust, bool* isCursorAuthoriz ed);
/** /**
* Called from the runQuery entry point in ops/query.cpp. * Called from the runQuery entry point in ops/query.cpp.
*
* Takes ownership of cq.
*/
std::string newRunQuery(CanonicalQuery* cq, CurOp& curop, Message &resu
lt);
/**
* Can the new system handle the provided query?
*
* Returns false if not. cqOut is not modified.
* Returns true if so. Caller owns *cqOut.
*/ */
string newRunQuery(Message& m, QueryMessage& q, CurOp& curop, Message & result); bool canUseNewSystem(const QueryMessage& qm, CanonicalQuery** cqOut);
} // namespace mongo } // namespace mongo
 End of changes. 4 change blocks. 
1 lines changed or deleted 33 lines changed or added


 ntservice.h   ntservice.h 
skipping to change at line 27 skipping to change at line 27
* The ntservice namespace provides minimal support for running mongo serve rs as NT services. * The ntservice namespace provides minimal support for running mongo serve rs as NT services.
* *
* TODO: ntservice should only provide implementation for a more general se rver process * TODO: ntservice should only provide implementation for a more general se rver process
* startup/shutdown/management interface. * startup/shutdown/management interface.
*/ */
#pragma once #pragma once
#ifdef _WIN32 #ifdef _WIN32
#include <boost/program_options.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/platform/compiler.h" #include "mongo/platform/compiler.h"
namespace mongo { namespace mongo {
namespace optionenvironment {
class OptionSection;
class Environment;
} // namespace optionenvironment
namespace moe = mongo::optionenvironment;
namespace ntservice { namespace ntservice {
struct NtServiceDefaultStrings { struct NtServiceDefaultStrings {
const wchar_t* serviceName; const wchar_t* serviceName;
const wchar_t* displayName; const wchar_t* displayName;
const wchar_t* serviceDescription; const wchar_t* serviceDescription;
}; };
typedef void (*ServiceCallback)(void); typedef void (*ServiceCallback)(void);
/** /**
skipping to change at line 58 skipping to change at line 64
* *
* This function calls _exit() with an error if bad parameters are pass ed in. If * This function calls _exit() with an error if bad parameters are pass ed in. If
* the parameters specify that the service should be installed, removed , etc, performs that * the parameters specify that the service should be installed, removed , etc, performs that
* operation and exits. * operation and exits.
* *
* If this function returns to the caller, the caller should either cal l startService, or run * If this function returns to the caller, the caller should either cal l startService, or run
* the service as a regular process, depending on the return value of s houldStartService(). * the service as a regular process, depending on the return value of s houldStartService().
*/ */
void configureService( void configureService(
ServiceCallback serviceCallback, ServiceCallback serviceCallback,
const boost::program_options::variables_map& params, const moe::Environment& params,
const NtServiceDefaultStrings& defaultStrings, const NtServiceDefaultStrings& defaultStrings,
const std::vector<std::string>& disallowedOptions, const std::vector<std::string>& disallowedOptions,
const std::vector<std::string>& argv); const std::vector<std::string>& argv);
bool shouldStartService(); bool shouldStartService();
/** /**
* Construct an argv array that Windows should use to start mongod/mong os as a service * Construct an argv array that Windows should use to start mongod/mong os as a service
* if mongo was started with "inputArgv", which is assumed to be an arg ument vector that * if mongo was started with "inputArgv", which is assumed to be an arg ument vector that
* dictates that Windows should install mongo as a service. * dictates that Windows should install mongo as a service.
 End of changes. 3 change blocks. 
2 lines changed or deleted 8 lines changed or added


 oplog.h   oplog.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
class BSONObj; class BSONObj;
class Database; class Database;
// These functions redefine the function for logOp(), // These functions redefine the function for logOp(),
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 oplogreader.h   oplogreader.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/client/constants.h" #include "mongo/client/constants.h"
#include "mongo/client/dbclientcursor.h" #include "mongo/client/dbclientcursor.h"
#include "mongo/db/dbhelpers.h" #include "mongo/db/dbhelpers.h"
namespace mongo { namespace mongo {
/**
* Authenticates conn using the server's cluster-membership credentials
.
*
* Returns true on successful authentication.
*/
bool replAuthenticate(DBClientBase* conn);
/* started abstracting out the querying of the primary/master's oplog /* started abstracting out the querying of the primary/master's oplog
still fairly awkward but a start. still fairly awkward but a start.
*/ */
class OplogReader { class OplogReader {
shared_ptr<DBClientConnection> _conn; shared_ptr<DBClientConnection> _conn;
shared_ptr<DBClientCursor> cursor; shared_ptr<DBClientCursor> cursor;
int _tailingQueryOptions; int _tailingQueryOptions;
public: public:
OplogReader(); OplogReader();
 End of changes. 2 change blocks. 
0 lines changed or deleted 28 lines changed or added


 option_description.h   option_description.h 
skipping to change at line 21 skipping to change at line 21
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
#include <iostream> #include <iostream>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/util/options_parser/value.h"
namespace mongo { namespace mongo {
namespace optionenvironment { namespace optionenvironment {
/** /**
* An OptionType is an enum of all the types we support in the OptionsP arser * An OptionType is an enum of all the types we support in the OptionsP arser
*/ */
enum OptionType { enum OptionType {
StringVector, // po::value< std::vector<std::string> > StringVector, // po::value< std::vector<std::string> >
Bool, // po::value<bool> Bool, // po::value<bool>
skipping to change at line 47 skipping to change at line 48
Switch // po::bool_switch Switch // po::bool_switch
}; };
/** /**
* The OptionDescription and PositionalOptionDescription classes are co ntainers for information * The OptionDescription and PositionalOptionDescription classes are co ntainers for information
* about the options we are expecting either on the command line or in config files. These * about the options we are expecting either on the command line or in config files. These
* should be registered in an OptionSection instance and passed to an O ptionsParser. * should be registered in an OptionSection instance and passed to an O ptionsParser.
*/ */
class OptionDescription { class OptionDescription {
public: public:
OptionDescription(const std::string& dottedName, // Used for JSON c OptionDescription(const std::string& dottedName,
onfig and in Environment const std::string& singleName,
const std::string& singleName, // Used for boost command li
ne and INI
const OptionType type, const OptionType type,
const std::string& description, const std::string& description,
const bool isVisible = true) const bool isVisible = true,
const Value defaultValue = Value(),
const Value implicitValue = Value(),
const bool isComposing = false)
: _dottedName(dottedName), : _dottedName(dottedName),
_singleName(singleName), _singleName(singleName),
_type(type), _type(type),
_description(description), _description(description),
_isVisible(isVisible) { } _isVisible(isVisible),
_default(defaultValue),
std::string _dottedName; _implicit(implicitValue),
std::string _singleName; _isComposing(isComposing) { }
OptionType _type;
std::string _description; std::string _dottedName; // Used for JSON config and in Environment
bool _isVisible; std::string _singleName; // Used for boost command line and INI
OptionType _type; // Storage type of the argument value, or switch
type (bool)
// (required by boost)
std::string _description; // Description of option printed in help
output
bool _isVisible; // Visible in help output
Value _default; // Value if option is not specified
Value _implicit; // Value if option is specified with no argument
bool _isComposing; // Aggregate values from different sources inste
ad of overriding
}; };
class PositionalOptionDescription { class PositionalOptionDescription {
public: public:
PositionalOptionDescription(const std::string& name, PositionalOptionDescription(const std::string& name,
const OptionType type, const OptionType type,
int count = 1) int count = 1)
: _name(name), : _name(name),
_type(type), _type(type),
_count(count) { } _count(count) { }
std::string _name; std::string _name; // Name used to access the value of this option
OptionType _type; after parsing
int _count; // Max number of times this option could be specified. OptionType _type; // Storage type of the positional argument (requi
-1 = unlimited red by boost)
int _count; // Max number of times this option can be specified. -
1 = unlimited
}; };
} // namespace optionenvironment } // namespace optionenvironment
} // namespace mongo } // namespace mongo
 End of changes. 5 change blocks. 
16 lines changed or deleted 30 lines changed or added


 option_section.h   option_section.h 
skipping to change at line 34 skipping to change at line 34
namespace mongo { namespace mongo {
namespace optionenvironment { namespace optionenvironment {
namespace po = boost::program_options; namespace po = boost::program_options;
/** A container for OptionDescription instances and PositionalOptionDes cription instances as /** A container for OptionDescription instances and PositionalOptionDes cription instances as
* well as other OptionSection instances. Provides a description of a ll options that are * well as other OptionSection instances. Provides a description of a ll options that are
* supported to be passed in to an OptionsParser. Has utility functio ns to support the various * supported to be passed in to an OptionsParser. Has utility functio ns to support the various
* formats needed by the parsing process * formats needed by the parsing process
* *
* The sections and section names only matter in the help string. For
sections in a JSON
* config, look at the dots in the dottedName of the relevant OptionDe
scription
*
* Usage: * Usage:
* *
* namespace moe = mongo::optionenvironment; * namespace moe = mongo::optionenvironment;
* *
* moe::OptionsParser parser; * moe::OptionsParser parser;
* moe::Environment environment; * moe::Environment environment;
* moe::OptionSection options; * moe::OptionSection options;
* moe::OptionSection subSection("Section Name"); * moe::OptionSection subSection("Section Name");
* *
* // Register our allowed option flags with our OptionSection * // Register our allowed option flags with our OptionSection
skipping to change at line 87 skipping to change at line 90
/** /**
* Add a positional option to this section. Also adds a normal hid den option with the same * Add a positional option to this section. Also adds a normal hid den option with the same
* name as the PositionalOptionDescription because that is the mech anism boost program * name as the PositionalOptionDescription because that is the mech anism boost program
* options uses. Unfortunately this means that positional options can also be accessed by * options uses. Unfortunately this means that positional options can also be accessed by
* name in the config files and via command line flags * name in the config files and via command line flags
*/ */
Status addPositionalOption(const PositionalOptionDescription& posit ionalOption); Status addPositionalOption(const PositionalOptionDescription& posit ionalOption);
// These functions are used by the OptionsParser to make calls into boost::program_options // These functions are used by the OptionsParser to make calls into boost::program_options
Status getBoostOptions(po::options_description* boostOptions, Status getBoostOptions(po::options_description* boostOptions,
bool visibleOnly = false) const; bool visibleOnly = false,
bool includeDefaults = false) const;
Status getBoostPositionalOptions( Status getBoostPositionalOptions(
po::positional_options_description* boostPositionalOptions) const; po::positional_options_description* boostPositionalOptions) const;
// This is needed so that the parser can iterate over all registere d options to get the // This is needed so that the parser can iterate over all registere d options to get the
// correct names when populating the Environment, as well as check that a parameter that was // correct names when populating the Environment, as well as check that a parameter that was
// found has been registered and has the correct type // found has been registered and has the correct type
Status getAllOptions(std::vector<OptionDescription>* options) const ; Status getAllOptions(std::vector<OptionDescription>* options) const ;
/**
* Populates the given map with all the default values for any opti
ons in this option
* section and all sub sections.
*/
Status getDefaults(std::map<Key, Value>* values) const;
std::string positionalHelpString(const std::string& execName) const ; std::string positionalHelpString(const std::string& execName) const ;
std::string helpString() const; std::string helpString() const;
// Debugging // Debugging
void dump() const; void dump() const;
private: private:
std::string _name; std::string _name;
std::vector<OptionSection> _subSections; std::vector<OptionSection> _subSections;
std::vector<OptionDescription> _options; std::vector<OptionDescription> _options;
 End of changes. 3 change blocks. 
1 lines changed or deleted 14 lines changed or added


 options_parser.h   options_parser.h 
skipping to change at line 24 skipping to change at line 24
*/ */
#pragma once #pragma once
#include <map> #include <map>
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/base/status.h" #include "mongo/base/status.h"
class Status;
namespace mongo { namespace mongo {
namespace optionenvironment { namespace optionenvironment {
class Environment; class Environment;
class OptionSection; class OptionSection;
class Value; class Value;
/** Handles parsing of the command line as well as JSON and INI config files. Takes an /** Handles parsing of the command line as well as JSON and INI config files. Takes an
* OptionSection instance that describes the allowed options, parses a rgv (env not yet * OptionSection instance that describes the allowed options, parses a rgv (env not yet
* supported), and populates an Environment with the results. * supported), and populates an Environment with the results.
skipping to change at line 106 skipping to change at line 104
/** Handles parsing of the command line and adds the results to the given Environment */ /** Handles parsing of the command line and adds the results to the given Environment */
Status parseCommandLine(const OptionSection&, Status parseCommandLine(const OptionSection&,
const std::vector<std::string>& argv, Envir onment*); const std::vector<std::string>& argv, Envir onment*);
/** Handles parsing of an INI config string and adds the results to the given Environment */ /** Handles parsing of an INI config string and adds the results to the given Environment */
Status parseINIConfigFile(const OptionSection&, const std::string& config, Environment*); Status parseINIConfigFile(const OptionSection&, const std::string& config, Environment*);
/** Handles parsing of a JSON config string and adds the results to the given Environment */ /** Handles parsing of a JSON config string and adds the results to the given Environment */
Status parseJSONConfigFile(const OptionSection&, const std::string& config, Environment*); Status parseJSONConfigFile(const OptionSection&, const std::string& config, Environment*);
/** Gets defaults from the OptionSection and adds them to the given
Environment */
Status addDefaultValues(const OptionSection&, Environment*);
/** Detects whether the given string represents a JSON config file or an INI config file */ /** Detects whether the given string represents a JSON config file or an INI config file */
bool isJSONConfig(const std::string& config); bool isJSONConfig(const std::string& config);
/** Reads the given config file into the output string. This funct ion is virtual for /** Reads the given config file into the output string. This funct ion is virtual for
* testing purposes only. */ * testing purposes only. */
virtual Status readConfigFile(const std::string& filename, std::str ing*); virtual Status readConfigFile(const std::string& filename, std::str ing*);
}; };
} // namespace optionenvironment } // namespace optionenvironment
} // namespace mongo } // namespace mongo
 End of changes. 2 change blocks. 
2 lines changed or deleted 4 lines changed or added


 or.h   or.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/exec/plan_stage.h" #include "mongo/db/exec/plan_stage.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/matcher/expression.h" #include "mongo/db/matcher/expression.h"
#include "mongo/platform/unordered_set.h" #include "mongo/platform/unordered_set.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 pagefault.h   pagefault.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
class Record; class Record;
class PageFaultException /*: public DBException*/ { class PageFaultException /*: public DBException*/ {
unsigned era; unsigned era;
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 password.h   password.h 
skipping to change at line 24 skipping to change at line 24
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#include <string> #include <string>
namespace mongo { namespace mongo {
struct PasswordValue : public boost::program_options::typed_value<std::
string> {
PasswordValue( std::string* val )
: boost::program_options::typed_value<std::string>( val ) { }
unsigned min_tokens() const {
return 0;
}
unsigned max_tokens() const {
return 1;
}
bool is_required() const {
return false;
}
void xparse( boost::any& value_store,
const std::vector<std::string>& new_tokens ) const {
if ( !value_store.empty() )
#if BOOST_VERSION >= 104200
boost::throw_exception( boost::program_options::validation_
error( boost::program_options::validation_error::multiple_values_not_allowe
d ) );
#else
boost::throw_exception( boost::program_options::validation_
error( "multiple values not allowed" ) );
#endif
else if ( !new_tokens.empty() )
boost::program_options::typed_value<std::string>::xparse
(value_store, new_tokens);
else
value_store = std::string();
}
};
std::string askPassword(); std::string askPassword();
} }
 End of changes. 1 change blocks. 
38 lines changed or deleted 0 lines changed or added


 path.h   path.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/bson/bsonobj.h" #include "mongo/bson/bsonobj.h"
#include "mongo/bson/bsonobjiterator.h" #include "mongo/bson/bsonobjiterator.h"
skipping to change at line 106 skipping to change at line 118
virtual Context next(); virtual Context next();
private: private:
BSONElement _theArray; BSONElement _theArray;
bool _returnArrayLast; bool _returnArrayLast;
BSONObjIterator _iterator; BSONObjIterator _iterator;
}; };
class BSONElementIterator : public ElementIterator { class BSONElementIterator : public ElementIterator {
public: public:
BSONElementIterator( const ElementPath& path, const BSONObj& contex BSONElementIterator();
t ); BSONElementIterator( const ElementPath* path, const BSONObj& contex
t );
virtual ~BSONElementIterator(); virtual ~BSONElementIterator();
void reset( const ElementPath* path, const BSONObj& context );
bool more(); bool more();
Context next(); Context next();
private: private:
const ElementPath& _path; const ElementPath* _path;
BSONObj _context; BSONObj _context;
enum State { BEGIN, IN_ARRAY, DONE } _state; enum State { BEGIN, IN_ARRAY, DONE } _state;
Context _next; Context _next;
struct ArrayIterationState { struct ArrayIterationState {
void reset( const FieldRef& ref, int start ); void reset( const FieldRef& ref, int start );
void startIterator( BSONElement theArray ); void startIterator( BSONElement theArray );
 End of changes. 4 change blocks. 
3 lines changed or deleted 27 lines changed or added


 path_internal.h   path_internal.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/field_ref.h" #include "mongo/db/field_ref.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/platform/cstdint.h" #include "mongo/platform/cstdint.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 path_support.h   path_support.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/bson/mutable/element.h" #include "mongo/bson/mutable/element.h"
#include "mongo/db/field_ref.h" #include "mongo/db/field_ref.h"
#include "mongo/platform/cstdint.h" #include "mongo/platform/cstdint.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 paths.h   paths.h 
skipping to change at line 21 skipping to change at line 21
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
#include "mongoutils/str.h" #include <boost/filesystem/path.hpp>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <boost/filesystem/path.hpp> #include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/db/storage_options.h"
namespace mongo { namespace mongo {
using namespace mongoutils; using namespace mongoutils;
extern string dbpath;
/** this is very much like a boost::path. however, we define a new typ e to get some type /** this is very much like a boost::path. however, we define a new typ e to get some type
checking. if you want to say 'my param MUST be a relative path", u se this. checking. if you want to say 'my param MUST be a relative path", u se this.
*/ */
struct RelativePath { struct RelativePath {
string _p; string _p;
bool empty() const { return _p.empty(); } bool empty() const { return _p.empty(); }
static RelativePath fromRelativePath(const std::string& f) { static RelativePath fromRelativePath(const std::string& f) {
RelativePath rp; RelativePath rp;
rp._p = f; rp._p = f;
return rp; return rp;
} }
/** from a full path */ /** from a full path */
static RelativePath fromFullPath(boost::filesystem::path f) { static RelativePath fromFullPath(boost::filesystem::path f) {
boost::filesystem::path dbp(dbpath); // normalizes / and backsl ash boost::filesystem::path dbp(storageGlobalParams.dbpath); // nor malizes / and backslash
string fullpath = f.string(); string fullpath = f.string();
string relative = str::after(fullpath, dbp.string()); string relative = str::after(fullpath, dbp.string());
if( relative.empty() ) { if( relative.empty() ) {
log() << "warning file is not under db path? " << fullpath << ' ' << dbp.string() << endl; log() << "warning file is not under db path? " << fullpath << ' ' << dbp.string();
RelativePath rp; RelativePath rp;
rp._p = fullpath; rp._p = fullpath;
return rp; return rp;
} }
/*uassert(13600,
str::stream() << "file path is not under the db path? "
<< fullpath << ' ' << dbpath,
relative != fullpath);*/
if( str::startsWith(relative, "/") || str::startsWith(relative, "\\") ) { if( str::startsWith(relative, "/") || str::startsWith(relative, "\\") ) {
relative.erase(0, 1); relative.erase(0, 1);
} }
RelativePath rp; RelativePath rp;
rp._p = relative; rp._p = relative;
return rp; return rp;
} }
string toString() const { return _p; } string toString() const { return _p; }
bool operator!=(const RelativePath& r) const { return _p != r._p; } bool operator!=(const RelativePath& r) const { return _p != r._p; }
bool operator==(const RelativePath& r) const { return _p == r._p; } bool operator==(const RelativePath& r) const { return _p == r._p; }
bool operator<(const RelativePath& r) const { return _p < r._p; } bool operator<(const RelativePath& r) const { return _p < r._p; }
string asFullPath() const { string asFullPath() const {
boost::filesystem::path x(dbpath); boost::filesystem::path x(storageGlobalParams.dbpath);
x /= _p; x /= _p;
return x.string(); return x.string();
} }
}; };
inline dev_t getPartition(const string& path){ inline dev_t getPartition(const string& path){
struct stat stats; struct stat stats;
if (stat(path.c_str(), &stats) != 0){ if (stat(path.c_str(), &stats) != 0){
skipping to change at line 101 skipping to change at line 99
return stats.st_dev; return stats.st_dev;
} }
inline bool onSamePartition(const string& path1, const string& path2){ inline bool onSamePartition(const string& path1, const string& path2){
dev_t dev1 = getPartition(path1); dev_t dev1 = getPartition(path1);
dev_t dev2 = getPartition(path2); dev_t dev2 = getPartition(path2);
return dev1 == dev2; return dev1 == dev2;
} }
inline void flushMyDirectory(const boost::filesystem::path& file){ void flushMyDirectory(const boost::filesystem::path& file);
#ifdef __linux__ // this isn't needed elsewhere
// if called without a fully qualified path it asserts; that makes
mongoperf fail. so make a warning. need a better solution longer term.
// massert(13652, str::stream() << "Couldn't find parent dir for fi
le: " << file.string(), );
if( !file.has_branch_path() ) {
log() << "warning flushMYDirectory couldn't find parent dir for
file: " << file.string() << endl;
return;
}
boost::filesystem::path dir = file.branch_path(); // parent_path in
new boosts
LOG(1) << "flushing directory " << dir.string() << endl;
int fd = ::open(dir.string().c_str(), O_RDONLY); // DO NOT THROW OR
ASSERT BEFORE CLOSING
massert(13650, str::stream() << "Couldn't open directory '" << dir.
string() << "' for flushing: " << errnoWithDescription(), fd >= 0);
if (fsync(fd) != 0){
int e = errno;
close(fd);
massert(13651, str::stream() << "Couldn't fsync directory '" <<
dir.string() << "': " << errnoWithDescription(e), false);
}
close(fd);
#endif
}
boost::filesystem::path ensureParentDirCreated(const boost::filesystem: :path& p); boost::filesystem::path ensureParentDirCreated(const boost::filesystem: :path& p);
} }
 End of changes. 8 change blocks. 
41 lines changed or deleted 9 lines changed or added


 pdfile.h   pdfile.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
/* pdfile.h /* pdfile.h
Files: Files:
database.ns - namespace index database.ns - namespace index
database.1 - data files database.1 - data files
database.2 database.2
... ...
*/ */
skipping to change at line 56 skipping to change at line 68
class Cursor; class Cursor;
class DataFileHeader; class DataFileHeader;
class Extent; class Extent;
class OpDebug; class OpDebug;
class Record; class Record;
struct SortPhaseOne; struct SortPhaseOne;
void dropDatabase(const std::string& db); void dropDatabase(const std::string& db);
bool repairDatabase(string db, string &errmsg, bool preserveClonedFiles OnFailure = false, bool backupOriginalFiles = false); bool repairDatabase(string db, string &errmsg, bool preserveClonedFiles OnFailure = false, bool backupOriginalFiles = false);
/* low level - only drops this ns */
void dropNS(const string& dropNs);
/* deletes this ns, indexes and cursors */
void dropCollection( const string &name, string &errmsg, BSONObjBuilder
&result );
bool userCreateNS(const char *ns, BSONObj j, string& err, bool logForRe plication, bool *deferIdIndex = 0); bool userCreateNS(const char *ns, BSONObj j, string& err, bool logForRe plication, bool *deferIdIndex = 0);
shared_ptr<Cursor> findTableScan(const char *ns, const BSONObj& order, const DiskLoc &startLoc=DiskLoc()); shared_ptr<Cursor> findTableScan(const char *ns, const BSONObj& order, const DiskLoc &startLoc=DiskLoc());
bool isValidNS( const StringData& ns ); bool isValidNS( const StringData& ns );
/*--------------------------------------------------------------------- */ /*--------------------------------------------------------------------- */
class DataFileMgr { class DataFileMgr {
friend class BasicCursor; friend class BasicCursor;
public: public:
DataFileMgr(); DataFileMgr();
void init(const string& path ); void init(const string& path );
/* see if we can find an extent of the right size in the freelist.
*/
static Extent* allocFromFreeList(const char *ns, int approxSize, bo
ol capped = false);
/** @return DiskLoc where item ends up */ /** @return DiskLoc where item ends up */
// changedId should be initialized to false // changedId should be initialized to false
const DiskLoc updateRecord( const DiskLoc updateRecord(
const char *ns, const char *ns,
NamespaceDetails *d, Collection* collection,
NamespaceDetailsTransient *nsdt,
Record *toupdate, const DiskLoc& dl, Record *toupdate, const DiskLoc& dl,
const char *buf, int len, OpDebug& debug, bool god=false); const char *buf, int len, OpDebug& debug, bool god=false);
// The object o may be updated if modified on insert. // The object o may be updated if modified on insert.
void insertAndLog( const char *ns, const BSONObj &o, bool god = fal se, bool fromMigrate = false ); void insertAndLog( const char *ns, const BSONObj &o, bool god = fal se, bool fromMigrate = false );
/** /**
* insert() will add an _id to the object if not present. If you w ould like to see the * insert() will add an _id to the object if not present. If you w ould like to see the
* final object after such an addition, use this method. * final object after such an addition, use this method.
* note: does NOT put on oplog * note: does NOT put on oplog
 End of changes. 4 change blocks. 
13 lines changed or deleted 21 lines changed or added


 pdfile_private.h   pdfile_private.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
// This file contains declarations that should not be considered part of pd file's // This file contains declarations that should not be considered part of pd file's
// public interface, but are currently accessed by other modules within mon god. // public interface, but are currently accessed by other modules within mon god.
#pragma once #pragma once
namespace mongo { namespace mongo {
extern bool inDBRepair; extern bool inDBRepair;
} }
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 pdfile_version.h   pdfile_version.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
// pdfile versions // pdfile versions
const int PDFILE_VERSION = 4; const int PDFILE_VERSION = 4;
const int PDFILE_VERSION_MINOR_22_AND_OLDER = 5; const int PDFILE_VERSION_MINOR_22_AND_OLDER = 5;
const int PDFILE_VERSION_MINOR_24_AND_NEWER = 6; const int PDFILE_VERSION_MINOR_24_AND_NEWER = 6;
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 pipeline.h   pipeline.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link th
e
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the GNU Affero General Public License in all respects f
or
* all of the code used other than as permitted herein. If you modify file(
s)
* with this exception, you may extend this exception to your version of th
e
* file(s), but you are not obligated to do so. If you do not wish to do so
,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also dele
te
* it in the license file.
*/ */
#pragma once #pragma once
#include <deque> #include <deque>
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/db/pipeline/value.h"
#include "mongo/util/intrusive_counter.h" #include "mongo/util/intrusive_counter.h"
#include "mongo/util/timer.h" #include "mongo/util/timer.h"
namespace mongo { namespace mongo {
class BSONObj; class BSONObj;
class BSONObjBuilder; class BSONObjBuilder;
class BSONArrayBuilder; class BSONArrayBuilder;
class Command;
class DocumentSource; class DocumentSource;
class DocumentSourceProject; class DocumentSourceProject;
class Expression; class Expression;
struct ExpressionContext; struct ExpressionContext;
class ExpressionNary; class ExpressionNary;
struct OpDesc; // local private struct struct OpDesc; // local private struct
class Privilege; class Privilege;
/** mongodb "commands" (sent via db.$cmd.findOne(...)) /** mongodb "commands" (sent via db.$cmd.findOne(...))
subclass to make a command. define a singleton object for it. subclass to make a command. define a singleton object for it.
skipping to change at line 56 skipping to change at line 70
@param errmsg where to write errors, if there are any @param errmsg where to write errors, if there are any
@param cmdObj the command object sent from the client @param cmdObj the command object sent from the client
@returns the pipeline, if created, otherwise a NULL reference @returns the pipeline, if created, otherwise a NULL reference
*/ */
static intrusive_ptr<Pipeline> parseCommand( static intrusive_ptr<Pipeline> parseCommand(
string &errmsg, BSONObj &cmdObj, string &errmsg, BSONObj &cmdObj,
const intrusive_ptr<ExpressionContext> &pCtx); const intrusive_ptr<ExpressionContext> &pCtx);
/// Helper to implement Command::addRequiredPrivileges /// Helper to implement Command::addRequiredPrivileges
static void addRequiredPrivileges(const string& inputNs, static void addRequiredPrivileges(Command* commandTemplate,
const string& dbname,
BSONObj cmdObj, BSONObj cmdObj,
vector<Privilege>* out); vector<Privilege>* out);
/**
Get the collection name from the command.
@returns the collection name
*/
string getCollectionName() const;
intrusive_ptr<ExpressionContext> getContext() const { return pCtx; } intrusive_ptr<ExpressionContext> getContext() const { return pCtx; }
/** /**
Split the current Pipeline into a Pipeline for each shard, and Split the current Pipeline into a Pipeline for each shard, and
a Pipeline that combines the results within mongos. a Pipeline that combines the results within mongos.
This permanently alters this pipeline for the merging operation. This permanently alters this pipeline for the merging operation.
@returns the Spec for the pipeline command that should be sent @returns the Spec for the pipeline command that should be sent
to the shards to the shards
skipping to change at line 101 skipping to change at line 109
Write the Pipeline as a BSONObj command. This should be the Write the Pipeline as a BSONObj command. This should be the
inverse of parseCommand(). inverse of parseCommand().
This is only intended to be used by the shard command obtained This is only intended to be used by the shard command obtained
from splitForSharded(). Some pipeline operations in the merge from splitForSharded(). Some pipeline operations in the merge
process do not have equivalent command forms, and using this on process do not have equivalent command forms, and using this on
the mongos Pipeline will cause assertions. the mongos Pipeline will cause assertions.
@param the builder to write the command to @param the builder to write the command to
*/ */
void toBson(BSONObjBuilder *pBuilder) const; Document serialize() const;
/** Stitch together the source pointers (by calling setSource) for each source in sources. /** Stitch together the source pointers (by calling setSource) for each source in sources.
* Must be called after optimize and addInitialSource but before t rying to get results. * Must be called after optimize and addInitialSource but before t rying to get results.
*/ */
void stitch(); void stitch();
/** /**
Run the Pipeline on the given source. Run the Pipeline on the given source.
@param result builder to write the result to @param result builder to write the result to
*/ */
void run(BSONObjBuilder& result); void run(BSONObjBuilder& result);
/** bool isExplain() const { return explain; }
Debugging: should the processing pipeline be split within
mongod, simulating the real mongos/mongod split? This is determi
ned
by setting the splitMongodPipeline field in an "aggregate"
command.
The split itself is handled by the caller, which is currently
pipeline_command.cpp.
@returns true if the pipeline is to be split
*/
bool getSplitMongodPipeline() const;
/**
Ask if this is for an explain request.
@returns true if this is an explain
*/
bool isExplain() const;
/// The initial source is special since it varies between mongos an d mongod. /// The initial source is special since it varies between mongos an d mongod.
void addInitialSource(intrusive_ptr<DocumentSource> source); void addInitialSource(intrusive_ptr<DocumentSource> source);
/// The source that represents the output. Returns a non-owning poi nter. /// The source that represents the output. Returns a non-owning poi nter.
DocumentSource* output() { return sources.back().get(); } DocumentSource* output() { return sources.back().get(); }
/// Returns true if this pipeline only uses features that work in m ongos. /// Returns true if this pipeline only uses features that work in m ongos.
bool canRunInMongos() const; bool canRunInMongos() const;
/** /**
* Write the pipeline's operators to a vector<Value>, with the
* explain flag true (for DocumentSource::serializeToArray()).
*/
vector<Value> writeExplainOps() const;
/**
The aggregation command name. The aggregation command name.
*/ */
static const char commandName[]; static const char commandName[];
/* /*
PipelineD is a "sister" class that has additional functionality PipelineD is a "sister" class that has additional functionality
for the Pipeline. It exists because of linkage requirements. for the Pipeline. It exists because of linkage requirements.
Pipeline needs to function in mongod and mongos. PipelineD Pipeline needs to function in mongod and mongos. PipelineD
contains extra functionality required in mongod, and which can't contains extra functionality required in mongod, and which can't
appear in mongos because the required symbols are unavailable appear in mongos because the required symbols are unavailable
for linking there. Consider PipelineD to be an extension of this for linking there. Consider PipelineD to be an extension of this
class for mongod only. class for mongod only.
*/ */
friend class PipelineD; friend class PipelineD;
private: private:
static const char pipelineName[]; static const char pipelineName[];
static const char explainName[]; static const char explainName[];
static const char fromRouterName[]; static const char fromRouterName[];
static const char splitMongodPipelineName[];
static const char serverPipelineName[]; static const char serverPipelineName[];
static const char mongosPipelineName[]; static const char mongosPipelineName[];
Pipeline(const intrusive_ptr<ExpressionContext> &pCtx); Pipeline(const intrusive_ptr<ExpressionContext> &pCtx);
/*
Write the pipeline's operators to the given array, with the
explain flag true (for DocumentSource::addToBsonArray()).
@param pArrayBuilder where to write the ops to
*/
void writeExplainOps(BSONArrayBuilder *pArrayBuilder) const;
/*
Write the pipeline's operators to the given result document,
for a shard server (or regular server, in an unsharded setup).
This uses writeExplainOps() and adds that array to the result
with the serverPipelineName. That will be preceded by explain
information for the input source.
@param result the object to add the explain information to
*/
void writeExplainShard(BSONObjBuilder &result) const;
/*
Write the pipeline's operators to the given result document,
for a mongos instance.
This first adds the serverPipeline obtained from the input
source.
Then this uses writeExplainOps() and adds that array to the resul
t
with the serverPipelineName. That will be preceded by explain
information for the input source.
@param result the object to add the explain information to
*/
void writeExplainMongos(BSONObjBuilder &result) const;
string collectionName;
typedef std::deque<boost::intrusive_ptr<DocumentSource> > SourceCon tainer; typedef std::deque<boost::intrusive_ptr<DocumentSource> > SourceCon tainer;
SourceContainer sources; SourceContainer sources;
bool explain; bool explain;
bool splitMongodPipeline;
boost::intrusive_ptr<ExpressionContext> pCtx; boost::intrusive_ptr<ExpressionContext> pCtx;
}; };
} // namespace mongo } // namespace mongo
/* ======================= INLINED IMPLEMENTATIONS ========================
== */
namespace mongo {
inline string Pipeline::getCollectionName() const {
return collectionName;
}
inline bool Pipeline::getSplitMongodPipeline() const {
if (!DEBUG_BUILD)
return false;
return splitMongodPipeline;
}
inline bool Pipeline::isExplain() const {
return explain;
}
} // namespace mongo
 End of changes. 12 change blocks. 
68 lines changed or deleted 30 lines changed or added


 pipeline_d.h   pipeline_d.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link th
e
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the GNU Affero General Public License in all respects f
or
* all of the code used other than as permitted herein. If you modify file(
s)
* with this exception, you may extend this exception to your version of th
e
* file(s), but you are not obligated to do so. If you do not wish to do so
,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also dele
te
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
namespace mongo { namespace mongo {
class DocumentSourceCursor; class DocumentSourceCursor;
struct ExpressionContext; struct ExpressionContext;
class Pipeline; class Pipeline;
skipping to change at line 39 skipping to change at line 51
where the remainder of the Pipeline class also functions. PipelineD where the remainder of the Pipeline class also functions. PipelineD
is a friend of Pipeline so that it can have equal access to Pipeline' s is a friend of Pipeline so that it can have equal access to Pipeline' s
members. members.
See the friend declaration in Pipeline. See the friend declaration in Pipeline.
*/ */
class PipelineD { class PipelineD {
public: public:
/** /**
Create a Cursor wrapped in a DocumentSourceCursor, which is suit * Create a Cursor wrapped in a DocumentSourceCursor, which is suit
able able
to be the first source for a pipeline to begin with. This sourc * to be the first source for a pipeline to begin with. This sourc
e e
will feed the execution of the pipeline. * will feed the execution of the pipeline.
*
This method looks for early pipeline stages that can be folded i * This method looks for early pipeline stages that can be folded i
nto nto
the underlying cursor, and when a cursor can absorb those, they * the underlying cursor, and when a cursor can absorb those, they
are removed from the head of the pipeline. For example, an * are removed from the head of the pipeline. For example, an
early match can be removed and replaced with a Cursor that will * early match can be removed and replaced with a Cursor that will
do an index scan. * do an index scan.
*
The cursor is added to the front of the pipeline's sources. * The cursor is added to the front of the pipeline's sources.
*
@param pPipeline the logical "this" for this operation * @param pPipeline the logical "this" for this operation
@param dbName the name of the database * @param pExpCtx the expression context for this pipeline
@param pExpCtx the expression context for this pipeline
*/ */
static void prepareCursorSource( static void prepareCursorSource(
const intrusive_ptr<Pipeline> &pPipeline, const intrusive_ptr<Pipeline> &pPipeline,
const string &dbName,
const intrusive_ptr<ExpressionContext> &pExpCtx); const intrusive_ptr<ExpressionContext> &pExpCtx);
private: private:
PipelineD(); // does not exist: prevent instantiation PipelineD(); // does not exist: prevent instantiation
}; };
} // namespace mongo } // namespace mongo
 End of changes. 3 change blocks. 
19 lines changed or deleted 35 lines changed or added


 plan_cache.h   plan_cache.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/exec/plan_stats.h" #include "mongo/db/exec/plan_stats.h"
#include "mongo/db/query/plan_ranker.h" #include "mongo/db/query/plan_ranker.h"
#include "mongo/db/query/query_solution.h" #include "mongo/db/query/query_solution.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 plan_executor.h   plan_executor.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#include "mongo/db/exec/plan_stage.h" #pragma once
#include "mongo/db/exec/working_set.h"
#include "mongo/db/exec/working_set_common.h" #include <boost/scoped_ptr.hpp>
#include "mongo/base/status.h"
#include "mongo/db/query/runner.h" #include "mongo/db/query/runner.h"
#include "mongo/db/query/runner_yield_policy.h" #include "mongo/db/query/runner_yield_policy.h"
#include "mongo/db/pdfile.h"
#pragma once
namespace mongo { namespace mongo {
class BSONObj;
class DiskLoc;
class PlanStage;
struct PlanStageStats;
class WorkingSet;
/** /**
* A PlanExecutor is the abstraction that knows how to crank a tree of stages into execution. * A PlanExecutor is the abstraction that knows how to crank a tree of stages into execution.
* The executor is usually part of a larger abstraction that is interac ting with the cache * The executor is usually part of a larger abstraction that is interac ting with the cache
* and/or the query optimizer. * and/or the query optimizer.
* *
* Executes a plan. Used by a runner. Calls work() on a plan until a result is produced. * Executes a plan. Used by a runner. Calls work() on a plan until a result is produced.
* Stops when the plan is EOF or if the plan errors. * Stops when the plan is EOF or if the plan errors.
*/ */
class PlanExecutor { class PlanExecutor {
public: public:
PlanExecutor(WorkingSet* ws, PlanStage* rt) PlanExecutor(WorkingSet* ws, PlanStage* rt);
: _workingSet(ws), _root(rt), _killed(false) { } ~PlanExecutor();
WorkingSet* getWorkingSet() { return _workingSet.get(); } //
// Accessors
//
/** /** TODO document me */
* Methods that just pass down to the PlanStage tree. WorkingSet* getWorkingSet();
*/
void saveState() { /** This is OK even if we were killed */
if (!_killed) { _root->prepareToYield(); } PlanStageStats* getStats() const;
}
//
bool restoreState() { // Methods that just pass down to the PlanStage tree.
if (!_killed) { //
_root->recoverFromYield();
} /** TODO document me */
return !_killed; void saveState();
}
/** TODO document me */
void invalidate(const DiskLoc& dl) { bool restoreState();
if (!_killed) { _root->invalidate(dl); }
} /** TODO document me */
void invalidate(const DiskLoc& dl);
//
// Running Support
//
/** TODO document me */
void setYieldPolicy(Runner::YieldPolicy policy);
/** TODO document me */
Runner::RunnerState getNext(BSONObj* objOut, DiskLoc* dlOut);
/** TOOD document me */
bool isEOF();
/** /**
* During the yield, the database we're operating over or any colle ction we're relying on * During the yield, the database we're operating over or any colle ction we're relying on
* may be dropped. When this happens all cursors and runners on th at database and * may be dropped. When this happens all cursors and runners on th at database and
* collection are killed or deleted in some fashion. (This is how t he _killed gets set.) * collection are killed or deleted in some fashion. (This is how t he _killed gets set.)
*/ */
void kill() { _killed = true; } void kill();
// This is OK even if we were killed.
PlanStageStats* getStats() { return _root->getStats(); }
void setYieldPolicy(Runner::YieldPolicy policy) {
if (Runner::YIELD_MANUAL == policy) {
_yieldPolicy.reset();
}
else {
_yieldPolicy.reset(new RunnerYieldPolicy());
}
}
bool isEOF() { return _killed || _root->isEOF(); }
Runner::RunnerState getNext(BSONObj* objOut, DiskLoc* dlOut) {
if (_killed) { return Runner::RUNNER_DEAD; }
for (;;) {
WorkingSetID id;
PlanStage::StageState code = _root->work(&id);
if (PlanStage::ADVANCED == code) {
WorkingSetMember* member = _workingSet->get(id);
if (NULL != objOut) {
if (WorkingSetMember::LOC_AND_IDX == member->state)
{
if (1 != member->keyData.size()) {
_workingSet->free(id);
return Runner::RUNNER_ERROR;
}
*objOut = member->keyData[0].keyData;
}
else if (member->hasObj()) {
*objOut = member->obj;
}
else {
_workingSet->free(id);
return Runner::RUNNER_ERROR;
}
}
if (NULL != dlOut) {
if (member->hasLoc()) {
*dlOut = member->loc;
}
else {
_workingSet->free(id);
return Runner::RUNNER_ERROR;
}
}
_workingSet->free(id);
return Runner::RUNNER_ADVANCED;
}
else if (PlanStage::NEED_TIME == code) {
// Fall through to yield check at end of large conditio
nal.
}
else if (PlanStage::NEED_FETCH == code) {
// id has a loc and refers to an obj we need to fetch.
WorkingSetMember* member = _workingSet->get(id);
// This must be true for somebody to request a fetch an
d can only change when an
// invalidation happens, which is when we give up a loc
k. Don't give up the
// lock between receiving the NEED_FETCH and actually f
etching(?).
verify(member->hasLoc());
// Actually bring record into memory.
Record* record = member->loc.rec();
// If we're allowed to, go to disk outside of the lock.
if (NULL != _yieldPolicy.get()) {
saveState();
_yieldPolicy->yield(record);
if (_killed) { return Runner::RUNNER_DEAD; }
restoreState();
}
else {
// We're set to manually yield. We go to disk in t
he lock.
record->touch();
}
// Record should be in memory now. Log if it's not.
if (!Record::likelyInPhysicalMemory(record->dataNoThrow
ing())) {
OCCASIONALLY {
warning() << "Record wasn't in memory immediate
ly after fetch: "
<< member->loc.toString() << endl;
}
}
// Note that we're not freeing id. Fetch semantics say
that we shouldn't.
}
else if (PlanStage::IS_EOF == code) {
return Runner::RUNNER_EOF;
}
else {
verify(PlanStage::FAILURE == code);
return Runner::RUNNER_DEAD;
}
// Yield, if we can yield ourselves.
if (NULL != _yieldPolicy.get() && _yieldPolicy->shouldYield
()) {
saveState();
_yieldPolicy->yield();
if (_killed) { return Runner::RUNNER_DEAD; }
restoreState();
}
}
}
private: private:
scoped_ptr<WorkingSet> _workingSet; boost::scoped_ptr<WorkingSet> _workingSet;
scoped_ptr<PlanStage> _root; boost::scoped_ptr<PlanStage> _root;
scoped_ptr<RunnerYieldPolicy> _yieldPolicy; boost::scoped_ptr<RunnerYieldPolicy> _yieldPolicy;
// Did somebody drop an index we care about or the namespace we're // Did somebody drop an index we care about or the namespace we're
looking at? If so, we'll looking at? If so,
// be killed. // we'll be killed.
bool _killed; bool _killed;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 10 change blocks. 
151 lines changed or deleted 74 lines changed or added


 plan_ranker.h   plan_ranker.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <queue> #include <deque>
#include <vector> #include <vector>
#include "mongo/db/exec/plan_stage.h" #include "mongo/db/exec/plan_stage.h"
#include "mongo/db/exec/plan_stats.h" #include "mongo/db/exec/plan_stats.h"
#include "mongo/db/exec/working_set.h" #include "mongo/db/exec/working_set.h"
#include "mongo/db/query/query_solution.h" #include "mongo/db/query/query_solution.h"
namespace mongo { namespace mongo {
struct CandidatePlan; struct CandidatePlan;
skipping to change at line 47 skipping to change at line 59
/** /**
* Returns index in 'candidates' of which plan is best. * Returns index in 'candidates' of which plan is best.
* If 'why' is not NULL, populates it with information relevant to why that plan was picked. * If 'why' is not NULL, populates it with information relevant to why that plan was picked.
*/ */
static size_t pickBestPlan(const vector<CandidatePlan>& candidates, static size_t pickBestPlan(const vector<CandidatePlan>& candidates,
PlanRankingDecision* why); PlanRankingDecision* why);
private: private:
/** /**
* Assign the stats tree a 'goodness' score. Used internally. * Assign the stats tree a 'goodness' score. Used internally.
*/ */
static double scoreTree(const PlanStageStats& stats); static double scoreTree(const PlanStageStats* stats);
}; };
/** /**
* A container holding one to-be-ranked plan and its associated/relevan t data. * A container holding one to-be-ranked plan and its associated/relevan t data.
* Does not own any of its pointers. * Does not own any of its pointers.
*/ */
struct CandidatePlan { struct CandidatePlan {
CandidatePlan(QuerySolution* s, PlanStage* r, WorkingSet* w) CandidatePlan(QuerySolution* s, PlanStage* r, WorkingSet* w)
: solution(s), root(r), ws(w) { } : solution(s), root(r), ws(w), failed(false) { }
QuerySolution* solution; QuerySolution* solution;
PlanStage* root; PlanStage* root;
WorkingSet* ws; WorkingSet* ws;
// Any results produced during the plan's execution prior to rankin g are retained here. // Any results produced during the plan's execution prior to rankin g are retained here.
std::queue<WorkingSetID> results; std::deque<WorkingSetID> results;
bool failed;
}; };
/** /**
* Information about why a plan was picked to be the best. Data here i s placed into the cache * Information about why a plan was picked to be the best. Data here i s placed into the cache
* and used by the CachedPlanRunner to compare expected performance wit h actual. * and used by the CachedPlanRunner to compare expected performance wit h actual.
*/ */
struct PlanRankingDecision { struct PlanRankingDecision {
PlanRankingDecision() : statsOfWinner(NULL), onlyOneSolution(false) { } PlanRankingDecision() : statsOfWinner(NULL), onlyOneSolution(false) { }
// Owned by us. // Owned by us.
 End of changes. 5 change blocks. 
4 lines changed or deleted 26 lines changed or added


 plan_stage.h   plan_stage.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/exec/plan_stats.h" #include "mongo/db/exec/plan_stats.h"
#include "mongo/db/exec/working_set.h" #include "mongo/db/exec/working_set.h"
namespace mongo { namespace mongo {
class DiskLoc; class DiskLoc;
skipping to change at line 110 skipping to change at line 122
ADVANCED, ADVANCED,
// work(...) won't do anything more. isEOF() will also be true . There is nothing // work(...) won't do anything more. isEOF() will also be true . There is nothing
// output in the out parameter. // output in the out parameter.
IS_EOF, IS_EOF,
// work(...) needs more time to product a result. Call work(.. .) again. There is // work(...) needs more time to product a result. Call work(.. .) again. There is
// nothing output in the out parameter. // nothing output in the out parameter.
NEED_TIME, NEED_TIME,
// Something went wrong but it's not an internal error. Perhap
s our collection was
// dropped or state deleted.
DEAD,
// Something has gone unrecoverably wrong. Stop running this q uery. There is nothing // Something has gone unrecoverably wrong. Stop running this q uery. There is nothing
// output in the out parameter. // output in the out parameter.
FAILURE, FAILURE,
// Something isn't in memory. Fetch it. // Something isn't in memory. Fetch it.
// //
// Full fetch semantics: // Full fetch semantics:
// The fetch-requesting stage populates the out parameter of wo rk(...) with a WSID that // The fetch-requesting stage populates the out parameter of wo rk(...) with a WSID that
// refers to a WSM with a valid loc. Each stage that receives a NEED_FETCH from a child // refers to a WSM with a valid loc. Each stage that receives a NEED_FETCH from a child
// must propagate the NEED_FETCH up and perform no work. The p lan runner is responsible // must propagate the NEED_FETCH up and perform no work. The p lan runner is responsible
// for paging in the data upon receipt of a NEED_FETCH. The pla n runner does NOT free // for paging in the data upon receipt of a NEED_FETCH. The pla n runner does NOT free
// the WSID of the requested fetch. The stage that requested t he fetch holds the WSID // the WSID of the requested fetch. The stage that requested t he fetch holds the WSID
// of the loc it wants fetched. On the next call to work() tha t stage can assume a // of the loc it wants fetched. On the next call to work() tha t stage can assume a
// fetch was performed on the WSM that the held WSID refers to. // fetch was performed on the WSM that the held WSID refers to.
NEED_FETCH, NEED_FETCH,
}; };
static string stateStr(const StageState& state) {
if (ADVANCED == state) {
return "ADVANCED";
}
else if (IS_EOF == state) {
return "IS_EOF";
}
else if (NEED_TIME == state) {
return "NEED_TIME";
}
else if (NEED_FETCH == state) {
return "NEED_FETCH";
}
else {
verify(FAILURE == state);
return "FAILURE";
}
}
/** /**
* Perform a unit of work on the query. Ask the stage to produce t he next unit of output. * Perform a unit of work on the query. Ask the stage to produce t he next unit of output.
* Stage returns StageState::ADVANCED if *out is set to the next un it of output. Otherwise, * Stage returns StageState::ADVANCED if *out is set to the next un it of output. Otherwise,
* returns another value of StageState to indicate the stage's stat us. * returns another value of StageState to indicate the stage's stat us.
*/ */
virtual StageState work(WorkingSetID* out) = 0; virtual StageState work(WorkingSetID* out) = 0;
/** /**
* Returns true if no more work can be done on the query / out of r esults. * Returns true if no more work can be done on the query / out of r esults.
*/ */
 End of changes. 3 change blocks. 
0 lines changed or deleted 44 lines changed or added


 plan_stats.h   plan_stats.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <cstdlib> #include <cstdlib>
#include <string>
#include <vector> #include <vector>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/query/stage_types.h" #include "mongo/db/query/stage_types.h"
#include "mongo/platform/cstdint.h" #include "mongo/platform/cstdint.h"
namespace mongo { namespace mongo {
using boost::scoped_ptr;
using std::size_t;
using std::vector;
struct SpecificStats; struct SpecificStats;
// Every stage has CommonStats. // Every stage has CommonStats.
struct CommonStats { struct CommonStats {
CommonStats() : works(0), CommonStats() : works(0),
yields(0), yields(0),
unyields(0), unyields(0),
invalidates(0), invalidates(0),
advanced(0), advanced(0),
needTime(0), needTime(0),
skipping to change at line 70 skipping to change at line 80
// TODO: once we've picked a plan, collect different (or additional ) stats for display to // TODO: once we've picked a plan, collect different (or additional ) stats for display to
// the user, eg. time_t totalTimeSpent; // the user, eg. time_t totalTimeSpent;
// TODO: keep track of total yield time / fetch time for a plan (do ne by runner) // TODO: keep track of total yield time / fetch time for a plan (do ne by runner)
bool isEOF; bool isEOF;
}; };
// The universal container for a stage's stats. // The universal container for a stage's stats.
struct PlanStageStats { struct PlanStageStats {
PlanStageStats(const CommonStats& c) : common(c) { } PlanStageStats(const CommonStats& c, StageType t) : stageType(t), c ommon(c) { }
~PlanStageStats() { ~PlanStageStats() {
for (size_t i = 0; i < children.size(); ++i) { for (size_t i = 0; i < children.size(); ++i) {
delete children[i]; delete children[i];
} }
} }
// See query/stage_type.h
StageType stageType;
// Stats exported by implementing the PlanStage interface. // Stats exported by implementing the PlanStage interface.
CommonStats common; CommonStats common;
// Per-stage place to stash additional information // Per-stage place to stash additional information
scoped_ptr<SpecificStats> specific; boost::scoped_ptr<SpecificStats> specific;
template <typename T> void setSpecific(const T& statData) {
specific.reset(new T(statData));
}
template <typename T> const T& getSpecific() const {
return *static_cast<T*>(specific.get());
}
// The stats of the node's children. // The stats of the node's children.
vector<PlanStageStats*> children; std::vector<PlanStageStats*> children;
private: private:
MONGO_DISALLOW_COPYING(PlanStageStats); MONGO_DISALLOW_COPYING(PlanStageStats);
}; };
/** /**
* The interface all specific-to-stage stats provide. * The interface all specific-to-stage stats provide.
*/ */
struct SpecificStats { struct SpecificStats {
virtual ~SpecificStats() { } virtual ~SpecificStats() { }
virtual StageType getType() = 0; };
struct CollectionScanStats : public SpecificStats {
CollectionScanStats() : docsTested(0) { }
// How many documents did we check against our filter?
uint64_t docsTested;
}; };
struct AndHashStats : public SpecificStats { struct AndHashStats : public SpecificStats {
AndHashStats() : flaggedButPassed(0), AndHashStats() : flaggedButPassed(0),
flaggedInProgress(0) { } flaggedInProgress(0) { }
virtual ~AndHashStats() { } virtual ~AndHashStats() { }
StageType getType() { return STAGE_AND_HASH; }
// Invalidation counters. // Invalidation counters.
// How many results had the AND fully evaluated but were invalidate d? // How many results had the AND fully evaluated but were invalidate d?
uint64_t flaggedButPassed; uint64_t flaggedButPassed;
// How many results were mid-AND but got flagged? // How many results were mid-AND but got flagged?
uint64_t flaggedInProgress; uint64_t flaggedInProgress;
// How many entries are in the map after each child? // How many entries are in the map after each child?
// child 'i' produced children[i].common.advanced DiskLocs, of whic h mapAfterChild[i] were // child 'i' produced children[i].common.advanced DiskLocs, of whic h mapAfterChild[i] were
// intersections. // intersections.
vector<uint64_t> mapAfterChild; std::vector<uint64_t> mapAfterChild;
// mapAfterChild[mapAfterChild.size() - 1] WSMswere match tested. // mapAfterChild[mapAfterChild.size() - 1] WSMswere match tested.
// commonstats.advanced is how many passed. // commonstats.advanced is how many passed.
}; };
struct AndSortedStats : public SpecificStats { struct AndSortedStats : public SpecificStats {
AndSortedStats() : flagged(0), AndSortedStats() : flagged(0),
matchTested(0) { } matchTested(0) { }
virtual ~AndSortedStats() { } virtual ~AndSortedStats() { }
StageType getType() { return STAGE_AND_SORTED; }
// How many results from each child did not pass the AND? // How many results from each child did not pass the AND?
vector<uint64_t> failedAnd; std::vector<uint64_t> failedAnd;
// How many results were flagged via invalidation? // How many results were flagged via invalidation?
uint64_t flagged; uint64_t flagged;
// Fails == common.advanced - matchTested // Fails == common.advanced - matchTested
uint64_t matchTested; uint64_t matchTested;
}; };
struct FetchStats : public SpecificStats { struct FetchStats : public SpecificStats {
FetchStats() : alreadyHasObj(0), FetchStats() : alreadyHasObj(0),
forcedFetches(0), forcedFetches(0),
matchTested(0) { } matchTested(0) { }
virtual ~FetchStats() { } virtual ~FetchStats() { }
StageType getType() { return STAGE_FETCH; }
// Have we seen anything that already had an object? // Have we seen anything that already had an object?
uint64_t alreadyHasObj; uint64_t alreadyHasObj;
// How many fetches weren't in memory? it's common.needFetch. // How many fetches weren't in memory? it's common.needFetch.
// How many total fetches did we do? it's common.advanced. // How many total fetches did we do? it's common.advanced.
// So the number of fetches that were in memory are common.advanced - common.needFetch. // So the number of fetches that were in memory are common.advanced - common.needFetch.
// How many records were we forced to fetch as the result of an inv alidation? // How many records were we forced to fetch as the result of an inv alidation?
uint64_t forcedFetches; uint64_t forcedFetches;
// We know how many passed (it's the # of advanced) and therefore h ow many failed. // We know how many passed (it's the # of advanced) and therefore h ow many failed.
uint64_t matchTested; uint64_t matchTested;
}; };
struct IndexScanStats : public SpecificStats { struct IndexScanStats : public SpecificStats {
IndexScanStats() : yieldMovedCursor(0), IndexScanStats() : isMultiKey(false),
yieldMovedCursor(0),
dupsTested(0), dupsTested(0),
dupsDropped(0), dupsDropped(0),
seenInvalidated(0), seenInvalidated(0),
matchTested(0) { } matchTested(0),
keysExamined(0) { }
virtual ~IndexScanStats() { } virtual ~IndexScanStats() { }
StageType getType() { return STAGE_IXSCAN; }
// Index type being used.
std::string indexType;
// name of the index being used
std::string indexName;
BSONObj keyPattern;
// A BSON (opaque, ie. hands off other than toString() it) represen
tation of the bounds
// used.
BSONObj indexBounds;
// >1 if we're traversing the index along with its order. <1 if we'
re traversing it
// against the order.
int direction;
// Whether this index is over a field that contain array values.
bool isMultiKey;
uint64_t yieldMovedCursor; uint64_t yieldMovedCursor;
uint64_t dupsTested; uint64_t dupsTested;
uint64_t dupsDropped; uint64_t dupsDropped;
uint64_t seenInvalidated; uint64_t seenInvalidated;
// TODO: we could track key sizes here. // TODO: we could track key sizes here.
// We know how many passed (it's the # of advanced) and therefore h ow many failed. // We know how many passed (it's the # of advanced) and therefore h ow many failed.
uint64_t matchTested; uint64_t matchTested;
};
struct MergeSortStats : public SpecificStats { // Number of entries retrieved from the index during the scan.
MergeSortStats() : dupsTested(0), uint64_t keysExamined;
dupsDropped(0),
forcedFetches(0) { }
virtual ~MergeSortStats() { }
StageType getType() { return STAGE_SORT_MERGE; }
uint64_t dupsTested;
uint64_t dupsDropped;
// How many records were we forced to fetch as the result of an inv
alidation?
uint64_t forcedFetches;
}; };
struct OrStats : public SpecificStats { struct OrStats : public SpecificStats {
OrStats() : dupsTested(0), OrStats() : dupsTested(0),
dupsDropped(0), dupsDropped(0),
locsForgotten(0) { } locsForgotten(0) { }
virtual ~OrStats() { } virtual ~OrStats() { }
StageType getType() { return STAGE_OR; }
uint64_t dupsTested; uint64_t dupsTested;
uint64_t dupsDropped; uint64_t dupsDropped;
// How many calls to invalidate(...) actually removed a DiskLoc fro m our deduping map? // How many calls to invalidate(...) actually removed a DiskLoc fro m our deduping map?
uint64_t locsForgotten; uint64_t locsForgotten;
// We know how many passed (it's the # of advanced) and therefore h ow many failed. // We know how many passed (it's the # of advanced) and therefore h ow many failed.
vector<uint64_t> matchTested; std::vector<uint64_t> matchTested;
}; };
struct SortStats : public SpecificStats { struct SortStats : public SpecificStats {
SortStats() : forcedFetches(0) { } SortStats() : forcedFetches(0) { }
virtual ~SortStats() { } virtual ~SortStats() { }
StageType getType() { return STAGE_SORT; }
// How many records were we forced to fetch as the result of an inv
alidation?
uint64_t forcedFetches;
};
struct MergeSortStats : public SpecificStats {
MergeSortStats() : dupsTested(0),
dupsDropped(0),
forcedFetches(0) { }
virtual ~MergeSortStats() { }
uint64_t dupsTested;
uint64_t dupsDropped;
// How many records were we forced to fetch as the result of an inv alidation? // How many records were we forced to fetch as the result of an inv alidation?
uint64_t forcedFetches; uint64_t forcedFetches;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 23 change blocks. 
41 lines changed or deleted 80 lines changed or added


 port.h   port.h 
skipping to change at line 706 skipping to change at line 706
} }
#endif #endif
// HK's fun windows fixer-upper defines go here! Woo. // HK's fun windows fixer-upper defines go here! Woo.
#ifdef _WIN32 #ifdef _WIN32
#define strtoll _strtoi64 #define strtoll _strtoi64
#define strtoull _strtoui64 #define strtoull _strtoui64
#define safe_vsnprintf _vsnprintf #define safe_vsnprintf _vsnprintf
#define snprintf _snprintf #define snprintf _snprintf
#if _MSC_VER < 1800
inline void va_copy(va_list& a, va_list& b) { inline void va_copy(va_list& a, va_list& b) {
a = b; a = b;
} }
#endif
using namespace std; using namespace std;
#define isnan _isnan #define isnan _isnan
#define snprintf _snprintf #define snprintf _snprintf
#include "float.h" #include "float.h"
inline double sqrt(int x) { return sqrt((double)x); } inline double sqrt(int x) { return sqrt((double)x); }
inline int isinf(double x) { inline int isinf(double x) {
const int float_point_class =_fpclass(x); const int float_point_class =_fpclass(x);
if (float_point_class == _FPCLASS_PINF) return 1; if (float_point_class == _FPCLASS_PINF) return 1;
if (float_point_class == _FPCLASS_NINF) return -1; if (float_point_class == _FPCLASS_NINF) return -1;
return 0; return 0;
 End of changes. 2 change blocks. 
0 lines changed or deleted 2 lines changed or added


 prefetch.h   prefetch.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
namespace mongo { namespace mongo {
class NamespaceDetails; class NamespaceDetails;
// page in both index and data pages for an op from the oplog // page in both index and data pages for an op from the oplog
void prefetchPagesForReplicatedOp(const BSONObj& op); void prefetchPagesForReplicatedOp(const BSONObj& op);
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 privilege.h   privilege.h 
skipping to change at line 18 skipping to change at line 18
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
#include <string>
#include <vector> #include <vector>
#include "mongo/db/auth/action_set.h" #include "mongo/db/auth/action_set.h"
#include "mongo/db/auth/action_type.h" #include "mongo/db/auth/action_type.h"
#include "mongo/db/auth/privilege_parser.h"
#include "mongo/db/auth/resource_pattern.h"
namespace mongo { namespace mongo {
class Privilege;
typedef std::vector<Privilege> PrivilegeVector;
/** /**
* A representation of the permission to perform a set of actions on a specific resource. * A representation of the permission to perform a set of actions on a resource.
*/ */
class Privilege { class Privilege {
public: public:
/**
Privilege(const std::string& resource, const ActionType& action); * Adds "privilegeToAdd" to "privileges", de-duping "privilegeToAdd
Privilege(const std::string& resource, const ActionSet& actions); " if the vector already
* contains a privilege on the same resource.
*
* This method is the preferred way to add privileges to privilege
vectors.
*/
static void addPrivilegeToPrivilegeVector(PrivilegeVector* privileg
es,
const Privilege& privileg
eToAdd);
Privilege() {};
Privilege(const ResourcePattern& resource, const ActionType& action
);
Privilege(const ResourcePattern& resource, const ActionSet& actions
);
~Privilege() {} ~Privilege() {}
const std::string& getResource() const { return _resource; } const ResourcePattern& getResourcePattern() const { return _resourc e; }
const ActionSet& getActions() const { return _actions; } const ActionSet& getActions() const { return _actions; }
void addActions(const ActionSet& actionsToAdd); void addActions(const ActionSet& actionsToAdd);
void removeActions(const ActionSet& actionsToRemove); void removeActions(const ActionSet& actionsToRemove);
// Checks if the given action is present in the Privilege. // Checks if the given action is present in the Privilege.
bool includesAction(const ActionType& action) const; bool includesAction(const ActionType& action) const;
// Checks if the given actions are present in the Privilege. // Checks if the given actions are present in the Privilege.
bool includesActions(const ActionSet& actions) const; bool includesActions(const ActionSet& actions) const;
private: private:
std::string _resource; ResourcePattern _resource;
ActionSet _actions; // bitmask of actions this privilege grants ActionSet _actions; // bitmask of actions this privilege grants
}; };
typedef std::vector<Privilege> PrivilegeVector;
} // namespace mongo } // namespace mongo
 End of changes. 8 change blocks. 
9 lines changed or deleted 26 lines changed or added


 processinfo.h   processinfo.h 
skipping to change at line 172 skipping to change at line 172
inline const SystemInfo& sysInfo() const { inline const SystemInfo& sysInfo() const {
return *systemInfo; return *systemInfo;
} }
public: public:
static void initializeSystemInfo(); static void initializeSystemInfo();
}; };
void writePidFile( const std::string& path ); bool writePidFile( const std::string& path );
void printMemInfo( const char * whereContextStr = 0 ); void printMemInfo( const char * whereContextStr = 0 );
} }
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 qlock.h   qlock.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/thread/mutex.hpp> #include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp> #include <boost/thread/condition.hpp>
#include "../assert_util.h" #include "../assert_util.h"
#include "../time_support.h" #include "../time_support.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 query.h   query.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/dbmessage.h" #include "mongo/db/dbmessage.h"
#include "mongo/db/explain.h" #include "mongo/db/explain.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 query_optimizer.h   query_optimizer.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/query_plan_selection_policy.h" #include "mongo/db/query_plan_selection_policy.h"
namespace mongo { namespace mongo {
class Cursor; class Cursor;
class ParsedQuery; class ParsedQuery;
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 query_optimizer_internal.h   query_optimizer_internal.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/db/clientcursor.h" #include "mongo/db/clientcursor.h"
#include "mongo/db/cursor.h" #include "mongo/db/cursor.h"
#include "mongo/db/explain.h" #include "mongo/db/explain.h"
#include "mongo/db/matcher.h" #include "mongo/db/matcher.h"
#include "mongo/db/query_plan.h" #include "mongo/db/query_plan.h"
#include "mongo/db/queryutil.h" #include "mongo/db/queryutil.h"
#include "mongo/util/elapsed_tracker.h" #include "mongo/util/elapsed_tracker.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 query_plan.h   query_plan.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/index/index_descriptor.h" #include "mongo/db/index/index_descriptor.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/matcher.h" #include "mongo/db/matcher.h"
#include "mongo/db/projection.h" #include "mongo/db/projection.h"
#include "mongo/db/querypattern.h" #include "mongo/db/querypattern.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 query_plan_selection_policy.h   query_plan_selection_policy.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
class QueryPlan; class QueryPlan;
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 query_plan_summary.h   query_plan_summary.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/projection.h" #include "mongo/db/projection.h"
namespace mongo { namespace mongo {
class FieldRangeSet; class FieldRangeSet;
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 query_planner.h   query_planner.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/query/canonical_query.h" #include "mongo/db/query/canonical_query.h"
#include "mongo/db/query/index_entry.h"
#include "mongo/db/query/query_solution.h" #include "mongo/db/query/query_solution.h"
namespace mongo { namespace mongo {
/** /**
* QueryPlanner's job is to provide an entry point to the query plannin g and optimization * QueryPlanner's job is to provide an entry point to the query plannin g and optimization
* process. * process.
*/ */
class QueryPlanner { class QueryPlanner {
public: public:
enum Options {
// You probably want to set this.
DEFAULT = 0,
// Set this if you don't want a table scan.
// See http://docs.mongodb.org/manual/reference/parameters/
NO_TABLE_SCAN = 1,
// Set this if you want a collscan outputted even if there's an
ixscan.
INCLUDE_COLLSCAN = 2,
};
/** /**
* Outputs a series of possible solutions for the provided 'query' into 'out'. Uses the * Outputs a series of possible solutions for the provided 'query' into 'out'. Uses the
* provided indices to generate a solution. * provided indices to generate a solution.
* *
* Caller owns pointers in *out. * Caller owns pointers in *out.
*/ */
static void plan(const CanonicalQuery& query, static void plan(const CanonicalQuery& query,
const BSONObjSet& indexKeyPatterns, const vector<IndexEntry>& indices,
size_t options,
vector<QuerySolution*>* out); vector<QuerySolution*>* out);
private: private:
//
// Index Selection methods.
//
/**
* Return all the fields in the tree rooted at 'node' that we can u
se an index on
* in order to answer the query.
*
* The 'prefix' argument is a path prefix to be prepended to any fi
elds mentioned in
* predicates encountered. Some array operators specify a path pre
fix.
*/
static void getFields(MatchExpression* node, string prefix, unorder
ed_set<string>* out);
/**
* Find all indices prefixed by fields we have predicates over. On
ly these indices are
* useful in answering the query.
*/
static void findRelevantIndices(const unordered_set<string>& fields
,
const vector<IndexEntry>& indices,
vector<IndexEntry>* out);
/**
* Return true if the index key pattern field 'elt' (which belongs
to 'index') can be used
* to answer the predicate 'node'.
*
* For example, {field: "hashed"} can only be used with sets of equ
alities.
* {field: "2d"} can only be used with some geo predic
ates.
* {field: "2dsphere"} can only be used with some othe
r geo predicates.
*/
static bool compatible(const BSONElement& elt, const IndexEntry& in
dex, MatchExpression* node);
/** /**
* Returns true if the tree rooted at 'node' requires an index to a * Determine how useful all of our relevant 'indices' are to all pr
nswer the query. There edicates in the subtree
* is a default solution for every plan that is a collection scan + * rooted at 'node'. Affixes a RelevantTag to all predicate nodes
a filter for the full which can use an index.
* query. We can use this default solution when the query doesn't *
require an index. * 'prefix' is a path prefix that should be prepended to any path (
certain array operators
* imply a path prefix).
*
* For an index to be useful to a predicate, the index must be comp
atible (see above).
*
* If an index is prefixed by the predicate's path, it's always use
ful.
*
* If an index is compound but not prefixed by a predicate's path,
it's only useful if
* there exists another predicate that 1. will use that index and 2
. is related to the
* original predicate by having an AND as a parent.
*/
static void rateIndices(MatchExpression* node, string prefix,
const vector<IndexEntry>& indices);
//
// Collection Scan Data Access method.
//
/**
* Return a CollectionScanNode that scans as requested in 'query'.
*/
static QuerySolution* makeCollectionScan(const CanonicalQuery& quer
y, bool tailable);
//
// Indexed Data Access methods.
//
// The inArrayOperator flag deserves some attention. It is set whe
n we're processing a child of
// a MatchExpression::ALL or MatchExpression::ELEM_MATCH_OBJECT.
//
// When true, the following behavior changes for all methods below
that take it as an argument:
// 0. No deletion of MatchExpression(s). In fact,
// 1. No mutation of the MatchExpression at all. We need the tree
as-is in order to perform
// a filter on the entire tree.
// 2. No fetches performed. There will be a final fetch by the cal
ler of buildIndexedDataAccess
// who set the value of inArrayOperator to true.
// 3. No compound indices are used and no bounds are combined. The
se are incorrect in the context
// of these operators.
//
/**
* If 'inArrayOperator' is false, takes ownership of 'root'.
*/
static QuerySolutionNode* buildIndexedDataAccess(MatchExpression* r
oot,
bool inArrayOperat
or,
const vector<Index
Entry>& indices);
/**
* Takes ownership of 'root'.
*/
static QuerySolutionNode* buildIndexedAnd(MatchExpression* root,
bool inArrayOperator,
const vector<IndexEntry>&
indices);
/**
* Takes ownership of 'root'.
*/
static QuerySolutionNode* buildIndexedOr(MatchExpression* root,
bool inArrayOperator,
const vector<IndexEntry>&
indices);
/**
* Helper used by buildIndexedAnd and buildIndexedOr.
*
* The children of AND and OR nodes are sorted by the index that th
e subtree rooted at
* that node uses. Child nodes that use the same index are adjacen
t to one another to
* facilitate grouping of index scans. As such, the processing for
AND and OR is
* almost identical.
*
* See tagForSort and sortUsingTags in index_tag.h for details on o
rdering the children
* of OR and AND.
*
* Does not take ownership of 'root' but may remove children from i
t.
*/
static bool processIndexScans(MatchExpression* root,
bool inArrayOperator,
const vector<IndexEntry>& indices,
vector<QuerySolutionNode*>* out);
//
// Helpers for creating an index scan.
//
/**
* Create a new data access node.
*
* If the node is an index scan, the bounds for 'expr' are computed
and placed into the
* first field's OIL position. The rest of the OILs are allocated
but uninitialized.
*
* If the node is a geo node, XXX.
*/
static QuerySolutionNode* makeLeafNode(const IndexEntry& index,
MatchExpression* expr,
bool* exact);
/**
* Merge the predicate 'expr' with the leaf node 'node'.
*/
static void mergeWithLeafNode(MatchExpression* expr, const IndexEnt
ry& index,
size_t pos, bool* exactOut, QuerySolu
tionNode* node,
MatchExpression::MatchType mergeType)
;
/**
* If index scan, fill in any bounds that are missing in 'node' wit
h the "all values for
* this field" interval.
*
* If geo, XXX.
*/
static void finishLeafNode(QuerySolutionNode* node, const IndexEntr
y& index);
//
// Analysis of Data Access
//
/**
* In brief: performs sort and covering analysis.
*
* The solution rooted at 'solnRoot' provides data for the query, w
hether through some
* configuration of indices or through a collection scan. Addition
al stages may be required
* to perform sorting, projection, or other operations that are ind
ependent of the source
* of the data. These stages are added atop 'solnRoot'.
*
* 'taggedRoot' is a copy of the parse tree. Nodes in 'solnRoot' m
ay point into it.
*
* Takes ownership of 'solnRoot' and 'taggedRoot'.
* *
* TODO: When we create plans with indices, we'll want to know whic * Caller owns the returned QuerySolution.
h nodes require an index
* and what the parents of those nodes are.
*/ */
static bool requiresIndex(const MatchExpression* node); static QuerySolution* analyzeDataAccess(const CanonicalQuery& query
,
QuerySolutionNode* solnRoot
);
}; };
} // namespace mongo } // namespace mongo
 End of changes. 9 change blocks. 
12 lines changed or deleted 245 lines changed or added


 query_runner.h   query_runner.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
namespace mongo { namespace mongo {
class BSONObj; class BSONObj;
class IndexDetails; class IndexDetails;
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 query_solution.h   query_solution.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/matcher/expression.h" #include "mongo/db/matcher/expression.h"
#include "mongo/db/geo/geoquery.h"
#include "mongo/db/fts/fts_query.h"
#include "mongo/db/query/index_bounds.h" #include "mongo/db/query/index_bounds.h"
#include "mongo/db/query/projection_parser.h"
#include "mongo/db/query/stage_types.h" #include "mongo/db/query/stage_types.h"
namespace mongo { namespace mongo {
using mongo::fts::FTSQuery;
/** /**
* This is an abstract representation of a query plan. It can be trans cribed into a tree of * This is an abstract representation of a query plan. It can be trans cribed into a tree of
* PlanStages, which can then be handed to a PlanRunner for execution. * PlanStages, which can then be handed to a PlanRunner for execution.
*/ */
struct QuerySolutionNode { struct QuerySolutionNode {
QuerySolutionNode() { } QuerySolutionNode() { }
virtual ~QuerySolutionNode() { } virtual ~QuerySolutionNode() { }
/** /**
* What stage should this be transcribed to? See stage_types.h. * What stage should this be transcribed to? See stage_types.h.
*/ */
virtual StageType getType() const = 0; virtual StageType getType() const = 0;
string toString() const {
stringstream ss;
appendToString(&ss, 0);
return ss.str();
}
/** /**
* Internal function called by toString() * Internal function called by toString()
*
* TODO: Consider outputting into a BSONObj or builder thereof.
*/ */
virtual void appendToString(stringstream* ss) const = 0; virtual void appendToString(stringstream* ss, int indent) const = 0
;
/**
* If true, one of these are true:
* 1. All outputs are already fetched, or
* 2. There is a projection in place and a fetch is not re
quired.
*
* If false, a fetch needs to be placed above the root in order to
provide results.
*
* Usage: To determine if every possible result that might reach th
e root
* will be fully-fetched or not. We don't want any surplus fetches
.
*/
virtual bool fetched() const = 0;
/**
* Returns true if the tree rooted at this node provides data with
the field name 'field'.
* This data can come from any of the types of the WSM.
*
* Usage: If an index-only plan has all the fields we're interested
in, we don't
* have to fetch to show results with those fields.
*
* TODO: 'field' is probably more appropriate as a FieldRef or stri
ng.
*/
virtual bool hasField(const string& field) const = 0;
/**
* Returns true if the tree rooted at this node provides data that
is sorted by the
* its location on disk.
*
* Usage: If all the children of an STAGE_AND_HASH have this proper
ty, we can compute the
* AND faster by replacing the STAGE_AND_HASH with STAGE_AND_SORTED
.
*/
virtual bool sortedByDiskLoc() const = 0;
/**
* Return a BSONObj representing the sort order of the data stream
from this node. If the data
* is not sorted in any particular fashion, returns BSONObj().
*
* TODO: Is BSONObj really the best way to represent this?
*
* Usage:
* 1. If our plan gives us a sort order, we don't have to add a sor
t stage.
* 2. If all the children of an OR have the same sort order, we can
maintain that
* sort order with a STAGE_SORT_MERGE instead of STAGE_OR.
*/
virtual BSONObj getSort() const = 0;
protected:
static void addIndent(stringstream* ss, int level) {
for (int i = 0; i < level; ++i) {
*ss << "---";
}
}
private: private:
MONGO_DISALLOW_COPYING(QuerySolutionNode); MONGO_DISALLOW_COPYING(QuerySolutionNode);
}; };
/** /**
* A QuerySolution must be entirely self-contained and own everything i nside of it. * A QuerySolution must be entirely self-contained and own everything i nside of it.
* *
* A tree of stages may be built from a QuerySolution. The QuerySoluti on must outlive the tree * A tree of stages may be built from a QuerySolution. The QuerySoluti on must outlive the tree
* of stages. * of stages.
*/ */
struct QuerySolution { struct QuerySolution {
QuerySolution() { } QuerySolution() : hasSortStage(false) { }
// Owned here. // Owned here.
scoped_ptr<QuerySolutionNode> root; scoped_ptr<QuerySolutionNode> root;
// Owned here. // Any filters in root or below point into this object. Must be ow
scoped_ptr<MatchExpression> filter; ned.
// Any filters in root or below point into this. Must be owned.
BSONObj filterData; BSONObj filterData;
string ns;
// XXX temporary: if it has a sort stage the sort wasn't provided b
y an index,
// so we use that index (if it exists) to provide a sort.
bool hasSortStage;
/** /**
* Output a human-readable string representing the plan. * Output a human-readable string representing the plan.
*/ */
string toString() { string toString() {
if (NULL == root) { if (NULL == root) {
return "empty query solution"; return "empty query solution";
} }
stringstream ss; stringstream ss;
root->appendToString(&ss); root->appendToString(&ss, 0);
return ss.str(); return ss.str();
} }
private: private:
MONGO_DISALLOW_COPYING(QuerySolution); MONGO_DISALLOW_COPYING(QuerySolution);
}; };
struct TextNode : public QuerySolutionNode {
TextNode() : _numWanted(100) { }
virtual ~TextNode() { }
virtual StageType getType() const { return STAGE_TEXT; }
virtual void appendToString(stringstream* ss, int indent) const;
bool fetched() const { return false; }
bool hasField(const string& field) const { return false; }
bool sortedByDiskLoc() const { return false; }
BSONObj getSort() const { return _indexKeyPattern; }
uint32_t _numWanted;
BSONObj _indexKeyPattern;
std::string _query;
std::string _language;
scoped_ptr<MatchExpression> _filter;
};
struct CollectionScanNode : public QuerySolutionNode { struct CollectionScanNode : public QuerySolutionNode {
CollectionScanNode() : filter(NULL) { } CollectionScanNode();
virtual ~CollectionScanNode() { }
virtual StageType getType() const { return STAGE_COLLSCAN; } virtual StageType getType() const { return STAGE_COLLSCAN; }
virtual void appendToString(stringstream* ss) const { virtual void appendToString(stringstream* ss, int indent) const;
*ss << "COLLSCAN ns=" << name << " filter= " << filter->toStrin
g() << endl; bool fetched() const { return true; }
} bool hasField(const string& field) const { return true; }
bool sortedByDiskLoc() const { return false; }
BSONObj getSort() const { return BSONObj(); }
// Name of the namespace.
string name; string name;
// Not owned. // Should we make a tailable cursor?
// This is a sub-tree of the filter in the QuerySolution that owns bool tailable;
us.
// TODO: This may change in the future. int direction;
MatchExpression* filter;
scoped_ptr<MatchExpression> filter;
};
struct AndHashNode : public QuerySolutionNode {
AndHashNode();
virtual ~AndHashNode();
virtual StageType getType() const { return STAGE_AND_HASH; }
virtual void appendToString(stringstream* ss, int indent) const;
bool fetched() const;
bool hasField(const string& field) const;
bool sortedByDiskLoc() const { return false; }
BSONObj getSort() const { return BSONObj(); }
scoped_ptr<MatchExpression> filter;
vector<QuerySolutionNode*> children;
};
struct AndSortedNode : public QuerySolutionNode {
AndSortedNode();
virtual ~AndSortedNode();
virtual StageType getType() const { return STAGE_AND_SORTED; }
virtual void appendToString(stringstream* ss, int indent) const;
bool fetched() const;
bool hasField(const string& field) const;
bool sortedByDiskLoc() const { return true; }
BSONObj getSort() const { return BSONObj(); }
scoped_ptr<MatchExpression> filter;
vector<QuerySolutionNode*> children;
};
struct OrNode : public QuerySolutionNode {
OrNode();
virtual ~OrNode();
virtual StageType getType() const { return STAGE_OR; }
virtual void appendToString(stringstream* ss, int indent) const;
bool fetched() const;
bool hasField(const string& field) const;
bool sortedByDiskLoc() const {
// Even if our children are sorted by their diskloc or other fi
elds, we don't maintain
// any order on the output.
return false;
}
BSONObj getSort() const { return BSONObj(); }
bool dedup;
// XXX why is this here
scoped_ptr<MatchExpression> filter;
vector<QuerySolutionNode*> children;
};
struct MergeSortNode : public QuerySolutionNode {
MergeSortNode();
virtual ~MergeSortNode();
virtual StageType getType() const { return STAGE_SORT_MERGE; }
virtual void appendToString(stringstream* ss, int indent) const;
bool fetched() const;
bool hasField(const string& field) const;
bool sortedByDiskLoc() const { return false; }
BSONObj getSort() const { return sort; }
BSONObj sort;
bool dedup;
// XXX why is this here
scoped_ptr<MatchExpression> filter;
vector<QuerySolutionNode*> children;
};
struct FetchNode : public QuerySolutionNode {
FetchNode();
virtual ~FetchNode() { }
virtual StageType getType() const { return STAGE_FETCH; }
virtual void appendToString(stringstream* ss, int indent) const;
bool fetched() const { return true; }
bool hasField(const string& field) const { return true; }
bool sortedByDiskLoc() const { return child->sortedByDiskLoc(); }
BSONObj getSort() const { return child->getSort(); }
scoped_ptr<MatchExpression> filter;
scoped_ptr<QuerySolutionNode> child;
}; };
struct IndexScanNode : public QuerySolutionNode { struct IndexScanNode : public QuerySolutionNode {
IndexScanNode() : filter(NULL), limit(0), direction(1) { } IndexScanNode();
virtual ~IndexScanNode() { }
virtual StageType getType() const { return STAGE_IXSCAN; } virtual StageType getType() const { return STAGE_IXSCAN; }
virtual void appendToString(stringstream* ss) const { virtual void appendToString(stringstream* ss, int indent) const;
*ss << "IXSCAN kp=" << indexKeyPattern;
if (NULL != filter) { bool fetched() const { return false; }
*ss << " filter= " << filter->toString(); bool hasField(const string& field) const;
} bool sortedByDiskLoc() const;
*ss << " dir = " << direction;
*ss << " bounds = " << bounds.toString(); // XXX: We need a better way of dealing with sorting and equalities
} on a prefix of the key
// pattern. If we are using the index {a:1, b:1} to answer the pre
dicate {a: 10}, it's
// sorted both by the index key pattern and by the pattern {b: 1}.
How do we expose this?
// Perhaps migrate to sortedBy(...) instead of getSort(). In this
case, the ixscan can
// return true for both of those sort orders.
//
// This doesn't work for detecting that we can use a merge sort, th
ough. Perhaps we should
// just pick one sort order and miss out on the other case? For th
e golden query we want
// our sort order to be {b: 1}.
BSONObj getSort() const { return indexKeyPattern; }
BSONObj indexKeyPattern; BSONObj indexKeyPattern;
// Not owned. bool indexIsMultiKey;
// This is a sub-tree of the filter in the QuerySolution that owns
us. scoped_ptr<MatchExpression> filter;
// TODO: This may change in the future.
MatchExpression* filter;
// Only set for 2d. // Only set for 2d.
int limit; int limit;
int direction; int direction;
// BIG NOTE:
// If you use simple bounds, we'll use whatever index access method
the keypattern implies.
// If you use the complex bounds, we force Btree access.
// The complex bounds require Btree access.
IndexBounds bounds; IndexBounds bounds;
}; };
struct ProjectionNode : public QuerySolutionNode {
ProjectionNode() : projection(NULL) { }
virtual ~ProjectionNode() { }
virtual StageType getType() const { return STAGE_PROJECTION; }
virtual void appendToString(stringstream* ss, int indent) const;
/**
* This node changes the type to OWNED_OBJ. There's no fetching po
ssible after this.
*/
bool fetched() const { return true; }
bool hasField(const string& field) const {
// XXX XXX: perhaps have the QueryProjection pre-allocated and
defer to it? we don't
// know what we're dropping. Until we push projection down thi
s doesn't matter.
return false;
}
bool sortedByDiskLoc() const {
// Projections destroy the DiskLoc. By returning true here, th
is kind of implies that a
// fetch could still be done upstream.
//
// Perhaps this should be false to not imply that there *is* a
DiskLoc? Kind of a
// corner case.
return child->sortedByDiskLoc();
}
BSONObj getSort() const {
// TODO: If we're applying a projection that maintains sort ord
er, the prefix of the
// sort order we project is the sort order.
return BSONObj();
}
// Points into the CanonicalQuery.
ParsedProjection* projection;
scoped_ptr<QuerySolutionNode> child;
// TODO: Filter
};
struct SortNode : public QuerySolutionNode {
SortNode() { }
virtual ~SortNode() { }
virtual StageType getType() const { return STAGE_SORT; }
virtual void appendToString(stringstream* ss, int indent) const;
bool fetched() const { return child->fetched(); }
bool hasField(const string& field) const { return child->hasField(f
ield); }
bool sortedByDiskLoc() const { return false; }
BSONObj getSort() const { return pattern; }
BSONObj pattern;
scoped_ptr<QuerySolutionNode> child;
// TODO: Filter
};
struct LimitNode : public QuerySolutionNode {
LimitNode() { }
virtual ~LimitNode() { }
virtual StageType getType() const { return STAGE_LIMIT; }
virtual void appendToString(stringstream* ss, int indent) const;
bool fetched() const { return child->fetched(); }
bool hasField(const string& field) const { return child->hasField(f
ield); }
bool sortedByDiskLoc() const { return child->sortedByDiskLoc(); }
BSONObj getSort() const { return child->getSort(); }
int limit;
scoped_ptr<QuerySolutionNode> child;
};
struct SkipNode : public QuerySolutionNode {
SkipNode() { }
virtual ~SkipNode() { }
virtual StageType getType() const { return STAGE_SKIP; }
virtual void appendToString(stringstream* ss, int indent) const;
bool fetched() const { return child->fetched(); }
bool hasField(const string& field) const { return child->hasField(f
ield); }
bool sortedByDiskLoc() const { return child->sortedByDiskLoc(); }
BSONObj getSort() const { return child->getSort(); }
int skip;
scoped_ptr<QuerySolutionNode> child;
};
//
// Geo nodes. A thin wrapper above an IXSCAN until we can yank functio
nality out of
// the IXSCAN layer into the stage layer.
//
struct GeoNear2DNode : public QuerySolutionNode {
GeoNear2DNode() : numWanted(100) { }
virtual ~GeoNear2DNode() { }
virtual StageType getType() const { return STAGE_GEO_NEAR_2D; }
virtual void appendToString(stringstream* ss, int indent) const;
bool fetched() const { return false; }
bool hasField(const string& field) const;
bool sortedByDiskLoc() const { return false; }
BSONObj getSort() const { return BSONObj(); }
int numWanted;
BSONObj indexKeyPattern;
BSONObj seek;
};
// TODO: This is probably an expression index.
struct Geo2DNode : public QuerySolutionNode {
Geo2DNode() { }
virtual ~Geo2DNode() { }
virtual StageType getType() const { return STAGE_GEO_2D; }
virtual void appendToString(stringstream* ss, int indent) const;
bool fetched() const { return false; }
bool hasField(const string& field) const;
bool sortedByDiskLoc() const { return false; }
BSONObj getSort() const { return BSONObj(); }
BSONObj indexKeyPattern;
BSONObj seek;
};
// This is actually its own standalone stage.
struct GeoNear2DSphereNode : public QuerySolutionNode {
GeoNear2DSphereNode() { }
virtual ~GeoNear2DSphereNode() { }
virtual StageType getType() const { return STAGE_GEO_NEAR_2DSPHERE;
}
virtual void appendToString(stringstream* ss, int indent) const;
bool fetched() const { return true; }
bool hasField(const string& field) const { return true; }
bool sortedByDiskLoc() const { return false; }
BSONObj getSort() const { return BSONObj(); }
NearQuery nq;
IndexBounds baseBounds;
BSONObj indexKeyPattern;
scoped_ptr<MatchExpression> filter;
};
} // namespace mongo } // namespace mongo
 End of changes. 21 change blocks. 
31 lines changed or deleted 439 lines changed or added


 queryoptimizercursor.h   queryoptimizercursor.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "cursor.h" #include "cursor.h"
namespace mongo { namespace mongo {
class CandidatePlanCharacter; class CandidatePlanCharacter;
class ExplainQueryInfo; class ExplainQueryInfo;
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 queryoptimizercursorimpl.h   queryoptimizercursorimpl.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/parsed_query.h" #include "mongo/db/parsed_query.h"
#include "mongo/db/queryoptimizercursor.h" #include "mongo/db/queryoptimizercursor.h"
#include "mongo/db/querypattern.h" #include "mongo/db/querypattern.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 race.h   race.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/util/concurrency/mutexdebugger.h" #include "mongo/util/concurrency/mutexdebugger.h"
#include "mongo/util/goodies.h" // printStackTrace #include "mongo/util/goodies.h" // printStackTrace
#include "mongo/util/stacktrace.h" #include "mongo/util/stacktrace.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 range_arithmetic.h   range_arithmetic.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include <map> #include <map>
#include <vector> #include <vector>
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 range_deleter.h   range_deleter.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
#include <deque> #include <deque>
#include <set> #include <set>
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 range_deleter_db_env.h   range_deleter_db_env.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/range_deleter.h" #include "mongo/db/range_deleter.h"
namespace mongo { namespace mongo {
/** /**
* This class implements the deleter methods to be used for a shard. * This class implements the deleter methods to be used for a shard.
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 range_deleter_mock_env.h   range_deleter_mock_env.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <map> #include <map>
#include <set> #include <set>
#include <string> #include <string>
#include "mongo/s/range_arithmetic.h" #include "mongo/s/range_arithmetic.h"
#include "mongo/db/range_deleter.h" #include "mongo/db/range_deleter.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 range_deleter_service.h   range_deleter_service.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/range_deleter.h" #include "mongo/db/range_deleter.h"
#include "mongo/db/range_deleter_stats.h" #include "mongo/db/range_deleter_stats.h"
namespace mongo { namespace mongo {
/** /**
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 range_deleter_stats.h   range_deleter_stats.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/bson/bson_field.h" #include "mongo/bson/bson_field.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/platform/cstdint.h" #include "mongo/platform/cstdint.h"
#include "mongo/util/concurrency/mutex.h" #include "mongo/util/concurrency/mutex.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 record.h   record.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/bson/bsonobjbuilder.h" #include "mongo/bson/bsonobjbuilder.h"
#include "mongo/platform/atomic_word.h" #include "mongo/platform/atomic_word.h"
namespace mongo { namespace mongo {
struct RecordStats { struct RecordStats {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 rename_collection.h   rename_collection.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/db/auth/privilege.h" #include "mongo/db/auth/privilege.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 repl_reads_ok.h   repl_reads_ok.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
class ParsedQuery; class ParsedQuery;
class LiteParsedQuery;
// Check to see if slaveOk reads are allowed, // Check to see if slaveOk reads are allowed,
// based on read preference and query options // based on read preference and query options
// DEPRECATED impl
void replVerifyReadsOk(const ParsedQuery* pq = 0); void replVerifyReadsOk(const ParsedQuery* pq = 0);
void replVerifyReadsOk(const LiteParsedQuery* pq);
} }
 End of changes. 4 change blocks. 
0 lines changed or deleted 25 lines changed or added


 repl_start.h   repl_start.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
// Entry point for replication at server startup. // Entry point for replication at server startup.
// This function starts replica set or master/slave replication // This function starts replica set or master/slave replication
// based on command line/config parameters. // based on command line/config parameters.
void startReplication(); void startReplication();
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 replication_server_status.h   replication_server_status.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <set> #include <set>
#include <string> #include <string>
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/util/concurrency/mutex.h" #include "mongo/util/concurrency/mutex.h"
skipping to change at line 47 skipping to change at line 59
/** true means we are master and doing replication. if we are not writing to oplog, this won't be true. */ /** true means we are master and doing replication. if we are not writing to oplog, this won't be true. */
bool master; bool master;
bool fastsync; bool fastsync;
bool autoresync; bool autoresync;
int slavedelay; int slavedelay;
long long oplogSize; // --oplogSize
// for master/slave replication
std::string source; // --source
std::string only; // --only
int pretouch; // --pretouch for replication application (e
xperimental)
std::string replSet; // --replSet[/<seedlist>]
std::string ourSetName() const {
std::string setname;
size_t sl = replSet.find('/');
if( sl == std::string::npos )
return replSet;
return replSet.substr(0, sl);
}
bool usingReplSets() const { return !replSet.empty(); }
std::string rsIndexPrefetch;// --indexPrefetch
std::set<std::string> discoveredSeeds; std::set<std::string> discoveredSeeds;
mutex discoveredSeeds_mx; mutex discoveredSeeds_mx;
BSONObj reconfig; BSONObj reconfig;
ReplSettings() ReplSettings()
: slave(NotSlave), : slave(NotSlave),
master(false), master(false),
fastsync(), fastsync(),
autoresync(false), autoresync(false),
slavedelay(), slavedelay(),
oplogSize(0),
pretouch(0),
discoveredSeeds(), discoveredSeeds(),
discoveredSeeds_mx("ReplSettings::discoveredSeeds") { discoveredSeeds_mx("ReplSettings::discoveredSeeds") {
} }
}; };
extern ReplSettings replSettings; extern ReplSettings replSettings;
} }
 End of changes. 3 change blocks. 
0 lines changed or deleted 42 lines changed or added


 request.h   request.h 
skipping to change at line 16 skipping to change at line 16
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/db/dbmessage.h" #include "mongo/db/dbmessage.h"
#include "mongo/s/config.h" #include "mongo/s/config.h"
#include "mongo/util/net/message.h" #include "mongo/util/net/message.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 resource.h   resource.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file. // Microsoft Visual C++ generated include file.
// Used by db.rc // Used by db.rc
// //
#define IDI_ICON2 102 #define IDI_ICON2 102
// Next default values for new objects // Next default values for new objects
// //
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 restapi.h   restapi.h 
skipping to change at line 18 skipping to change at line 18
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/db/auth/user_name.h" #include "mongo/db/auth/user_name.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/util/admin_access.h" #include "mongo/util/admin_access.h"
namespace mongo { namespace mongo {
class RestAdminAccess : public AdminAccess { class RestAdminAccess : public AdminAccess {
public: public:
virtual ~RestAdminAccess() { } virtual ~RestAdminAccess() { }
virtual bool haveAdminUsers() const; virtual bool haveAdminUsers() const;
virtual BSONObj getAdminUser(const UserName& username) const;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 2 change blocks. 
1 lines changed or deleted 20 lines changed or added


 role_graph.h   role_graph.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <algorithm> #include <algorithm>
#include <set> #include <vector>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/auth/privilege.h" #include "mongo/db/auth/privilege.h"
#include "mongo/db/auth/role_name.h" #include "mongo/db/auth/role_name.h"
#include "mongo/db/namespace_string.h"
#include "mongo/platform/unordered_map.h" #include "mongo/platform/unordered_map.h"
#include "mongo/platform/unordered_set.h" #include "mongo/platform/unordered_set.h"
namespace mongo { namespace mongo {
class BSONOBj;
/** /**
* A graph of role and privilege relationships. * A graph of role and privilege relationships.
* *
* This structure is used to store an in-memory representation of the a dmin.system.roledata * This structure is used to store an in-memory representation of the a dmin.system.roledata
* collection, specifically the graph of which roles are members of oth er roles and what * collection, specifically the graph of which roles are members of oth er roles and what
* privileges each role has, both directly and transitively through mem bership in other roles. * privileges each role has, both directly and transitively through mem bership in other roles.
* There are some restrictions on calls to getAllPrivileges(), specific ally, one must call * There are some restrictions on calls to getAllPrivileges(), specific ally, one must call
* recomputePrivilegeData() before calling getAllPrivileges() if any of the mutation methods * recomputePrivilegeData() before calling getAllPrivileges() if any of the mutation methods
* have been called on the instance since the later of its construction or the last call to * have been called on the instance since the later of its construction or the last call to
* recomputePrivilegeData() on the object. * recomputePrivilegeData() on the object.
*/ */
class RoleGraph { class RoleGraph {
public: public:
/**
* Adds to "privileges" the privileges associated with the named bu
ilt-in role, and returns
* true. Returns false if "role" does not name a built-in role, and
does not modify
* "privileges". Addition of new privileges is done as with
* Privilege::addPrivilegeToPrivilegeVector.
*/
static bool addPrivilegesForBuiltinRole(const RoleName& role, Privi
legeVector* privileges);
RoleGraph(); RoleGraph();
RoleGraph(const RoleGraph& other); RoleGraph(const RoleGraph& other);
~RoleGraph(); ~RoleGraph();
// Built-in roles for backwards compatibility with 2.2 and prior
static const std::string BUILTIN_ROLE_V0_READ;
static const std::string BUILTIN_ROLE_V0_READ_WRITE;
static const std::string BUILTIN_ROLE_V0_ADMIN_READ;
static const std::string BUILTIN_ROLE_V0_ADMIN_READ_WRITE;
// Swaps the contents of this RoleGraph with those of "other" // Swaps the contents of this RoleGraph with those of "other"
void swap(RoleGraph& other); void swap(RoleGraph& other);
/** /**
* Returns an iterator that can be used to get a list of the member * Adds to "privileges" the necessary privileges to do absolutely a
s of the given role. nything on the system.
*/
static void generateUniversalPrivileges(PrivilegeVector* privileges
);
/**
* Returns an iterator over the RoleNames of the "members" of the g
iven role.
* Members of a role are roles that have been granted this role dir ectly (roles that are * Members of a role are roles that have been granted this role dir ectly (roles that are
* members transitively through another role are not included). Th ese are the "parents" of * members transitively through another role are not included). Th ese are the "parents" of
* this node in the graph. The iterator is valid until the next cal * this node in the graph.
l to addRole or
* removeRole.
*/ */
RoleNameIterator getDirectMembers(const RoleName& role) const; RoleNameIterator getDirectMembers(const RoleName& role);
/** /**
* Returns an iterator that can be used to get a list of "subordina * Returns an iterator over the RoleNames of the "subordninates" of
te" roles of the given the given role.
* role. Subordinate roles are the roles that this role has been g * Subordinate roles are the roles that this role has been granted
ranted directly (roles directly (roles
* that have been granted transitively through another role are not included). These are * that have been granted transitively through another role are not included). These are
* the "children" of this node in the graph. The iterator is valid * the "children" of this node in the graph.
until the next call to
* addRole or removeRole.
*/ */
RoleNameIterator getDirectSubordinates(const RoleName& role) const; RoleNameIterator getDirectSubordinates(const RoleName& role);
/**
* Returns an iterator that can be used to get a full list of roles
that this role inherits
* privileges from. This includes its direct subordinate roles as
well as the subordinates
* of its subordinates, and so on.
*/
RoleNameIterator getIndirectSubordinates(const RoleName& role);
/** /**
* Returns a vector of the privileges that the given role has been directly granted. * Returns a vector of the privileges that the given role has been directly granted.
* Privileges that have been granted transitively through this role 's subordinate roles are * Privileges that have been granted transitively through this role 's subordinate roles are
* not included. * not included.
*/ */
const PrivilegeVector& getDirectPrivileges(const RoleName& role) co nst; const PrivilegeVector& getDirectPrivileges(const RoleName& role);
/** /**
* Returns a vector of all privileges that the given role contains. This includes both the * Returns a vector of all privileges that the given role contains. This includes both the
* privileges that have been granted to this role directly, as well as any privileges * privileges that have been granted to this role directly, as well as any privileges
* inherited from the role's subordinate roles. * inherited from the role's subordinate roles.
*/ */
const PrivilegeVector& getAllPrivileges(const RoleName& role) const ; const PrivilegeVector& getAllPrivileges(const RoleName& role);
/** /**
* Returns whether or not the given role exists in the role graph. * Returns whether or not the given role exists in the role graph.
Will implicitly
* add the role to the graph if it is a built-in role and isn't alr
eady in the graph.
*/ */
bool roleExists(const RoleName& role) const; bool roleExists(const RoleName& role);
/**
* Returns whether the given role corresponds to a built-in role.
*/
static bool isBuiltinRole(const RoleName& role);
// Mutation functions // Mutation functions
/** /**
* Puts an entry into the RoleGraph for the given RoleName. * Puts an entry into the RoleGraph for the given RoleName.
* Returns DuplicateKey if the role already exists. * Returns DuplicateKey if the role already exists.
*/ */
Status createRole(const RoleName& role); Status createRole(const RoleName& role);
/** /**
* Deletes the given role by first removing it from the members/sub ordinates arrays for * Deletes the given role by first removing it from the members/sub ordinates arrays for
* all other roles, and then by removing its own entries in the 4 m ember maps. * all other roles, and then by removing its own entries in the 4 m ember maps.
* Returns RoleNotFound if the role doesn't exist. * Returns RoleNotFound if the role doesn't exist.
* Returns InvalidRoleModification if "role" is a built-in role.
*/ */
Status deleteRole(const RoleName& role); Status deleteRole(const RoleName& role);
/** /**
* Grants "role" to "recipient". This leaves "recipient" as a membe r of "role" and "role" * Grants "role" to "recipient". This leaves "recipient" as a membe r of "role" and "role"
* as a subordinate of "recipient". * as a subordinate of "recipient".
* Returns RoleNotFound if either of "role" or "recipient" doesn't exist in * Returns RoleNotFound if either of "role" or "recipient" doesn't exist in
* the RoleGraph. * the RoleGraph.
* Returns InvalidRoleModification if "recipient" is a built-in rol e.
*/ */
Status addRoleToRole(const RoleName& recipient, const RoleName& rol e); Status addRoleToRole(const RoleName& recipient, const RoleName& rol e);
/** /**
* Revokes "role" from "recipient". * Revokes "role" from "recipient".
* Returns RoleNotFound if either of "role" or "recipient" doesn't exist in * Returns RoleNotFound if either of "role" or "recipient" doesn't exist in
* the RoleGraph. Returns RolesNotRelated if "recipient" is not cu rrently a * the RoleGraph. Returns RolesNotRelated if "recipient" is not cu rrently a
* member of "role". * member of "role".
* Returns InvalidRoleModification if "role" is a built-in role.
*/ */
Status removeRoleFromRole(const RoleName& recipient, const RoleName & role); Status removeRoleFromRole(const RoleName& recipient, const RoleName & role);
/** /**
* Removes all roles held by "victim".
* Returns RoleNotFound if "victim" doesn't exist in the role graph
.
* Returns InvalidRoleModification if "victim" is a built-in role.
*/
Status removeAllRolesFromRole(const RoleName& victim);
/**
* Grants "privilegeToAdd" to "role". * Grants "privilegeToAdd" to "role".
* Returns RoleNotFound if "role" doesn't exist in the role graph. * Returns RoleNotFound if "role" doesn't exist in the role graph.
* Returns InvalidRoleModification if "role" is a built-in role.
*/ */
Status addPrivilegeToRole(const RoleName& role, const Privilege& pr ivilegeToAdd); Status addPrivilegeToRole(const RoleName& role, const Privilege& pr ivilegeToAdd);
/** /**
* Grants Privileges from "privilegesToAdd" to "role". * Grants Privileges from "privilegesToAdd" to "role".
* Returns RoleNotFound if "role" doesn't exist in the role graph. * Returns RoleNotFound if "role" doesn't exist in the role graph.
* Returns InvalidRoleModification if "role" is a built-in role.
*/ */
Status addPrivilegesToRole(const RoleName& role, const PrivilegeVec tor& privilegesToAdd); Status addPrivilegesToRole(const RoleName& role, const PrivilegeVec tor& privilegesToAdd);
/** /**
* Removes "privilegeToRemove" from "role". * Removes "privilegeToRemove" from "role".
* Returns RoleNotFound if "role" doesn't exist in the role graph. * Returns RoleNotFound if "role" doesn't exist in the role graph.
* Returns PrivilegeNotFound if "role" doesn't contain the full pri vilege being removed. * Returns PrivilegeNotFound if "role" doesn't contain the full pri vilege being removed.
* Returns InvalidRoleModification if "role" is a built-in role.
*/ */
Status removePrivilegeFromRole(const RoleName& role, Status removePrivilegeFromRole(const RoleName& role,
const Privilege& privilegeToRemove); const Privilege& privilegeToRemove);
/** /**
* Removes all privileges in the "privilegesToRemove" vector from " role". * Removes all privileges in the "privilegesToRemove" vector from " role".
* Returns RoleNotFound if "role" doesn't exist in the role graph. * Returns RoleNotFound if "role" doesn't exist in the role graph.
* Returns InvalidRoleModification if "role" is a built-in role.
* Returns PrivilegeNotFound if "role" is missing any of the privil eges being removed. If * Returns PrivilegeNotFound if "role" is missing any of the privil eges being removed. If
* PrivilegeNotFound is returned then the graph may be in an incons istent state and needs to * PrivilegeNotFound is returned then the graph may be in an incons istent state and needs to
* be abandoned. * be abandoned.
*/ */
Status removePrivilegesFromRole(const RoleName& role, Status removePrivilegesFromRole(const RoleName& role,
const PrivilegeVector& privilegesTo Remove); const PrivilegeVector& privilegesTo Remove);
/** /**
* Removes all privileges from "role". * Removes all privileges from "role".
* Returns RoleNotFound if "role" doesn't exist in the role graph. * Returns RoleNotFound if "role" doesn't exist in the role graph.
* Returns InvalidRoleModification if "role" is a built-in role.
*/ */
Status removeAllPrivilegesFromRole(const RoleName& role); Status removeAllPrivilegesFromRole(const RoleName& role);
/** /**
* Updates the RoleGraph by adding the role named "roleName", with
the given role
* memberships and privileges. If the name "roleName" already exis
ts, it is replaced. Any
* subordinate roles mentioned in role.roles are created, if needed
, with empty privilege
* and subordinate role lists.
*
* Should _only_ fail if the role to replace is a builtin role, in
which
* case it will return ErrorCodes::InvalidRoleModification.
*/
Status replaceRole(const RoleName& roleName,
const std::vector<RoleName>& roles,
const PrivilegeVector& privileges);
/**
* Adds the role described in "doc" the role graph.
*/
Status addRoleFromDocument(const BSONObj& doc);
/**
* Applies to the RoleGraph the oplog operation described by the pa
rameters.
*
* Returns Status::OK() on success, ErrorCodes::OplogOperationUnsup
ported if the oplog
* operation is not supported, and other codes (typically BadValue)
if the oplog operation
* is ill-described.
*/
Status handleLogOp(
const char* op,
const NamespaceString& ns,
const BSONObj& o,
const BSONObj* o2);
/**
* Recomputes the indirect (getAllPrivileges) data for this graph. * Recomputes the indirect (getAllPrivileges) data for this graph.
* *
* Must be called between calls to any of the mutation functions an d calls * Must be called between calls to any of the mutation functions an d calls
* to getAllPrivileges(). * to getAllPrivileges().
* *
* Returns Status::OK() on success. If a cycle is detected, return s * Returns Status::OK() on success. If a cycle is detected, return s
* ErrorCodes::GraphContainsCycle, and the status message reveals t he cycle. * ErrorCodes::GraphContainsCycle, and the status message reveals t he cycle.
*/ */
Status recomputePrivilegeData(); Status recomputePrivilegeData();
private: private:
// Helper method for recursively doing a topological DFS to compute the indirect privilege // Helper method for recursively doing a topological DFS to compute the indirect privilege
// data and look for cycles // data and look for cycles
Status _recomputePrivilegeDataHelper(const RoleName& currentRole, Status _recomputePrivilegeDataHelper(const RoleName& currentRole,
std::vector<RoleName>& inProgr essRoles, std::vector<RoleName>& inProgr essRoles,
unordered_set<RoleName>& visit edRoles); unordered_set<RoleName>& visit edRoles);
/**
* If the role name given is not a built-in role, or it is but it's
already in the role
* graph, then this does nothing. If it *is* a built-in role and t
his is the first time
* this function has been called for this role, it will add the rol
e into the role graph.
*/
void _createBuiltinRoleIfNeeded(const RoleName& role);
/**
* Returns whether or not the given role exists strictly within the
role graph.
*/
bool _roleExistsDontCreateBuiltin(const RoleName& role);
/**
* Just creates the role in the role graph, without checking whethe
r or not the role already
* exists.
*/
void _createRoleDontCheckIfRoleExists(const RoleName& role);
/**
* Grants "privilegeToAdd" to "role".
* Doesn't do any checking as to whether the role exists or is a bu
ilt-in role.
*/
void _addPrivilegeToRoleNoChecks(const RoleName& role, const Privil
ege& privilegeToAdd);
// Represents all the outgoing edges to other roles from any given role. // Represents all the outgoing edges to other roles from any given role.
typedef unordered_map<RoleName, unordered_set<RoleName> > EdgeSet; typedef unordered_map<RoleName, std::vector<RoleName> > EdgeSet;
// Maps a role name to a list of privileges associated with that ro le. // Maps a role name to a list of privileges associated with that ro le.
typedef unordered_map<RoleName, PrivilegeVector> RolePrivilegeMap; typedef unordered_map<RoleName, PrivilegeVector> RolePrivilegeMap;
EdgeSet _roleToSubordinates; EdgeSet _roleToSubordinates;
unordered_map<RoleName, unordered_set<RoleName> > _roleToIndirectSu bordinates;
EdgeSet _roleToMembers; EdgeSet _roleToMembers;
RolePrivilegeMap _directPrivilegesForRole; RolePrivilegeMap _directPrivilegesForRole;
RolePrivilegeMap _allPrivilegesForRole; RolePrivilegeMap _allPrivilegesForRole;
}; };
void swap(RoleGraph& lhs, RoleGraph& rhs); void swap(RoleGraph& lhs, RoleGraph& rhs);
} // namespace mongo } // namespace mongo
 End of changes. 29 change blocks. 
20 lines changed or deleted 166 lines changed or added


 role_name.h   role_name.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <iosfwd>
#include <string> #include <string>
#include <vector>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/platform/hash_namespace.h" #include "mongo/platform/hash_namespace.h"
#include "mongo/platform/unordered_set.h"
#include "mongo/util/assert_util.h" #include "mongo/util/assert_util.h"
namespace mongo { namespace mongo {
/** /**
* Representation of a name of a role in a MongoDB system. * Representation of a name of a role in a MongoDB system.
* *
* Consists of a "role name" part and a "datbase name" part. * Consists of a "role name" part and a "datbase name" part.
*/ */
class RoleName { class RoleName {
skipping to change at line 51 skipping to change at line 64
/** /**
* Gets the name of the role excluding the "@dbname" component. * Gets the name of the role excluding the "@dbname" component.
*/ */
StringData getRole() const { return StringData(_fullName).substr(0, _splitPoint); } StringData getRole() const { return StringData(_fullName).substr(0, _splitPoint); }
/** /**
* Gets the database name part of a role name. * Gets the database name part of a role name.
*/ */
StringData getDB() const { return StringData(_fullName).substr(_spl itPoint + 1); } StringData getDB() const { return StringData(_fullName).substr(_spl itPoint + 1); }
bool empty() const { return _fullName.empty(); }
/** /**
* Gets the full name of a role as a string, formatted as "role@db" . * Gets the full name of a role as a string, formatted as "role@db" .
* *
* Allowed for keys in non-persistent data structures, such as std: :map. * Allowed for keys in non-persistent data structures, such as std: :map.
*/ */
const std::string& getFullName() const { return _fullName; } const std::string& getFullName() const { return _fullName; }
/** /**
* Stringifies the object, for logging/debugging. * Stringifies the object, for logging/debugging.
*/ */
skipping to change at line 80 skipping to change at line 95
} }
static inline bool operator!=(const RoleName& lhs, const RoleName& rhs) { static inline bool operator!=(const RoleName& lhs, const RoleName& rhs) {
return lhs.getFullName() != rhs.getFullName(); return lhs.getFullName() != rhs.getFullName();
} }
static inline bool operator<(const RoleName& lhs, const RoleName& rhs) { static inline bool operator<(const RoleName& lhs, const RoleName& rhs) {
return lhs.getFullName() < rhs.getFullName(); return lhs.getFullName() < rhs.getFullName();
} }
std::ostream& operator<<(std::ostream& os, const RoleName& name);
/** /**
* Iterator over an unspecified container of RoleName objects. * Iterator over an unspecified container of RoleName objects.
*/ */
class RoleNameIterator { class RoleNameIterator {
public: public:
class Impl { class Impl {
MONGO_DISALLOW_COPYING(Impl); MONGO_DISALLOW_COPYING(Impl);
public: public:
Impl() {}; Impl() {};
virtual ~Impl() {}; virtual ~Impl() {};
skipping to change at line 134 skipping to change at line 151
MONGO_HASH_NAMESPACE_START MONGO_HASH_NAMESPACE_START
template <> struct hash<mongo::RoleName> { template <> struct hash<mongo::RoleName> {
size_t operator()(const mongo::RoleName& rname) const { size_t operator()(const mongo::RoleName& rname) const {
return hash<std::string>()(rname.getFullName()); return hash<std::string>()(rname.getFullName());
} }
}; };
MONGO_HASH_NAMESPACE_END MONGO_HASH_NAMESPACE_END
namespace mongo { namespace mongo {
// RoleNameIterator for iterating over an unordered_set of RoleNames. template <typename ContainerIterator>
class RoleNameSetIterator : public RoleNameIterator::Impl { class RoleNameContainerIteratorImpl : public RoleNameIterator::Impl {
MONGO_DISALLOW_COPYING(RoleNameSetIterator); MONGO_DISALLOW_COPYING(RoleNameContainerIteratorImpl);
public: public:
RoleNameSetIterator(const unordered_set<RoleName>::const_iterator& RoleNameContainerIteratorImpl(const ContainerIterator& begin,
begin, const ContainerIterator& end) :
const unordered_set<RoleName>::const_iterator& _curr(begin), _end(end) {}
end); virtual ~RoleNameContainerIteratorImpl() {}
virtual bool more() const { return _curr != _end; }
virtual ~RoleNameSetIterator(); virtual const RoleName& next() { return *(_curr++); }
virtual const RoleName& get() const { return *_curr; }
virtual bool more() const; virtual RoleNameIterator::Impl* doClone() const {
return new RoleNameContainerIteratorImpl(_curr, _end);
virtual const RoleName& next(); }
virtual const RoleName& get() const;
private: private:
virtual Impl* doClone() const; ContainerIterator _curr;
ContainerIterator _end;
unordered_set<RoleName>::const_iterator _begin;
unordered_set<RoleName>::const_iterator _end;
}; };
template <typename ContainerIterator>
RoleNameIterator makeRoleNameIterator(const ContainerIterator& begin,
const ContainerIterator& end) {
return RoleNameIterator( new RoleNameContainerIteratorImpl<Containe
rIterator>(begin, end));
}
template <typename Container>
RoleNameIterator makeRoleNameIteratorForContainer(const Container& cont
ainer) {
return makeRoleNameIterator(container.begin(), container.end());
}
} // namespace mongo } // namespace mongo
 End of changes. 10 change blocks. 
21 lines changed or deleted 54 lines changed or added


 rs.h   rs.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/commands.h" #include "mongo/db/commands.h"
#include "mongo/db/index.h" #include "mongo/db/index.h"
#include "mongo/db/repl/oplogreader.h" #include "mongo/db/repl/oplogreader.h"
#include "mongo/bson/optime.h" #include "mongo/bson/optime.h"
#include "mongo/db/repl/rs_config.h" #include "mongo/db/repl/rs_config.h"
#include "mongo/db/repl/rs_exception.h" #include "mongo/db/repl/rs_exception.h"
skipping to change at line 63 skipping to change at line 75
class ReplSetImpl; class ReplSetImpl;
struct Target; struct Target;
extern bool replSet; // true if using repl sets extern bool replSet; // true if using repl sets
extern class ReplSet *theReplSet; // null until initialized extern class ReplSet *theReplSet; // null until initialized
extern Tee *rsLog; extern Tee *rsLog;
class ReplSetCmdline; class ReplSetCmdline;
// Main entry point for replica sets // Main entry point for replica sets
void startReplSets(ReplSetCmdline *replSetCmdline); void startReplSets(ReplSetCmdline *replSetCmdline);
class ReplicationStartSynchronizer {
public:
ReplicationStartSynchronizer() : indexRebuildDone(false) {}
boost::mutex mtx;
bool indexRebuildDone;
boost::condition cond;
};
/* member of a replica set */ /* member of a replica set */
class Member : public List1<Member>::Base { class Member : public List1<Member>::Base {
private: private:
~Member(); // intentionally unimplemented as should never be called -- see List1<>::Base. ~Member(); // intentionally unimplemented as should never be called -- see List1<>::Base.
Member(const Member&); Member(const Member&);
public: public:
Member(HostAndPort h, unsigned ord, const ReplSetConfig::MemberCfg *c, bool self); Member(HostAndPort h, unsigned ord, const ReplSetConfig::MemberCfg *c, bool self);
string fullName() const { return h().toString(); } string fullName() const { return h().toString(); }
const ReplSetConfig::MemberCfg& config() const { return _config; } const ReplSetConfig::MemberCfg& config() const { return _config; }
skipping to change at line 334 skipping to change at line 354
class ReplSetImpl : protected RSBase { class ReplSetImpl : protected RSBase {
public: public:
/** info on our state if the replset isn't yet "up". for example, if we are pre-initiation. */ /** info on our state if the replset isn't yet "up". for example, if we are pre-initiation. */
enum StartupStatus { enum StartupStatus {
PRESTART=0, LOADINGCONFIG=1, BADCONFIG=2, EMPTYCONFIG=3, PRESTART=0, LOADINGCONFIG=1, BADCONFIG=2, EMPTYCONFIG=3,
EMPTYUNREACHABLE=4, STARTED=5, SOON=6 EMPTYUNREACHABLE=4, STARTED=5, SOON=6
}; };
static StartupStatus startupStatus; static StartupStatus startupStatus;
static DiagStr startupStatusMsg; static DiagStr startupStatusMsg;
static string stateAsHtml(MemberState state); static string stateAsHtml(MemberState state);
static ReplicationStartSynchronizer rss;
/* todo thread */ /* todo thread */
void msgUpdateHBInfo(HeartbeatInfo); void msgUpdateHBInfo(HeartbeatInfo);
/** /**
* Updates the lastHeartbeatRecv of Member with the given id. * Updates the lastHeartbeatRecv of Member with the given id.
*/ */
void msgUpdateHBRecv(unsigned id, time_t newTime); void msgUpdateHBRecv(unsigned id, time_t newTime);
StateBox box; StateBox box;
skipping to change at line 676 skipping to change at line 697
ReplSetCommand(const char * s, bool show=false) : Command(s, show) { } ReplSetCommand(const char * s, bool show=false) : Command(s, show) { }
virtual bool slaveOk() const { return true; } virtual bool slaveOk() const { return true; }
virtual bool adminOnly() const { return true; } virtual bool adminOnly() const { return true; }
virtual bool logTheOp() { return false; } virtual bool logTheOp() { return false; }
virtual LockType locktype() const { return NONE; } virtual LockType locktype() const { return NONE; }
virtual void help( stringstream &help ) const { help << "internal"; } virtual void help( stringstream &help ) const { help << "internal"; }
bool check(string& errmsg, BSONObjBuilder& result) { bool check(string& errmsg, BSONObjBuilder& result) {
if( !replSet ) { if( !replSet ) {
errmsg = "not running with --replSet"; errmsg = "not running with --replSet";
if( cmdLine.configsvr ) { if (serverGlobalParams.configsvr) {
result.append("info", "configsvr"); // for shell prompt result.append("info", "configsvr"); // for shell prompt
} }
return false; return false;
} }
if( theReplSet == 0 ) { if( theReplSet == 0 ) {
result.append("startupStatus", ReplSet::startupStatus); result.append("startupStatus", ReplSet::startupStatus);
string s; string s;
errmsg = ReplSet::startupStatusMsg.empty() ? "replset unkno wn error 2" : ReplSet::startupStatusMsg.get(); errmsg = ReplSet::startupStatusMsg.empty() ? "replset unkno wn error 2" : ReplSet::startupStatusMsg.get();
if( ReplSet::startupStatus == 3 ) if( ReplSet::startupStatus == 3 )
 End of changes. 4 change blocks. 
1 lines changed or deleted 30 lines changed or added


 rs_config.h   rs_config.h 
skipping to change at line 19 skipping to change at line 19
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/repl/health.h" #include "mongo/db/repl/health.h"
#include "mongo/util/concurrency/list.h" #include "mongo/util/concurrency/list.h"
#include "mongo/util/concurrency/race.h" #include "mongo/util/concurrency/race.h"
#include "mongo/util/net/hostandport.h" #include "mongo/util/net/hostandport.h"
namespace mongo { namespace mongo {
skipping to change at line 94 skipping to change at line 106
void check() const; /* check validity, assert if not. */ void check() const; /* check validity, assert if not. */
BSONObj asBson() const; BSONObj asBson() const;
bool potentiallyHot() const { return !arbiterOnly && priority > 0; } bool potentiallyHot() const { return !arbiterOnly && priority > 0; }
void updateGroups(const OpTime& last) { void updateGroups(const OpTime& last) {
RACECHECK RACECHECK
scoped_lock lk(ReplSetConfig::groupMx); scoped_lock lk(ReplSetConfig::groupMx);
for (set<TagSubgroup*>::const_iterator it = groups().begin( ); it != groups().end(); it++) { for (set<TagSubgroup*>::const_iterator it = groups().begin( ); it != groups().end(); it++) {
(*it)->updateLast(last); (*it)->updateLast(last);
} }
} }
bool isSameIgnoringTags(const MemberCfg& r) const {
return _id == r._id && votes == r.votes && h == r.h && prio
rity == r.priority &&
arbiterOnly == r.arbiterOnly && slaveDelay == r.slav
eDelay &&
hidden == r.hidden && buildIndexes == r.buildIndexes
;
}
bool operator==(const MemberCfg& r) const { bool operator==(const MemberCfg& r) const {
if (!tags.empty() || !r.tags.empty()) { if (!tags.empty() || !r.tags.empty()) {
if (tags.size() != r.tags.size()) { if (tags.size() != r.tags.size()) {
return false; return false;
} }
// if they are the same size and not equal, at least on e // if they are the same size and not equal, at least on e
// element in A must be different in B // element in A must be different in B
for (map<string,string>::const_iterator lit = tags.begi n(); lit != tags.end(); lit++) { for (map<string,string>::const_iterator lit = tags.begi n(); lit != tags.end(); lit++) {
map<string,string>::const_iterator rit = r.tags.fin d((*lit).first); map<string,string>::const_iterator rit = r.tags.fin d((*lit).first);
if (rit == r.tags.end() || (*lit).second != (*rit). second) { if (rit == r.tags.end() || (*lit).second != (*rit). second) {
return false; return false;
} }
} }
} }
return _id==r._id && votes == r.votes && h == r.h && priori return isSameIgnoringTags(r);
ty == r.priority &&
arbiterOnly == r.arbiterOnly && slaveDelay == r.slav
eDelay && hidden == r.hidden &&
buildIndexes == r.buildIndexes;
} }
bool operator!=(const MemberCfg& r) const { return !(*this == r ); } bool operator!=(const MemberCfg& r) const { return !(*this == r ); }
}; };
vector<MemberCfg> members; vector<MemberCfg> members;
string _id; string _id;
int version; int version;
HealthOptions ho; HealthOptions ho;
string md5; string md5;
BSONObj getLastErrorDefaults; BSONObj getLastErrorDefaults;
 End of changes. 3 change blocks. 
5 lines changed or deleted 29 lines changed or added


 rs_exception.h   rs_exception.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
class VoteException : public std::exception { class VoteException : public std::exception {
public: public:
const char * what() const throw () { return "VoteException"; } const char * what() const throw () { return "VoteException"; }
}; };
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 rs_member.h   rs_member.h 
skipping to change at line 16 skipping to change at line 16
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
/** replica set member */ /** replica set member */
#pragma once #pragma once
#include "mongo/util/concurrency/value.h" #include "mongo/util/concurrency/value.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 rs_sync.h   rs_sync.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <deque> #include <deque>
#include <vector> #include <vector>
#include "mongo/db/client.h" #include "mongo/db/client.h"
#include "mongo/db/dur.h" #include "mongo/db/dur.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 runner.h   runner.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/status.h"
#include "mongo/db/query/canonical_query.h" #include "mongo/db/query/canonical_query.h"
namespace mongo { namespace mongo {
class DiskLoc;
class TypeExplain;
/** /**
* A runner runs a query. * A runner runs a query.
*/ */
class Runner { class Runner {
public: public:
virtual ~Runner() { } virtual ~Runner() { }
enum RunnerState { enum RunnerState {
// We successfully populated the out parameter. // We successfully populated the out parameter.
RUNNER_ADVANCED, RUNNER_ADVANCED,
// We're EOF. We won't return any more results (edge case exce ption: capped+tailable). // We're EOF. We won't return any more results (edge case exce ption: capped+tailable).
RUNNER_EOF, RUNNER_EOF,
// We were killed or had an error. // We were killed or had an error.
RUNNER_DEAD, RUNNER_DEAD,
// getNext was asked for data it cannot provide. This is an in // getNext was asked for data it cannot provide, or the underly
ternal error and should ing PlanStage had an
// not occur. // unrecoverable error.
RUNNER_ERROR, RUNNER_ERROR,
}; };
static string statestr(RunnerState s) {
if (RUNNER_ADVANCED == s) {
return "RUNNER_ADVANCED";
}
else if (RUNNER_EOF == s) {
return "RUNNER_EOF";
}
else if (RUNNER_DEAD == s) {
return "RUNNER_DEAD";
}
else {
verify(RUNNER_ERROR == s);
return "RUNNER_ERROR";
}
}
/** /**
* The yielding policy of the runner. By default, a runner does no t yield itself * The yielding policy of the runner. By default, a runner does no t yield itself
* (YIELD_MANUAL). * (YIELD_MANUAL).
*/ */
enum YieldPolicy { enum YieldPolicy {
// Any call to getNext() may yield. In particular, the runner may be killed during any // Any call to getNext() may yield. In particular, the runner may be killed during any
// call to getNext(). If this occurs, getNext() will return RU NNER_DEAD. // call to getNext(). If this occurs, getNext() will return RU NNER_DEAD.
// //
// If you are enabling autoyield, you must register the Runner with ClientCursor via // If you are enabling autoyield, you must register the Runner with ClientCursor via
// ClientCursor::registerRunner and deregister via ClientCursor ::deregisterRunnerwhen // ClientCursor::registerRunner and deregister via ClientCursor ::deregisterRunnerwhen
skipping to change at line 154 skipping to change at line 186
* Restore saved state, possibly after a yield. Return true if the runner is OK, false if * Restore saved state, possibly after a yield. Return true if the runner is OK, false if
* it was killed. * it was killed.
*/ */
virtual bool restoreState() = 0; virtual bool restoreState() = 0;
/** /**
* Return the NS that the query is running over. * Return the NS that the query is running over.
*/ */
virtual const string& ns() = 0; virtual const string& ns() = 0;
/**
* Returns OK, allocating and filling '*explain' with a description
of the chosen plan.
* Caller takes onwership of '*explain'. Otherwise, returns false w
ith a detailed error
* status.
*/
virtual Status getExplainPlan(TypeExplain** explain) const = 0;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 6 change blocks. 
3 lines changed or deleted 51 lines changed or added


 runner_yield_policy.h   runner_yield_policy.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/clientcursor.h" #include "mongo/db/clientcursor.h"
#include "mongo/util/elapsed_tracker.h" #include "mongo/util/elapsed_tracker.h"
namespace mongo { namespace mongo {
class RunnerYieldPolicy { class RunnerYieldPolicy {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 rwlock.h   rwlock.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mutex.h" #include "mutex.h"
#include "../time_support.h" #include "../time_support.h"
#include "rwlockimpl.h" #include "rwlockimpl.h"
#if defined(_DEBUG) #if defined(_DEBUG)
#include "mutexdebugger.h" #include "mutexdebugger.h"
#endif #endif
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 rwlockimpl.h   rwlockimpl.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mutex.h" #include "mutex.h"
#if defined(RWLOCK_TEST) #if defined(RWLOCK_TEST)
namespace mongo { namespace mongo {
typedef RWLockBase1 RWLockBase; typedef RWLockBase1 RWLockBase;
} }
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 s2_access_method.h   s2_access_method.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/geo/s2common.h" #include "mongo/db/geo/s2common.h"
#include "mongo/db/index/btree_access_method_internal.h" #include "mongo/db/index/btree_access_method_internal.h"
#include "mongo/db/index/index_descriptor.h" #include "mongo/db/index/index_descriptor.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
skipping to change at line 46 skipping to change at line 58
virtual Status newCursor(IndexCursor** out); virtual Status newCursor(IndexCursor** out);
private: private:
friend class Geo2dFindNearCmd; friend class Geo2dFindNearCmd;
const S2IndexingParams& getParams() const { return _params; } const S2IndexingParams& getParams() const { return _params; }
virtual void getKeys(const BSONObj& obj, BSONObjSet* keys); virtual void getKeys(const BSONObj& obj, BSONObjSet* keys);
// getKeys calls the helper methods below. // getKeys calls the helper methods below.
void getGeoKeys(const BSONElementSet& elements, BSONObjSet* out) co void getGeoKeys(const BSONObj& document, const BSONElementSet& elem
nst; ents,
BSONObjSet* out) const;
void getLiteralKeys(const BSONElementSet& elements, BSONObjSet* out ) const; void getLiteralKeys(const BSONElementSet& elements, BSONObjSet* out ) const;
void getLiteralKeysArray(const BSONObj& obj, BSONObjSet* out) const ; void getLiteralKeysArray(const BSONObj& obj, BSONObjSet* out) const ;
void getOneLiteralKey(const BSONElement& elt, BSONObjSet *out) cons t; void getOneLiteralKey(const BSONElement& elt, BSONObjSet *out) cons t;
S2IndexingParams _params; S2IndexingParams _params;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 2 change blocks. 
2 lines changed or deleted 23 lines changed or added


 s2_index_cursor.h   s2_index_cursor.h 
// DEPRECATED
/** /**
* Copyright (C) 2013 10gen Inc. * Copyright (C) 2013 10gen Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <vector> #include <vector>
#include "mongo/db/btreecursor.h" #include "mongo/db/btreecursor.h"
#include "mongo/db/geo/geoquery.h" #include "mongo/db/geo/geoquery.h"
#include "mongo/db/geo/s2common.h" #include "mongo/db/geo/s2common.h"
#include "mongo/db/index/index_cursor.h" #include "mongo/db/index/index_cursor.h"
 End of changes. 2 change blocks. 
0 lines changed or deleted 21 lines changed or added


 s2_near_cursor.h   s2_near_cursor.h 
// DEPRECATED
/** /**
* Copyright (C) 2013 10gen Inc. * Copyright (C) 2013 10gen Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <queue> #include <queue>
#include "mongo/db/btreecursor.h" #include "mongo/db/btreecursor.h"
#include "mongo/db/geo/geoquery.h" #include "mongo/db/geo/geoquery.h"
#include "mongo/db/geo/s2common.h" #include "mongo/db/geo/s2common.h"
#include "mongo/db/index/index_cursor.h" #include "mongo/db/index/index_cursor.h"
 End of changes. 2 change blocks. 
0 lines changed or deleted 21 lines changed or added


 s2_simple_cursor.h   s2_simple_cursor.h 
// DEPRECATED
/** /**
* Copyright (C) 2013 10gen Inc. * Copyright (C) 2013 10gen Inc.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <vector> #include <vector>
#include "mongo/db/btreecursor.h" #include "mongo/db/btreecursor.h"
#include "mongo/db/geo/geoquery.h" #include "mongo/db/geo/geoquery.h"
#include "mongo/db/geo/s2common.h" #include "mongo/db/geo/s2common.h"
#include "mongo/db/index/index_cursor.h" #include "mongo/db/index/index_cursor.h"
 End of changes. 2 change blocks. 
0 lines changed or deleted 21 lines changed or added


 s2common.h   s2common.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#include "mongo/db/diskloc.h"
#include "mongo/db/geo/geoparser.h" #include "mongo/db/geo/geoparser.h"
#include "mongo/db/geo/geoconstants.h"
#include "third_party/s2/s2.h" #include "third_party/s2/s2.h"
#include "third_party/s2/s2regioncoverer.h" #include "third_party/s2/s2regioncoverer.h"
#include "third_party/s2/s2cell.h" #include "third_party/s2/s2cell.h"
#include "third_party/s2/s2polyline.h" #include "third_party/s2/s2polyline.h"
#include "third_party/s2/s2polygon.h" #include "third_party/s2/s2polygon.h"
#include "third_party/s2/s2regioncoverer.h" #include "third_party/s2/s2regioncoverer.h"
#pragma once #pragma once
namespace mongo { namespace mongo {
struct S2IndexingParams { struct S2IndexingParams {
static const double kRadiusOfEarthInMeters;
// Since we take the cartesian product when we generate keys for an insert, // Since we take the cartesian product when we generate keys for an insert,
// we need a cap. // we need a cap.
size_t maxKeysPerInsert; size_t maxKeysPerInsert;
// This is really an advisory parameter that we pass to the cover g enerator. The // This is really an advisory parameter that we pass to the cover g enerator. The
// finest/coarsest index level determine the required # of cells. // finest/coarsest index level determine the required # of cells.
int maxCellsInCovering; int maxCellsInCovering;
// What's the finest grained level that we'll index? When we query for a point // What's the finest grained level that we'll index? When we query for a point
// we start at that -- we index nothing finer than this. // we start at that -- we index nothing finer than this.
int finestIndexedLevel; int finestIndexedLevel;
// And, what's the coarsest? When we search in larger coverings we know we // And, what's the coarsest? When we search in larger coverings we know we
skipping to change at line 74 skipping to change at line 84
class S2SearchUtil { class S2SearchUtil {
public: public:
// Given a coverer, region, and field name, generate a BSONObj that we can pass to a // Given a coverer, region, and field name, generate a BSONObj that we can pass to a
// FieldRangeSet so that we only examine the keys that the provided region may intersect. // FieldRangeSet so that we only examine the keys that the provided region may intersect.
static BSONObj coverAsBSON(const vector<S2CellId> &cover, const str ing& field, static BSONObj coverAsBSON(const vector<S2CellId> &cover, const str ing& field,
const int coarsestIndexedLevel); const int coarsestIndexedLevel);
static void setCoverLimitsBasedOnArea(double area, S2RegionCoverer *coverer, int coarsestIndexedLevel); static void setCoverLimitsBasedOnArea(double area, S2RegionCoverer *coverer, int coarsestIndexedLevel);
static bool getKeysForObject(const BSONObj& obj, const S2IndexingPa rams& params, static bool getKeysForObject(const BSONObj& obj, const S2IndexingPa rams& params,
vector<string>* out); vector<string>* out);
static bool distanceBetween(const S2Point& us, const BSONObj& them, static bool distanceBetween(const S2Point& us, const BSONObj& them,
const S2IndexingParams &params, double double *out);
*out);
}; };
} // namespace mongo } // namespace mongo
 End of changes. 5 change blocks. 
6 lines changed or deleted 23 lines changed or added


 scanandorder.h   scanandorder.h 
skipping to change at line 19 skipping to change at line 19
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/projection.h" #include "mongo/db/projection.h"
#include "mongo/db/queryutil.h" #include "mongo/db/queryutil.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 security_key.h   security_key.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/client/dbclientinterface.h" #include "mongo/client/dbclientinterface.h"
namespace mongo { namespace mongo {
/** /**
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 server_parameters.h   server_parameters.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include <map> #include <map>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 server_parameters_inline.h   server_parameters_inline.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#include "mongo/util/stringutils.h" #include "mongo/util/stringutils.h"
namespace mongo { namespace mongo {
template<typename T> template<typename T>
inline Status ExportedServerParameter<T>::set( const BSONElement& newVa lueElement ) { inline Status ExportedServerParameter<T>::set( const BSONElement& newVa lueElement ) {
T newValue; T newValue;
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 server_status.h   server_status.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/db/commands.h" #include "mongo/db/commands.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/stats/counters.h" #include "mongo/db/stats/counters.h"
#include "mongo/platform/atomic_word.h" #include "mongo/platform/atomic_word.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 service_stats.h   service_stats.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#ifndef DB_STATS_SERVICE_STATS_HEADER #ifndef DB_STATS_SERVICE_STATS_HEADER
#define DB_STATS_SERVICE_STATS_HEADER #define DB_STATS_SERVICE_STATS_HEADER
#include <string> #include <string>
#include "../../util/concurrency/spin_lock.h" #include "../../util/concurrency/spin_lock.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 shapes.h   shapes.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/base/owned_pointer_vector.h" #include "mongo/base/owned_pointer_vector.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "third_party/s2/s2.h" #include "third_party/s2/s2.h"
skipping to change at line 124 skipping to change at line 136
vector<Point> _points; vector<Point> _points;
}; };
// Clearly this isn't right but currently it's sufficient. // Clearly this isn't right but currently it's sufficient.
enum CRS { enum CRS {
FLAT, FLAT,
SPHERE SPHERE
}; };
struct PointWithCRS { struct PointWithCRS {
PointWithCRS() : flatUpgradedToSphere(false) { }
S2Point point; S2Point point;
S2Cell cell; S2Cell cell;
Point oldPoint; Point oldPoint;
CRS crs; CRS crs;
// If crs is FLAT, we might be able to upgrade the point to SPHERE
if it's a valid SPHERE
// point (lng/lat in bounds). In this case, we can use FLAT data w
ith SPHERE predicates.
bool flatUpgradedToSphere;
}; };
struct LineWithCRS { struct LineWithCRS {
S2Polyline line; S2Polyline line;
CRS crs; CRS crs;
}; };
struct CapWithCRS { struct CapWithCRS {
// Only one of {cap, circle} is filled out depending on the CRS.
S2Cap cap; S2Cap cap;
Circle circle; Circle circle;
CRS crs; CRS crs;
}; };
struct BoxWithCRS { struct BoxWithCRS {
Box box; Box box;
CRS crs; CRS crs;
}; };
 End of changes. 4 change blocks. 
0 lines changed or deleted 27 lines changed or added


 shard.h   shard.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/client/connpool.h" #include "mongo/client/connpool.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 shardkey.h   shardkey.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/keypattern.h" #include "mongo/db/keypattern.h"
namespace mongo { namespace mongo {
class Chunk; class Chunk;
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 shell_utils.h   shell_utils.h 
skipping to change at line 67 skipping to change at line 67
public: public:
ConnectionRegistry(); ConnectionRegistry();
void registerConnection( DBClientWithCommands &client ); void registerConnection( DBClientWithCommands &client );
void killOperationsOnAllConnections( bool withPrompt ) const; void killOperationsOnAllConnections( bool withPrompt ) const;
private: private:
map<string,set<string> > _connectionUris; map<string,set<string> > _connectionUris;
mutable mongo::mutex _mutex; mutable mongo::mutex _mutex;
}; };
extern ConnectionRegistry connectionRegistry; extern ConnectionRegistry connectionRegistry;
// Helper to tell if a file exists cross platform
// TODO: Remove this when we have a cross platform file utility lib
rary
bool fileExists(const std::string& file);
} }
} }
 End of changes. 1 change blocks. 
0 lines changed or deleted 5 lines changed or added


 shutdown.h   shutdown.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/db/auth/privilege.h" #include "mongo/db/auth/privilege.h"
#include "mongo/db/commands.h" #include "mongo/db/commands.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 signal_handlers.h   signal_handlers.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
/** /**
* Obtains the log file handler and writes the current thread's stack t race to * Obtains the log file handler and writes the current thread's stack t race to
* it. This call issues an exit(). The function can safely be called fr om within a * it. This call issues an exit(). The function can safely be called fr om within a
* signal handler. * signal handler.
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 simplerwlock.h   simplerwlock.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/bson/util/atomic_int.h" #include "mongo/bson/util/atomic_int.h"
namespace mongo { namespace mongo {
/** separated out as later the implementation of this may be different than RWLock, /** separated out as later the implementation of this may be different than RWLock,
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 single_solution_runner.h   single_solution_runner.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/clientcursor.h" #include <boost/scoped_ptr.hpp>
#include "mongo/db/query/canonical_query.h" #include <string>
#include "mongo/db/query/lite_parsed_query.h"
#include "mongo/db/query/plan_cache.h" #include "mongo/base/status.h"
#include "mongo/db/query/plan_executor.h"
#include "mongo/db/query/runner.h" #include "mongo/db/query/runner.h"
#include "mongo/db/query/stage_builder.h"
namespace mongo { namespace mongo {
class BSONObj;
class CanonicalQuery;
class DiskLoc;
class PlanExecutor;
class PlanStage;
struct QuerySolution;
class TypeExplain;
class WorkingSet;
/** /**
* SingleSolutionRunner runs a plan that was the only possible solution to a query. It exists * SingleSolutionRunner runs a plan that was the only possible solution to a query. It exists
* only to dump stats into the cache after running. * only to dump stats into the cache after running.
*/ */
class SingleSolutionRunner : public Runner { class SingleSolutionRunner : public Runner {
public: public:
/**
* Takes ownership of both arguments. /** Takes ownership of all the arguments. */
*/
SingleSolutionRunner(CanonicalQuery* canonicalQuery, QuerySolution* soln, SingleSolutionRunner(CanonicalQuery* canonicalQuery, QuerySolution* soln,
PlanStage* root, WorkingSet* ws) PlanStage* root, WorkingSet* ws);
: _canonicalQuery(canonicalQuery), _solution(soln),
_exec(new PlanExecutor(ws, root)) { } virtual ~SingleSolutionRunner();
Runner::RunnerState getNext(BSONObj* objOut, DiskLoc* dlOut);
Runner::RunnerState getNext(BSONObj* objOut, DiskLoc* dlOut) { virtual bool isEOF();
return _exec->getNext(objOut, dlOut);
// TODO: I'm not convinced we want to cache this run. What if
it's a collscan solution
// and the user adds an index later? We don't want to reach fo
r this. But if solving
// the query is v. hard, we do want to cache it. Maybe we can
remove single solution
// cache entries when we build an index?
}
virtual bool isEOF() { return _exec->isEOF(); } virtual void saveState();
virtual void saveState() { _exec->saveState(); } virtual bool restoreState();
virtual bool restoreState() { return _exec->restoreState(); } virtual void setYieldPolicy(Runner::YieldPolicy policy);
virtual void setYieldPolicy(Runner::YieldPolicy policy) { virtual void invalidate(const DiskLoc& dl);
_exec->setYieldPolicy(policy);
}
virtual void invalidate(const DiskLoc& dl) { _exec->invalidate(dl); } virtual const std::string& ns();
virtual const string& ns() { return _canonicalQuery->getParsed().ns (); } virtual void kill();
virtual void kill() { _exec->kill(); } /**
* Returns OK, allocating and filling in '*explain' with the detail
s of the plan used
* by this runner. Caller takes ownership of '*explain'. Otherwise,
return a status
* describing the error.
*/
virtual Status getExplainPlan(TypeExplain** explain) const;
private: private:
scoped_ptr<CanonicalQuery> _canonicalQuery; boost::scoped_ptr<CanonicalQuery> _canonicalQuery;
scoped_ptr<QuerySolution> _solution; boost::scoped_ptr<QuerySolution> _solution;
scoped_ptr<PlanExecutor> _exec; boost::scoped_ptr<PlanExecutor> _exec;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 15 change blocks. 
34 lines changed or deleted 58 lines changed or added


 skip.h   skip.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/exec/plan_stage.h" #include "mongo/db/exec/plan_stage.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 snapshots.h   snapshots.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "../jsobj.h" #include "../jsobj.h"
#include "top.h" #include "top.h"
#include "../../util/background.h" #include "../../util/background.h"
/** /**
handles snapshotting performance metrics and other such things handles snapshotting performance metrics and other such things
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 sock.h   sock.h 
skipping to change at line 36 skipping to change at line 36
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/un.h> #include <sys/un.h>
#include <errno.h> #include <errno.h>
#ifdef __openbsd__ #ifdef __openbsd__
# include <sys/uio.h> # include <sys/uio.h>
#endif #endif
#endif // not _WIN32 #endif // not _WIN32
#ifdef MONGO_SSL #include <boost/scoped_ptr.hpp>
#include <openssl/ssl.h>
#endif
#include <string> #include <string>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/logger/log_severity.h" #include "mongo/logger/log_severity.h"
#include "mongo/platform/compiler.h" #include "mongo/platform/compiler.h"
#include "mongo/platform/cstdint.h" #include "mongo/platform/cstdint.h"
#include "mongo/util/assert_util.h" #include "mongo/util/assert_util.h"
namespace mongo { namespace mongo {
#ifdef MONGO_SSL
class SSLManagerInterface; class SSLManagerInterface;
class SSLConnection;
#endif
extern const int portSendFlags;
extern const int portRecvFlags;
const int SOCK_FAMILY_UNKNOWN_ERROR=13078; const int SOCK_FAMILY_UNKNOWN_ERROR=13078;
void disableNagle(int sock); void disableNagle(int sock);
#if defined(_WIN32) #if defined(_WIN32)
typedef short sa_family_t; typedef short sa_family_t;
typedef int socklen_t; typedef int socklen_t;
skipping to change at line 203 skipping to change at line 206
no data sent, then we detect that the other side is down. no data sent, then we detect that the other side is down.
Generally you don't want a timeout, you should be very prepared for errors if you set one. Generally you don't want a timeout, you should be very prepared for errors if you set one.
*/ */
Socket(double so_timeout = 0, logger::LogSeverity logLevel = logger ::LogSeverity::Log() ); Socket(double so_timeout = 0, logger::LogSeverity logLevel = logger ::LogSeverity::Log() );
~Socket(); ~Socket();
bool connect(SockAddr& farEnd); bool connect(SockAddr& farEnd);
void close(); void close();
void send( const char * data , int len, const char *context ); void send( const char * data , int len, const char *context );
void send( const std::vector< std::pair< char *, int > > &data, con st char *context ); void send( const std::vector< std::pair< char *, int > > &data, con st char *context );
// recv len or throw SocketException // recv len or throw SocketException
void recv( char * data , int len ); void recv( char * data , int len );
int unsafe_recv( char *buf, int max ); int unsafe_recv( char *buf, int max );
logger::LogSeverity getLogLevel() const { return _logLevel; } logger::LogSeverity getLogLevel() const { return _logLevel; }
void setLogLevel( logger::LogSeverity ll ) { _logLevel = ll; } void setLogLevel( logger::LogSeverity ll ) { _logLevel = ll; }
SockAddr remoteAddr() const { return _remote; } SockAddr remoteAddr() const { return _remote; }
std::string remoteString() const { return _remote.toString(); } std::string remoteString() const { return _remote.toString(); }
unsigned remotePort() const { return _remote.getPort(); } unsigned remotePort() const { return _remote.getPort(); }
SockAddr localAddr() const { return _local; } SockAddr localAddr() const { return _local; }
void clearCounters() { _bytesIn = 0; _bytesOut = 0; } void clearCounters() { _bytesIn = 0; _bytesOut = 0; }
long long getBytesIn() const { return _bytesIn; } long long getBytesIn() const { return _bytesIn; }
long long getBytesOut() const { return _bytesOut; } long long getBytesOut() const { return _bytesOut; }
int rawFD() const { return _fd; }
void setTimeout( double secs ); void setTimeout( double secs );
bool isStillConnected(); bool isStillConnected();
void setHandshakeReceived() {
_awaitingHandshake = false;
}
bool isAwaitingHandshake() {
return _awaitingHandshake;
}
#ifdef MONGO_SSL #ifdef MONGO_SSL
/** secures inline */ /** secures inline */
void secure( SSLManagerInterface* ssl ); bool secure( SSLManagerInterface* ssl );
void secureAccepted( SSLManagerInterface* ssl ); void secureAccepted( SSLManagerInterface* ssl );
#endif #endif
/** /**
* This function calls SSL_accept() if SSL-encrypted sockets * This function calls SSL_accept() if SSL-encrypted sockets
* are desired. SSL_accept() waits until the remote host calls * are desired. SSL_accept() waits until the remote host calls
* SSL_connect(). The return value is the subject name of any * SSL_connect(). The return value is the subject name of any
* client certificate provided during the handshake. * client certificate provided during the handshake.
*
* @firstBytes is the first bytes received on the socket used
* to detect the connection SSL, @len is the number of bytes
*
* This function may throw SocketException. * This function may throw SocketException.
*/ */
std::string doSSLHandshake(); std::string doSSLHandshake(const char* firstBytes = NULL, int len = 0);
/** /**
* @return the time when the socket was opened. * @return the time when the socket was opened.
*/ */
uint64_t getSockCreationMicroSec() const { uint64_t getSockCreationMicroSec() const {
return _fdCreationMicroSec; return _fdCreationMicroSec;
} }
void handleRecvError(int ret, int len);
MONGO_COMPILER_NORETURN void handleSendError(int ret, const char* c
ontext);
private: private:
void _init(); void _init();
/** sends dumbly, just each buffer at a time */ /** sends dumbly, just each buffer at a time */
void _send( const std::vector< std::pair< char *, int > > &data, co nst char *context ); void _send( const std::vector< std::pair< char *, int > > &data, co nst char *context );
/** raw send, same semantics as ::send */ /** raw send, same semantics as ::send with an additional context p
int _send( const char * data , int len ); arameter */
int _send( const char * data , int len , const char * context );
/** raw recv, same semantics as ::recv */ /** raw recv, same semantics as ::recv */
int _recv( char * buf , int max ); int _recv( char * buf , int max );
void _handleRecvError(int ret, int len, int* retries);
MONGO_COMPILER_NORETURN void _handleSendError(int ret, const char*
context);
int _fd; int _fd;
uint64_t _fdCreationMicroSec; uint64_t _fdCreationMicroSec;
SockAddr _local; SockAddr _local;
SockAddr _remote; SockAddr _remote;
double _timeout; double _timeout;
long long _bytesIn; long long _bytesIn;
long long _bytesOut; long long _bytesOut;
time_t _lastValidityCheckAtSecs; time_t _lastValidityCheckAtSecs;
#ifdef MONGO_SSL #ifdef MONGO_SSL
SSL* _ssl; boost::scoped_ptr<SSLConnection> _sslConnection;
SSLManagerInterface* _sslManager; SSLManagerInterface* _sslManager;
#endif #endif
logger::LogSeverity _logLevel; // passed to log() when logging erro rs logger::LogSeverity _logLevel; // passed to log() when logging erro rs
/** true until the first packet has been received or an outgoing co
nnect has been made */
bool _awaitingHandshake;
}; };
} // namespace mongo } // namespace mongo
 End of changes. 14 change blocks. 
14 lines changed or deleted 34 lines changed or added


 sort.h   sort.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <vector> #include <vector>
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/matcher.h" #include "mongo/db/matcher.h"
#include "mongo/db/exec/plan_stage.h" #include "mongo/db/exec/plan_stage.h"
skipping to change at line 79 skipping to change at line 91
// Iterates through _data post-sort returning it. // Iterates through _data post-sort returning it.
vector<WorkingSetID>::iterator _resultIterator; vector<WorkingSetID>::iterator _resultIterator;
// We buffer a lot of data and we want to look it up by DiskLoc qui ckly upon invalidation. // We buffer a lot of data and we want to look it up by DiskLoc qui ckly upon invalidation.
typedef unordered_map<DiskLoc, WorkingSetID, DiskLoc::Hasher> DataM ap; typedef unordered_map<DiskLoc, WorkingSetID, DiskLoc::Hasher> DataM ap;
DataMap _wsidByDiskLoc; DataMap _wsidByDiskLoc;
// Stats // Stats
CommonStats _commonStats; CommonStats _commonStats;
SortStats _specificStats; SortStats _specificStats;
// The usage in bytes of all bufered data that we're sorting.
size_t _memUsage;
}; };
// Parameters that must be provided to a SortStage // Parameters that must be provided to a SortStage
class SortStageParams { class SortStageParams {
public: public:
//SortStageParams() : limit(0) { } //SortStageParams() : limit(0) { }
// How we're sorting. // How we're sorting.
BSONObj pattern; BSONObj pattern;
 End of changes. 2 change blocks. 
0 lines changed or deleted 23 lines changed or added


 sort_phase_one.h   sort_phase_one.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/extsort.h" #include "mongo/db/extsort.h"
namespace mongo { namespace mongo {
/** for bottom up fastbuildindex (where we presort keys) */ /** for bottom up fastbuildindex (where we presort keys) */
struct SortPhaseOne { struct SortPhaseOne {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 sorter.h   sorter.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <boost/smart_ptr.hpp> #include <boost/smart_ptr.hpp>
#include <deque> #include <deque>
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <mongo/base/disallow_copying.h> #include "mongo/base/disallow_copying.h"
#include "mongo/bson/util/builder.h"
/** /**
* This is the public API for the Sorter (both in-memory and external) * This is the public API for the Sorter (both in-memory and external)
* *
* Many of the classes in this file are templated on Key and Value types wh ich * Many of the classes in this file are templated on Key and Value types wh ich
* require the following public members: * require the following public members:
* *
* // A type carrying extra information used by the deserializer. Contents are * // A type carrying extra information used by the deserializer. Contents are
* // up to you, but it should be cheap to copy. Use an empty struct if yo ur * // up to you, but it should be cheap to copy. Use an empty struct if yo ur
* // deserializer doesn't need extra data. * // deserializer doesn't need extra data.
skipping to change at line 86 skipping to change at line 99
class FileDeleter; class FileDeleter;
} }
/** /**
* Runtime options that control the Sorter's behavior * Runtime options that control the Sorter's behavior
*/ */
struct SortOptions { struct SortOptions {
unsigned long long limit; /// number of KV pairs to be returned. 0 for no limit. unsigned long long limit; /// number of KV pairs to be returned. 0 for no limit.
size_t maxMemoryUsageBytes; /// Approximate. size_t maxMemoryUsageBytes; /// Approximate.
bool extSortAllowed; /// If false, uassert if more mem needed than allowed. bool extSortAllowed; /// If false, uassert if more mem needed than allowed.
std::string tempDir; /// Directory to directly place files in.
/// Must be explicitly set if extSortAllowed i
s true.
SortOptions() SortOptions()
: limit(0) : limit(0)
, maxMemoryUsageBytes(64*1024*1024) , maxMemoryUsageBytes(64*1024*1024)
, extSortAllowed(false) , extSortAllowed(false)
{} {}
/// Fluent API to support expressions like SortOptions().Limit(1000 ).ExtSortAllowed(true) /// Fluent API to support expressions like SortOptions().Limit(1000 ).ExtSortAllowed(true)
SortOptions& Limit(unsigned long long newLimit) { SortOptions& Limit(unsigned long long newLimit) {
skipping to change at line 109 skipping to change at line 124
SortOptions& MaxMemoryUsageBytes(size_t newMaxMemoryUsageBytes) { SortOptions& MaxMemoryUsageBytes(size_t newMaxMemoryUsageBytes) {
maxMemoryUsageBytes = newMaxMemoryUsageBytes; maxMemoryUsageBytes = newMaxMemoryUsageBytes;
return *this; return *this;
} }
SortOptions& ExtSortAllowed(bool newExtSortAllowed=true) { SortOptions& ExtSortAllowed(bool newExtSortAllowed=true) {
extSortAllowed = newExtSortAllowed; extSortAllowed = newExtSortAllowed;
return *this; return *this;
} }
SortOptions& TempDir(const std::string& newTempDir) {
tempDir = newTempDir;
return *this;
}
}; };
/// This is the output from the sorting framework /// This is the output from the sorting framework
template <typename Key, typename Value> template <typename Key, typename Value>
class SortIteratorInterface { class SortIteratorInterface {
MONGO_DISALLOW_COPYING(SortIteratorInterface); MONGO_DISALLOW_COPYING(SortIteratorInterface);
public: public:
typedef std::pair<Key, Value> Data; typedef std::pair<Key, Value> Data;
// Unowned objects are only valid until next call to any method // Unowned objects are only valid until next call to any method
skipping to change at line 174 skipping to change at line 194
/// Writes pre-sorted data to a sorted file and hands-back an Iterator over that file. /// Writes pre-sorted data to a sorted file and hands-back an Iterator over that file.
template <typename Key, typename Value> template <typename Key, typename Value>
class SortedFileWriter { class SortedFileWriter {
MONGO_DISALLOW_COPYING(SortedFileWriter); MONGO_DISALLOW_COPYING(SortedFileWriter);
public: public:
typedef SortIteratorInterface<Key, Value> Iterator; typedef SortIteratorInterface<Key, Value> Iterator;
typedef std::pair<typename Key::SorterDeserializeSettings typedef std::pair<typename Key::SorterDeserializeSettings
,typename Value::SorterDeserializeSettings ,typename Value::SorterDeserializeSettings
> Settings; > Settings;
explicit SortedFileWriter(const Settings& settings = Settings()); explicit SortedFileWriter(const SortOptions& opts,
const Settings& settings = Settings());
void addAlreadySorted(const Key&, const Value&); void addAlreadySorted(const Key&, const Value&);
Iterator* done(); /// Can't add more data after calling done() Iterator* done(); /// Can't add more data after calling done()
private: private:
void spill(); void spill();
const Settings _settings; const Settings _settings;
std::string _fileName; std::string _fileName;
boost::shared_ptr<sorter::FileDeleter> _fileDeleter; // Must outliv e _file boost::shared_ptr<sorter::FileDeleter> _fileDeleter; // Must outliv e _file
 End of changes. 5 change blocks. 
2 lines changed or deleted 32 lines changed or added


 spin_lock.h   spin_lock.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#ifdef _WIN32 #ifdef _WIN32
#include "mongo/platform/windows_basic.h" #include "mongo/platform/windows_basic.h"
#endif #endif
#include "mutex.h" #include "mutex.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 ssl_manager.h   ssl_manager.h 
skipping to change at line 22 skipping to change at line 22
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#ifdef MONGO_SSL #ifdef MONGO_SSL
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/util/net/sock.h"
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/ssl.h> #include <openssl/ssl.h>
#endif
namespace mongo {
/*
* @return the SSL version string prefixed with prefix and suffixed wit
h suffix
*/
const std::string getSSLVersion(const std::string &prefix, const std::s
tring &suffix);
}
#ifdef MONGO_SSL
namespace mongo { namespace mongo {
class SSLConnection {
public:
SSL* ssl;
BIO* networkBIO;
BIO* internalBIO;
Socket* socket;
SSLConnection(SSL_CTX* ctx, Socket* sock, const char* initialBytes,
int len);
~SSLConnection();
};
class SSLManagerInterface { class SSLManagerInterface {
public: public:
virtual ~SSLManagerInterface(); virtual ~SSLManagerInterface();
/** /**
* Initiates a TLS connection. * Initiates a TLS connection.
* Throws SocketException on failure. * Throws SocketException on failure.
* @return a pointer to an SSL context; caller must SSL_free it. * @return a pointer to an SSLConnection. Resources are freed in SS LConnection's destructor
*/ */
virtual SSL* connect(int fd) = 0; virtual SSLConnection* connect(Socket* socket) = 0;
/** /**
* Waits for the other side to initiate a TLS connection. * Waits for the other side to initiate a TLS connection.
* Throws SocketException on failure. * Throws SocketException on failure.
* @return a pointer to an SSL context; caller must SSL_free it. * @return a pointer to an SSLConnection. Resources are freed in SS LConnection's destructor
*/ */
virtual SSL* accept(int fd) = 0; virtual SSLConnection* accept(Socket* socket, const char* initialBy tes, int len) = 0;
/** /**
* Fetches a peer certificate and validates it if it exists * Fetches a peer certificate and validates it if it exists
* Throws SocketException on failure * Throws SocketException on failure
* @return a std::string containing the certificate's subject name. * @return a std::string containing the certificate's subject name.
*/ */
virtual std::string validatePeerCertificate(const SSL* ssl) = 0; virtual std::string validatePeerCertificate(const SSLConnection* co nn) = 0;
/** /**
* Cleans up SSL thread local memory; use at thread exit * Cleans up SSL thread local memory; use at thread exit
* to avoid memory leaks * to avoid memory leaks
*/ */
virtual void cleanupThreadLocals() = 0; virtual void cleanupThreadLocals() = 0;
/** /**
* Gets the subject name of our own server certificate * Gets the subject name of our own server certificate
* @return the subject name. * @return the subject name.
skipping to change at line 72 skipping to change at line 96
virtual std::string getServerSubjectName() = 0; virtual std::string getServerSubjectName() = 0;
/** /**
* Gets the subject name of our own client certificate * Gets the subject name of our own client certificate
* used for cluster authentiation * used for cluster authentiation
* @return the subject name. * @return the subject name.
*/ */
virtual std::string getClientSubjectName() = 0; virtual std::string getClientSubjectName() = 0;
/** /**
* ssl.h shims * Fetches the error text for an error code, in a thread-safe manner
.
*/
virtual std::string getSSLErrorMessage(int code) = 0;
/**
* ssl.h wrappers
*/ */
virtual int SSL_read(SSL* ssl, void* buf, int num) = 0; virtual int SSL_read(SSLConnection* conn, void* buf, int num) = 0;
virtual int SSL_write(SSL* ssl, const void* buf, int num) = 0; virtual int SSL_write(SSLConnection* conn, const void* buf, int num ) = 0;
virtual unsigned long ERR_get_error() = 0; virtual unsigned long ERR_get_error() = 0;
virtual char* ERR_error_string(unsigned long e, char* buf) = 0; virtual char* ERR_error_string(unsigned long e, char* buf) = 0;
virtual int SSL_get_error(const SSL* ssl, int ret) = 0; virtual int SSL_get_error(const SSLConnection* conn, int ret) = 0;
virtual int SSL_shutdown(SSL* ssl) = 0; virtual int SSL_shutdown(SSLConnection* conn) = 0;
virtual void SSL_free(SSL* ssl) = 0; virtual void SSL_free(SSLConnection* conn) = 0;
}; };
// Access SSL functions through this instance. // Access SSL functions through this instance.
SSLManagerInterface* getSSLManager(); SSLManagerInterface* getSSLManager();
extern bool isSSLServer; extern bool isSSLServer;
} }
#endif #endif // #ifdef MONGO_SSL
 End of changes. 15 change blocks. 
11 lines changed or deleted 44 lines changed or added


 stage_builder.h   stage_builder.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/exec/plan_stage.h" #include "mongo/db/exec/plan_stage.h"
#include "mongo/db/exec/working_set.h" #include "mongo/db/exec/working_set.h"
#include "mongo/db/query/query_solution.h" #include "mongo/db/query/query_solution.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 stage_types.h   stage_types.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
/** /**
* These map to implementations of the PlanStage interface, all of whic h live in db/exec/ * These map to implementations of the PlanStage interface, all of whic h live in db/exec/
*/ */
enum StageType { enum StageType {
STAGE_AND_HASH, STAGE_AND_HASH,
STAGE_AND_SORTED, STAGE_AND_SORTED,
STAGE_COLLSCAN, STAGE_COLLSCAN,
STAGE_FETCH, STAGE_FETCH,
// TODO: This is probably an expression index, but would take even
more time than
// STAGE_2DSPHERE to straighten out.
STAGE_GEO_2D,
// The two $geoNear impls imply a fetch+sort and as such are not IX
SCANs.
STAGE_GEO_NEAR_2D,
STAGE_GEO_NEAR_2DSPHERE,
STAGE_IXSCAN, STAGE_IXSCAN,
STAGE_LIMIT, STAGE_LIMIT,
STAGE_OR, STAGE_OR,
STAGE_PROJECTION,
STAGE_SKIP, STAGE_SKIP,
STAGE_SORT, STAGE_SORT,
STAGE_SORT_MERGE, STAGE_SORT_MERGE,
STAGE_TEXT,
STAGE_UNKNOWN, STAGE_UNKNOWN,
}; };
} // namespace mongo } // namespace mongo
 End of changes. 4 change blocks. 
0 lines changed or deleted 32 lines changed or added


 stale_exception.h   stale_exception.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/s/chunk_version.h" #include "mongo/s/chunk_version.h"
#include "mongo/util/assert_util.h" #include "mongo/util/assert_util.h"
#include "mongo/util/mongoutils/str.h" #include "mongo/util/mongoutils/str.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 stemmer.h   stemmer.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "third_party/libstemmer_c/include/libstemmer.h" #include "third_party/libstemmer_c/include/libstemmer.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 stop_words.h   stop_words.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <set> #include <set>
#include <string> #include <string>
#include "mongo/platform/unordered_set.h" #include "mongo/platform/unordered_set.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 strategy.h   strategy.h 
skipping to change at line 16 skipping to change at line 16
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "chunk.h" #include "chunk.h"
#include "request.h" #include "request.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 sync.h   sync.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 sync_source_feedback.h   sync_source_feedback.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/repl/oplogreader.h" #include "mongo/db/repl/oplogreader.h"
#include "mongo/util/background.h" #include "mongo/util/background.h"
namespace mongo { namespace mongo {
class Member; class Member;
skipping to change at line 122 skipping to change at line 134
void tailCheck() { void tailCheck() {
_oplogReader->tailCheck(); _oplogReader->tailCheck();
} }
void tailingQueryGTE(const char *ns, OpTime t, const BSONObj* field s=0) { void tailingQueryGTE(const char *ns, OpTime t, const BSONObj* field s=0) {
_oplogReader->tailingQueryGTE(ns, t, fields); _oplogReader->tailingQueryGTE(ns, t, fields);
} }
private: private:
/* Generally replAuthenticate will only be called within system thr /**
eads to fully * Authenticates _connection using the server's cluster-membership
* authenticate connections to other nodes in the cluster that will credentials.
be used as part of *
* internal operations. If a user-initiated action results in needi * Returns true on successful authentication.
ng to call
* replAuthenticate, you can call it with skipAuthCheck set to fals
e. Only do this if you
* are certain that the proper auth checks have already run to ensu
re that the user is
* authorized to do everything that this connection will be used fo
r!
*/ */
bool replAuthenticate(bool skipAuthCheck); bool replAuthenticate();
/* Sends initialization information to our sync target, also determ ines whether or not they /* Sends initialization information to our sync target, also determ ines whether or not they
* support the updater command. * support the updater command.
*/ */
bool replHandshake(); bool replHandshake();
/* Inform the sync target of our current position in the oplog, as well as the positions /* Inform the sync target of our current position in the oplog, as well as the positions
* of all secondaries chained through us. * of all secondaries chained through us.
*/ */
bool updateUpstream(); bool updateUpstream();
 End of changes. 3 change blocks. 
13 lines changed or deleted 26 lines changed or added


 task.h   task.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful,b * This program is distributed in the hope that it will be useful,b
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/util/background.h" #include "mongo/util/background.h"
namespace mongo { namespace mongo {
namespace task { namespace task {
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 taskqueue.h   taskqueue.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
// if you turn this back on be sure to enable TaskQueueTest again // if you turn this back on be sure to enable TaskQueueTest again
#if 0 #if 0
namespace mongo { namespace mongo {
/** defer work items by queueing them for invocation by another thread. presumption is that /** defer work items by queueing them for invocation by another thread. presumption is that
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 threadlocal.h   threadlocal.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#include "mongo/client/undef_macros.h" #include "mongo/client/undef_macros.h"
#include <boost/thread/tss.hpp> #include <boost/thread/tss.hpp>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include "mongo/client/redef_macros.h" #include "mongo/client/redef_macros.h"
namespace mongo { namespace mongo {
using boost::thread_specific_ptr; using boost::thread_specific_ptr;
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 time_support.h   time_support.h 
skipping to change at line 81 skipping to change at line 81
*/ */
std::string dateToISOStringLocal(Date_t date); std::string dateToISOStringLocal(Date_t date);
/** /**
* Formats "date" in fixed width in the local time zone. * Formats "date" in fixed width in the local time zone.
* *
* Sample format: "Wed Oct 31 13:34:47.996" * Sample format: "Wed Oct 31 13:34:47.996"
*/ */
std::string dateToCtimeString(Date_t date); std::string dateToCtimeString(Date_t date);
/**
* Converts millis to time_t, doing correct division for negative milli
s, and uasserting that
* the result falls within the valid range of a time_t.
*/
time_t millisToTimeT(long long millis);
/**
* Returns the millis since the last whole second of the given millis s
ince epoch, and correctly
* handles dates before epoch.
*/
int extractMillisPortion(long long millisSinceEpoch);
boost::gregorian::date currentDate(); boost::gregorian::date currentDate();
// parses time of day in "hh:mm" format assuming 'hh' is 00-23 // parses time of day in "hh:mm" format assuming 'hh' is 00-23
bool toPointInTime( const std::string& str , boost::posix_time::ptime* timeOfDay ); bool toPointInTime( const std::string& str , boost::posix_time::ptime* timeOfDay );
void sleepsecs(int s); void sleepsecs(int s);
void sleepmillis(long long ms); void sleepmillis(long long ms);
void sleepmicros(long long micros); void sleepmicros(long long micros);
class Backoff { class Backoff {
skipping to change at line 102 skipping to change at line 114
Backoff( int maxSleepMillis, int resetAfter ) : Backoff( int maxSleepMillis, int resetAfter ) :
_maxSleepMillis( maxSleepMillis ), _maxSleepMillis( maxSleepMillis ),
_resetAfterMillis( maxSleepMillis + resetAfter ), // Don't rese t < the max sleep _resetAfterMillis( maxSleepMillis + resetAfter ), // Don't rese t < the max sleep
_lastSleepMillis( 0 ), _lastSleepMillis( 0 ),
_lastErrorTimeMillis( 0 ) _lastErrorTimeMillis( 0 )
{} {}
void nextSleepMillis(); void nextSleepMillis();
/**
* testing-only function. used in dbtests/basictests.cpp
*/
int getNextSleepMillis(int lastSleepMillis, unsigned long long curr
TimeMillis,
unsigned long long lastErrorTimeMillis) cons
t;
private: private:
// Parameters // Parameters
int _maxSleepMillis; int _maxSleepMillis;
int _resetAfterMillis; int _resetAfterMillis;
// Last sleep information // Last sleep information
int _lastSleepMillis; int _lastSleepMillis;
unsigned long long _lastErrorTimeMillis; unsigned long long _lastErrorTimeMillis;
}; };
 End of changes. 2 change blocks. 
0 lines changed or deleted 22 lines changed or added


 tokenizer.h   tokenizer.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/platform/unordered_map.h" #include "mongo/platform/unordered_map.h"
#include "mongo/platform/unordered_set.h" #include "mongo/platform/unordered_set.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 tool.h   tool.h 
skipping to change at line 21 skipping to change at line 21
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
// Tool.h // Tool.h
#pragma once #pragma once
#include <boost/program_options.hpp>
#include <string> #include <string>
#if defined(_WIN32) #if defined(_WIN32)
#include <io.h> #include <io.h>
#endif #endif
#include "mongo/db/instance.h" #include "mongo/db/instance.h"
#include "mongo/db/matcher.h" #include "mongo/db/matcher.h"
#include "mongo/tools/tool_logger.h"
#include "mongo/tools/tool_options.h"
#include "mongo/util/options_parser/environment.h"
using std::string; using std::string;
namespace mongo { namespace mongo {
class Tool { class Tool {
public: public:
enum DBAccess { Tool();
NONE = 0 ,
REMOTE_SERVER = 1 << 1 ,
LOCAL_SERVER = 1 << 2 ,
SPECIFY_DBCOL = 1 << 3 ,
ALL = REMOTE_SERVER | LOCAL_SERVER | SPECIFY_DBCOL
};
Tool( string name , DBAccess access=ALL, string defaultDB="test" ,
string defaultCollection="", bool usesstdout=true, bool quiet
=false);
virtual ~Tool(); virtual ~Tool();
static auto_ptr<Tool> (*createInstance)(); static auto_ptr<Tool> (*createInstance)();
int main( int argc , char ** argv, char ** envp ); int main( int argc , char ** argv, char ** envp );
boost::program_options::options_description_easy_init add_options()
{
return _options->add_options();
}
boost::program_options::options_description_easy_init add_hidden_op
tions() {
return _hidden_options->add_options();
}
void addPositionArg( const char * name , int pos ) {
_positonalOptions.add( name , pos );
}
string getParam( string name , string def="" ) {
if ( _params.count( name ) )
return _params[name.c_str()].as<string>();
return def;
}
int getParam( string name , int def ) {
if ( _params.count( name ) )
return _params[name.c_str()].as<int>();
return def;
}
bool hasParam( string name ) {
return _params.count( name );
}
string getNS() { string getNS() {
if ( _coll.size() == 0 ) { if (toolGlobalParams.coll.size() == 0) {
cerr << "no collection specified!" << endl; cerr << "no collection specified!" << endl;
throw -1; throw -1;
} }
return _db + "." + _coll; return toolGlobalParams.db + "." + toolGlobalParams.coll;
} }
string getAuthenticationDatabase(); string getAuthenticationDatabase();
void useStandardOutput( bool mode ) {
_usesstdout = mode;
}
bool isMaster(); bool isMaster();
bool isMongos(); bool isMongos();
virtual void preSetup() {}
virtual int run() = 0; virtual int run() = 0;
virtual void printHelp(ostream &out); virtual void printHelp(ostream &out) = 0;
virtual void printExtraHelp( ostream & out ) {}
virtual void printExtraHelpAfter( ostream & out ) {}
virtual void printVersion(ostream &out);
protected: protected:
mongo::DBClientBase &conn( bool slaveIfPaired = false ); mongo::DBClientBase &conn( bool slaveIfPaired = false );
string _name;
string _db;
string _coll;
string _fileName;
string _username;
string _password;
string _authenticationDatabase;
string _authenticationMechanism;
bool _usesstdout;
bool _quiet;
bool _noconnection;
bool _autoreconnect; bool _autoreconnect;
void addFieldOptions();
void needFields();
vector<string> _fields;
BSONObj _fieldsObj;
string _host;
protected: protected:
mongo::DBClientBase * _conn; mongo::DBClientBase * _conn;
mongo::DBClientBase * _slaveConn; mongo::DBClientBase * _slaveConn;
bool _paired;
boost::program_options::options_description * _options;
boost::program_options::options_description * _hidden_options;
boost::program_options::positional_options_description _positonalOp
tions;
boost::program_options::variables_map _params;
private: private:
void auth(); void auth();
}; };
class BSONTool : public Tool { class BSONTool : public Tool {
bool _objcheck;
auto_ptr<Matcher> _matcher; auto_ptr<Matcher> _matcher;
public: public:
BSONTool( const char * name , DBAccess access=ALL, bool objcheck = true ); BSONTool();
virtual int doRun() = 0; virtual int doRun() = 0;
virtual void gotObject( const BSONObj& obj ) = 0; virtual void gotObject( const BSONObj& obj ) = 0;
virtual int run(); virtual int run();
long long processFile( const boost::filesystem::path& file ); long long processFile( const boost::filesystem::path& file );
}; };
 End of changes. 14 change blocks. 
84 lines changed or deleted 8 lines changed or added


 top.h   top.h 
skipping to change at line 74 skipping to change at line 74
UsageData commands; UsageData commands;
}; };
typedef StringMap<CollectionData> UsageMap; typedef StringMap<CollectionData> UsageMap;
public: public:
void record( const StringData& ns , int op , int lockType , long lo ng micros , bool command ); void record( const StringData& ns , int op , int lockType , long lo ng micros , bool command );
void append( BSONObjBuilder& b ); void append( BSONObjBuilder& b );
void cloneMap(UsageMap& out) const; void cloneMap(UsageMap& out) const;
CollectionData getGlobalData() const { return _global; } CollectionData getGlobalData() const { return _global; }
void collectionDropped( const string& ns ); void collectionDropped( const StringData& ns );
public: // static stuff public: // static stuff
static Top global; static Top global;
private: private:
void _appendToUsageMap( BSONObjBuilder& b , const UsageMap& map ) c onst; void _appendToUsageMap( BSONObjBuilder& b , const UsageMap& map ) c onst;
void _appendStatsEntry( BSONObjBuilder& b , const char * statsName , const UsageData& map ) const; void _appendStatsEntry( BSONObjBuilder& b , const char * statsName , const UsageData& map ) const;
void _record( CollectionData& c , int op , int lockType , long long micros , bool command ); void _record( CollectionData& c , int op , int lockType , long long micros , bool command );
mutable SimpleMutex _lock; mutable SimpleMutex _lock;
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 trace.h   trace.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link th
e
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do no
t
* wish to do so, delete this exception statement from your version. If you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
#include "mongo/util/concurrency/rwlock.h" #include "mongo/util/concurrency/rwlock.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 14 lines changed or added


 ttl.h   ttl.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
void startTTLBackgroundJob(); void startTTLBackgroundJob();
} }
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 type_changelog.h   type_changelog.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 type_chunk.h   type_chunk.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/s/chunk_version.h" #include "mongo/s/chunk_version.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 type_collection.h   type_collection.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 type_config_version.h   type_config_version.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 type_database.h   type_database.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 type_lockpings.h   type_lockpings.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 type_locks.h   type_locks.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 type_mongos.h   type_mongos.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 type_settings.h   type_settings.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 type_shard.h   type_shard.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 type_tags.h   type_tags.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s
* for all of the code used other than as permitted herein. If you modif
y
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If
you
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 19 lines changed or added


 unordered_map.h   unordered_map.h 
skipping to change at line 18 skipping to change at line 18
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
// NOTE(acm): Before gcc-4.7, __cplusplus is always defined to be 1, // We need to drag in a C++ header so we can examine __GXX_EXPERIMENTAL_CXX
// so we can't reliably detect C++11 support by exclusively checking 0X__ or
// the value of __cplusplus. // _LIBCPP_VERSION meaningfully. The <new> header is pretty lightweight, mo
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) stly unavoidable,
// and almost certain to bring in the standard library configuration macros
.
#include <new>
// NOTE(acm): Before gcc-4.7, __cplusplus is always defined to be 1, so we
can't reliably
// detect C++11 support by exclusively checking the value of __cplusplus. A
dditionaly, libc++,
// whether in C++11 or C++03 mode, doesn't use TR1 and drops things into st
d instead.
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || define
d(_LIBCPP_VERSION)
#include <unordered_map> #include <unordered_map>
namespace mongo { namespace mongo {
using std::unordered_map; using std::unordered_map;
} // namespace mongo } // namespace mongo
#elif defined(_MSC_VER) && _MSC_VER >= 1500 #elif defined(_MSC_VER) && _MSC_VER >= 1500
 End of changes. 1 change blocks. 
4 lines changed or deleted 16 lines changed or added


 unordered_set.h   unordered_set.h 
skipping to change at line 18 skipping to change at line 18
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
// NOTE(acm): Before gcc-4.7, __cplusplus is always defined to be 1, // We need to drag in a C++ header so we can examine __GXX_EXPERIMENTAL_CXX
// so we can't reliably detect C++11 support by exclusively checking 0X__ or
// the value of __cplusplus. // _LIBCPP_VERSION meaningfully. The <new> header is pretty lightweight, mo
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) stly unavoidable,
// and almost certain to bring in the standard library configuration macros
.
#include <new>
// NOTE(acm): Before gcc-4.7, __cplusplus is always defined to be 1, so we
can't reliably
// detect C++11 support by exclusively checking the value of __cplusplus. A
dditionaly, libc++,
// whether in C++11 or C++03 mode, doesn't use TR1 and drops things into st
d instead.
#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) || define
d(_LIBCPP_VERSION)
#include <unordered_set> #include <unordered_set>
namespace mongo { namespace mongo {
using std::unordered_set; using std::unordered_set;
} // namespace mongo } // namespace mongo
#elif defined(_MSC_VER) && _MSC_VER >= 1500 #elif defined(_MSC_VER) && _MSC_VER >= 1500
 End of changes. 1 change blocks. 
4 lines changed or deleted 16 lines changed or added


 update.h   update.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/curop.h" #include "mongo/db/curop.h"
#include "mongo/db/ops/update_request.h" #include "mongo/db/ops/update_request.h"
#include "mongo/db/ops/update_result.h" #include "mongo/db/ops/update_result.h"
#include "mongo/db/query_plan_selection_policy.h" #include "mongo/db/query_plan_selection_policy.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 update_driver.h   update_driver.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include <vector> #include <vector>
#include "mongo/base/status.h" #include "mongo/base/status.h"
#include "mongo/base/owned_pointer_vector.h"
#include "mongo/bson/mutable/document.h" #include "mongo/bson/mutable/document.h"
#include "mongo/db/field_ref_set.h"
#include "mongo/db/index_set.h" #include "mongo/db/index_set.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/ops/modifier_interface.h" #include "mongo/db/ops/modifier_interface.h"
namespace mongo { namespace mongo {
class UpdateDriver { class UpdateDriver {
public: public:
struct Options; struct Options;
skipping to change at line 88 skipping to change at line 102
// Accessors // Accessors
// //
size_t numMods() const; size_t numMods() const;
bool isDocReplacement() const; bool isDocReplacement() const;
bool modsAffectIndices() const; bool modsAffectIndices() const;
void refreshIndexKeys(const IndexPathSet& indexedFields); void refreshIndexKeys(const IndexPathSet& indexedFields);
/** Inform the update driver of which fields are shard keys so that
attempts to modify
* those fields can be rejected by the driver. Pass an empty objec
t to indicate that
* no shard keys are in play.
*/
void refreshShardKeyPattern(const BSONObj& shardKeyPattern);
/** After calling 'update' above, this will return true if it appea
rs that the modifier
* updates may have altered any shard keys. If this returns 'true'
,
* 'verifyShardKeysUnaltered' should be called with the original u
nmutated object so
* field comparisons can be made and illegal mutations detected.
*/
bool modsAffectShardKeys() const;
/** If the mods were detected to have potentially affected shard ke
ys during a
* non-upsert udpate, call this method, providing the original una
ltered document so
* that the apparently altered fields can be verified to have not
actually changed. A
* non-OK status indicates that at least one mutation to a shard k
ey was detected, and
* the update should be rejected rather than applied. You may pass
an empty original
* object on an upsert, since there is not an original object agai
nst which to
* compare. In that case, only the existence of shard keys in 'upd
ated' is verified.
*/
Status checkShardKeysUnaltered(const BSONObj& original,
const mutablebson::Document& updated
) const;
bool multi() const; bool multi() const;
void setMulti(bool multi); void setMulti(bool multi);
bool upsert() const; bool upsert() const;
void setUpsert(bool upsert); void setUpsert(bool upsert);
bool logOp() const; bool logOp() const;
void setLogOp(bool logOp); void setLogOp(bool logOp);
ModifierInterface::Options modOptions() const; ModifierInterface::Options modOptions() const;
skipping to change at line 144 skipping to change at line 182
// Should this driver generate an oplog record when it applies the update? // Should this driver generate an oplog record when it applies the update?
bool _logOp; bool _logOp;
// The options to initiate the mods with // The options to initiate the mods with
ModifierInterface::Options _modOptions; ModifierInterface::Options _modOptions;
// Are any of the fields mentioned in the mods participating in any index? Is set anew // Are any of the fields mentioned in the mods participating in any index? Is set anew
// at each call to update. // at each call to update.
bool _affectIndices; bool _affectIndices;
// Holds the fields relevant to any optional shard key state.
struct ShardKeyState {
// The current shard key pattern
BSONObj pattern;
// A vector owning the FieldRefs parsed from the pattern field
names.
OwnedPointerVector<FieldRef> keys;
// A FieldRefSet containing pointers to the FieldRefs in 'keys'
.
FieldRefSet keySet;
// The current set of keys known to be affected by the current
update. This is
// reset on each call to 'update'.
FieldRefSet affectedKeySet;
};
// If shard keys have been set, holds the relevant state.
boost::scoped_ptr<ShardKeyState> _shardKeyState;
// Is this update going to be an upsert? // Is this update going to be an upsert?
ModifierInterface::ExecInfo::UpdateContext _context; ModifierInterface::ExecInfo::UpdateContext _context;
mutablebson::Document _logDoc; mutablebson::Document _logDoc;
}; };
struct UpdateDriver::Options { struct UpdateDriver::Options {
bool multi; bool multi;
bool upsert; bool upsert;
bool logOp; bool logOp;
 End of changes. 5 change blocks. 
0 lines changed or deleted 81 lines changed or added


 update_request.h   update_request.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/curop.h" #include "mongo/db/curop.h"
#include "mongo/db/namespace_string.h" #include "mongo/db/namespace_string.h"
#include "mongo/db/query_plan_selection_policy.h" #include "mongo/db/query_plan_selection_policy.h"
#include "mongo/util/mongoutils/str.h"
namespace mongo { namespace mongo {
namespace str = mongoutils::str;
class UpdateRequest { class UpdateRequest {
public: public:
inline UpdateRequest( inline UpdateRequest(
const NamespaceString& nsString, const NamespaceString& nsString,
const QueryPlanSelectionPolicy& policy = QueryPlanSelectionPoli cy::any() ) const QueryPlanSelectionPolicy& policy = QueryPlanSelectionPoli cy::any() )
: _nsString(nsString) : _nsString(nsString)
, _queryPlanPolicy(policy) , _queryPlanPolicy(policy)
, _god(false) , _god(false)
, _upsert(false) , _upsert(false)
, _multi(false) , _multi(false)
skipping to change at line 115 skipping to change at line 130
} }
inline void setFromReplication(bool value = true) { inline void setFromReplication(bool value = true) {
_fromReplication = value; _fromReplication = value;
} }
bool isFromReplication() const { bool isFromReplication() const {
return _fromReplication; return _fromReplication;
} }
const std::string toString() const {
return str::stream()
<< " query: " << _query
<< " updated: " << _updates
<< " god: " << _god
<< " upsert: " << _upsert
<< " multi: " << _multi
<< " logToOplog: " << _updateOpLog
<< " fromMigration: " << _fromMigration
<< " fromReplications: " << _fromReplication;
}
private: private:
const NamespaceString& _nsString; const NamespaceString& _nsString;
const QueryPlanSelectionPolicy& _queryPlanPolicy; const QueryPlanSelectionPolicy& _queryPlanPolicy;
// Contains the query that selects documents to update. // Contains the query that selects documents to update.
BSONObj _query; BSONObj _query;
// Contains the modifiers to apply to matched objects, or a replace ment document. // Contains the modifiers to apply to matched objects, or a replace ment document.
BSONObj _updates; BSONObj _updates;
 End of changes. 4 change blocks. 
0 lines changed or deleted 34 lines changed or added


 update_result.h   update_result.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/db/curop.h" #include "mongo/db/curop.h"
#include "mongo/db/namespace_string.h" #include "mongo/db/namespace_string.h"
#include "mongo/db/query_plan_selection_policy.h" #include "mongo/db/query_plan_selection_policy.h"
#include "mongo/util/mongoutils/str.h"
namespace mongo { namespace mongo {
namespace str = mongoutils::str;
struct UpdateResult { struct UpdateResult {
UpdateResult( bool existing_, UpdateResult( bool existing_,
bool modifiers_, bool modifiers_,
unsigned long long numMatched_, unsigned long long numMatched_,
const BSONObj& upsertedObject_ ) const BSONObj& upsertedObject_ )
: existing(existing_) : existing(existing_)
, modifiers(modifiers_) , modifiers(modifiers_)
, numMatched(numMatched_) { , numMatched(numMatched_) {
upserted.clear();
BSONElement id = upsertedObject_["_id"]; BSONElement id = upsertedObject_["_id"];
if ( ! existing && numMatched == 1 && id.type() == jstOID ) { if ( ! existing && numMatched == 1 && !id.eoo() ) {
upserted = id.OID(); upserted = id.wrap(kUpsertedFieldName);
} }
} }
// if existing objects were modified // if existing objects were modified
const bool existing; const bool existing;
// was this a $ mod // was this a $ mod
const bool modifiers; const bool modifiers;
// how many objects touched // how many objects touched
const long long numMatched; const long long numMatched;
// if something was upserted, the new _id of the object // if something was upserted, the new _id of the object
OID upserted; BSONObj upserted;
const std::string toString() const {
return str::stream()
<< " upserted: " << upserted
<< " modifiers: " << modifiers
<< " existing: " << existing
<< " numMatched: " << numMatched;
}
}; };
} // namespace mongo } // namespace mongo
 End of changes. 6 change blocks. 
4 lines changed or deleted 34 lines changed or added


 user.h   user.h 
skipping to change at line 18 skipping to change at line 18
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
#include <string>
#include <vector> #include <vector>
#include "mongo/base/disallow_copying.h" #include "mongo/base/disallow_copying.h"
#include "mongo/db/auth/privilege.h" #include "mongo/db/auth/privilege.h"
#include "mongo/db/auth/resource_pattern.h"
#include "mongo/db/auth/role_name.h" #include "mongo/db/auth/role_name.h"
#include "mongo/db/auth/user_name.h" #include "mongo/db/auth/user_name.h"
#include "mongo/platform/atomic_word.h" #include "mongo/platform/atomic_word.h"
#include "mongo/platform/unordered_map.h" #include "mongo/platform/unordered_map.h"
#include "mongo/platform/unordered_set.h"
namespace mongo { namespace mongo {
/** /**
* Represents a MongoDB user. Stores information about the user necess ary for access control * Represents a MongoDB user. Stores information about the user necess ary for access control
* checks and authentications, such as what privileges this user has, a s well as what roles * checks and authentications, such as what privileges this user has, a s well as what roles
* the user belongs to. * the user belongs to.
* *
* Every User object is owned by an AuthorizationManager. The Authoriz ationManager is the only * Every User object is owned by an AuthorizationManager. The Authoriz ationManager is the only
* one that should construct, modify, or delete a User object. All oth er consumers of User must * one that should construct, modify, or delete a User object. All oth er consumers of User must
skipping to change at line 52 skipping to change at line 53
* user from the AuthorizationManager. * user from the AuthorizationManager.
*/ */
class User { class User {
MONGO_DISALLOW_COPYING(User); MONGO_DISALLOW_COPYING(User);
public: public:
struct CredentialData { struct CredentialData {
std::string password; std::string password;
bool isExternal; bool isExternal;
}; };
struct RoleData {
RoleName name;
bool hasRole;
bool canDelegate;
RoleData() : hasRole(false), canDelegate(false) {}
RoleData(const RoleName& _name, bool _hasRole, bool _canDelegat
e) :
name(_name), hasRole(_hasRole), canDelegate(_canDelegate) {
}
};
typedef unordered_map<ResourcePattern, Privilege> ResourcePrivilege
Map;
typedef unordered_map<RoleName, RoleData> RoleDataMap;
explicit User(const UserName& name); explicit User(const UserName& name);
~User(); ~User();
/** /**
* Returns the user name for this user. * Returns the user name for this user.
*/ */
const UserName& getName() const; const UserName& getName() const;
/** /**
* Returns an iterator that can be used to get the list of roles th * Returns a reference to the information about the users' role mem
is user belongs to. bership.
*/
const RoleDataMap& getRoles() const;
/**
* Returns true if this user is a member of the given role.
*/ */
const RoleNameIterator getRoles() const; bool hasRole(const RoleName& roleName) const;
/**
* Returns a reference to the information about the user's privileg
es.
*/
const ResourcePrivilegeMap& getPrivileges() const { return _privile
ges; }
/** /**
* Returns the CredentialData for this user. * Returns the CredentialData for this user.
*/ */
const CredentialData& getCredentials() const; const CredentialData& getCredentials() const;
/** /**
* Gets the set of actions this user is allowed to perform on the g iven resource. * Gets the set of actions this user is allowed to perform on the g iven resource.
*/ */
const ActionSet getActionsForResource(const std::string& resource) const; const ActionSet getActionsForResource(const ResourcePattern& resour ce) const;
/** /**
* Returns true if this copy of information about this user is stil l valid. If this returns * Returns true if this copy of information about this user is stil l valid. If this returns
* false, this object should no longer be used and should be return ed to the * false, this object should no longer be used and should be return ed to the
* AuthorizationManager and a new User object for this user should be requested. * AuthorizationManager and a new User object for this user should be requested.
*/ */
bool isValid() const; bool isValid() const;
/** /**
* This returns the reference count for this User. The Authorizati onManager should be the * This returns the reference count for this User. The Authorizati onManager should be the
skipping to change at line 101 skipping to change at line 124
* Copies the contents of other into this User. * Copies the contents of other into this User.
*/ */
void copyFrom(const User& other); void copyFrom(const User& other);
/** /**
* Sets this user's authentication credentials. * Sets this user's authentication credentials.
*/ */
void setCredentials(const CredentialData& credentials); void setCredentials(const CredentialData& credentials);
/** /**
* Replaces any existing user role membership information with "rol
es".
*/
void setRoleData(const std::vector<RoleData>& roles);
/**
* Replaces any existing user privilege information with "privilege
s".
*/
void setPrivileges(const PrivilegeVector& privileges);
/**
* Adds the given role name to the list of roles of which this user is a member. * Adds the given role name to the list of roles of which this user is a member.
*/ */
void addRole(const RoleName& role); void addRole(const RoleName& role);
/** /**
* Adds the given role names to the list of roles that this user be longs to. * Adds the given role names to the list of roles that this user be longs to.
*/ */
void addRoles(const std::vector<RoleName>& roles); void addRoles(const std::vector<RoleName>& roles);
/** /**
* Adds the given role name to the list of roles that this user is
allowed to delegate.
*/
void addDelegatableRole(const RoleName& role);
/**
* Adds the given role names to the list of roles that this user is
allowed to delegate.
*/
void addDelegatableRoles(const std::vector<RoleName>& roles);
/**
* Adds the given privilege to the list of privileges this user is authorized for. * Adds the given privilege to the list of privileges this user is authorized for.
*/ */
void addPrivilege(const Privilege& privilege); void addPrivilege(const Privilege& privilege);
/** /**
* Adds the given privileges to the list of privileges this user is authorized for. * Adds the given privileges to the list of privileges this user is authorized for.
*/ */
void addPrivileges(const PrivilegeVector& privileges); void addPrivileges(const PrivilegeVector& privileges);
/** /**
skipping to change at line 149 skipping to change at line 192
* allowed to destroy this instance. * allowed to destroy this instance.
* *
* This method should *only* be called by the AuthorizationManager. * This method should *only* be called by the AuthorizationManager.
*/ */
void decrementRefCount(); void decrementRefCount();
private: private:
UserName _name; UserName _name;
typedef unordered_map<std::string, Privilege> ResourcePrivilegeMap;
// Maps resource name to privilege on that resource // Maps resource name to privilege on that resource
ResourcePrivilegeMap _privileges; ResourcePrivilegeMap _privileges;
unordered_set<RoleName> _roles; // Roles the user has privileges from and/or can delegate
RoleDataMap _roles;
CredentialData _credentials; CredentialData _credentials;
// _refCount and _isInvalidated are modified exclusively by the Aut horizationManager // _refCount and _isInvalidated are modified exclusively by the Aut horizationManager
// _isInvalidated can be read by any consumer of User, but _refCoun t can only be // _isInvalidated can be read by any consumer of User, but _refCoun t can only be
// meaningfully read by the AuthorizationManager, as _refCount is g uarded by the AM's _lock // meaningfully read by the AuthorizationManager, as _refCount is g uarded by the AM's _lock
uint32_t _refCount; uint32_t _refCount;
AtomicUInt32 _isValid; // Using as a boolean AtomicUInt32 _isValid; // Using as a boolean
}; };
 End of changes. 11 change blocks. 
8 lines changed or deleted 59 lines changed or added


 user_name.h   user_name.h 
skipping to change at line 18 skipping to change at line 18
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impli ed.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#pragma once #pragma once
#include <iosfwd>
#include <string> #include <string>
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
namespace mongo { namespace mongo {
/** /**
* Representation of a name of a principal (authenticatable user) in a MongoDB system. * Representation of a name of a principal (authenticatable user) in a MongoDB system.
* *
* Consists of a "user name" part, and a "database name" part. * Consists of a "user name" part, and a "database name" part.
skipping to change at line 71 skipping to change at line 72
} }
static inline bool operator!=(const UserName& lhs, const UserName& rhs) { static inline bool operator!=(const UserName& lhs, const UserName& rhs) {
return lhs.getFullName() != rhs.getFullName(); return lhs.getFullName() != rhs.getFullName();
} }
static inline bool operator<(const UserName& lhs, const UserName& rhs) { static inline bool operator<(const UserName& lhs, const UserName& rhs) {
return lhs.getFullName() < rhs.getFullName(); return lhs.getFullName() < rhs.getFullName();
} }
std::ostream& operator<<(std::ostream& os, const UserName& name);
} // namespace mongo } // namespace mongo
 End of changes. 2 change blocks. 
0 lines changed or deleted 3 lines changed or added


 v8_db.h   v8_db.h 
skipping to change at line 112 skipping to change at line 112
// MD5 constructor // MD5 constructor
v8::Handle<v8::Value> md5Init(V8Scope* scope, const v8::Arguments& args ); v8::Handle<v8::Value> md5Init(V8Scope* scope, const v8::Arguments& args );
// HexData constructor // HexData constructor
v8::Handle<v8::Value> hexDataInit(V8Scope* scope, const v8::Arguments& args); v8::Handle<v8::Value> hexDataInit(V8Scope* scope, const v8::Arguments& args);
// Object.bsonsize() // Object.bsonsize()
v8::Handle<v8::Value> bsonsize(V8Scope* scope, const v8::Arguments& arg s); v8::Handle<v8::Value> bsonsize(V8Scope* scope, const v8::Arguments& arg s);
// global method
// Accepts 2 objects, converts them to BSONObj and calls woCompare on t
he first against the
// second.
v8::Handle<v8::Value> bsonWoCompare(V8Scope* scope, const v8::Arguments
& args);
// 'db.collection' property handlers // 'db.collection' property handlers
v8::Handle<v8::Value> collectionGetter(v8::Local<v8::String> name, v8::Handle<v8::Value> collectionGetter(v8::Local<v8::String> name,
const v8::AccessorInfo& info); const v8::AccessorInfo& info);
v8::Handle<v8::Value> collectionSetter(v8::Local<v8::String> name, v8:: Local<v8::Value> value, v8::Handle<v8::Value> collectionSetter(v8::Local<v8::String> name, v8:: Local<v8::Value> value,
const v8::AccessorInfo& info); const v8::AccessorInfo& info);
typedef boost::function<void (V8Scope*, const v8::Handle<v8::FunctionTe mplate>&)> typedef boost::function<void (V8Scope*, const v8::Handle<v8::FunctionTe mplate>&)>
V8FunctionPrototypeManipulatorFn; V8FunctionPrototypeManipulatorFn;
void v8RegisterMongoPrototypeManipulator(const V8FunctionPrototypeManip ulatorFn& manipulator); void v8RegisterMongoPrototypeManipulator(const V8FunctionPrototypeManip ulatorFn& manipulator);
 End of changes. 1 change blocks. 
0 lines changed or deleted 7 lines changed or added


 value.h   value.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link th
e
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the GNU Affero General Public License in all respects f
or
* all of the code used other than as permitted herein. If you modify file(
s)
* with this exception, you may extend this exception to your version of th
e
* file(s), but you are not obligated to do so. If you do not wish to do so
,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also dele
te
* it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/pipeline/value_internal.h" #include "mongo/db/pipeline/value_internal.h"
#include "mongo/platform/unordered_set.h" #include "mongo/platform/unordered_set.h"
namespace mongo { namespace mongo {
class BSONElement; class BSONElement;
skipping to change at line 67 skipping to change at line 79
explicit Value(bool value) : _storage(Bool, value) { } explicit Value(bool value) : _storage(Bool, value) { }
explicit Value(int value) : _storage(NumberInt, val ue) {} explicit Value(int value) : _storage(NumberInt, val ue) {}
explicit Value(long long value) : _storage(NumberLong, va lue) {} explicit Value(long long value) : _storage(NumberLong, va lue) {}
explicit Value(double value) : _storage(NumberDouble, value) {} explicit Value(double value) : _storage(NumberDouble, value) {}
explicit Value(const OpTime& value) : _storage(Timestamp, val ue.asDate()) {} explicit Value(const OpTime& value) : _storage(Timestamp, val ue.asDate()) {}
explicit Value(const OID& value) : _storage(jstOID, value) {} explicit Value(const OID& value) : _storage(jstOID, value) {}
explicit Value(const StringData& value) : _storage(String, value) {} explicit Value(const StringData& value) : _storage(String, value) {}
explicit Value(const string& value) : _storage(String, String Data(value)) {} explicit Value(const string& value) : _storage(String, String Data(value)) {}
explicit Value(const char* value) : _storage(String, String Data(value)) {} explicit Value(const char* value) : _storage(String, String Data(value)) {}
explicit Value(const Document& doc) : _storage(Object, doc) { } explicit Value(const Document& doc) : _storage(Object, doc) { }
explicit Value(const BSONObj& obj);// : _storage(Object, Docume explicit Value(const BSONObj& obj);
nt(obj)) {} // in cpp explicit Value(const BSONArray& arr);
explicit Value(const vector<Value>& vec) : _storage(Array, new RCV ector(vec)) {} explicit Value(const vector<Value>& vec) : _storage(Array, new RCV ector(vec)) {}
explicit Value(const BSONBinData& bd) : _storage(BinData, bd) { } explicit Value(const BSONBinData& bd) : _storage(BinData, bd) { }
explicit Value(const BSONRegEx& re) : _storage(RegEx, re) {} explicit Value(const BSONRegEx& re) : _storage(RegEx, re) {}
explicit Value(const BSONCodeWScope& cws) : _storage(CodeWScope, cw s) {} explicit Value(const BSONCodeWScope& cws) : _storage(CodeWScope, cw s) {}
explicit Value(const BSONDBRef& dbref) : _storage(DBRef, dbref) {} explicit Value(const BSONDBRef& dbref) : _storage(DBRef, dbref) {}
explicit Value(const BSONSymbol& sym) : _storage(Symbol, sym.sy mbol) {} explicit Value(const BSONSymbol& sym) : _storage(Symbol, sym.sy mbol) {}
explicit Value(const BSONCode& code) : _storage(Code, code.cod e) {} explicit Value(const BSONCode& code) : _storage(Code, code.cod e) {}
explicit Value(const NullLabeler&) : _storage(jstNULL) {} // BSONNull explicit Value(const NullLabeler&) : _storage(jstNULL) {} // BSONNull
explicit Value(const UndefinedLabeler&) : _storage(Undefined) {} // BSONUndefined explicit Value(const UndefinedLabeler&) : _storage(Undefined) {} // BSONUndefined
explicit Value(const MinKeyLabeler&) : _storage(MinKey) {} // MINKEY explicit Value(const MinKeyLabeler&) : _storage(MinKey) {} // MINKEY
 End of changes. 2 change blocks. 
2 lines changed or deleted 20 lines changed or added


 value_internal.h   value_internal.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link th
e
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the GNU Affero General Public License in all respects f
or
* all of the code used other than as permitted herein. If you modify file(
s)
* with this exception, you may extend this exception to your version of th
e
* file(s), but you are not obligated to do so. If you do not wish to do so
,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also dele
te
* it in the license file.
*/ */
#pragma once #pragma once
#include <algorithm> #include <algorithm>
#include "bson/bsonobj.h" #include "bson/bsonobj.h"
#include "bson/bsontypes.h" #include "bson/bsontypes.h"
#include "bson/bsonmisc.h" #include "bson/bsonmisc.h"
#include "bson/oid.h" #include "bson/oid.h"
#include "util/intrusive_counter.h" #include "util/intrusive_counter.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 18 lines changed or added


 version.h   version.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#ifndef UTIL_VERSION_HEADER #ifndef UTIL_VERSION_HEADER
#define UTIL_VERSION_HEADER #define UTIL_VERSION_HEADER
#include <string> #include <string>
#include "mongo/base/string_data.h" #include "mongo/base/string_data.h"
#include "mongo/bson/bsonobjbuilder.h" #include "mongo/bson/bsonobjbuilder.h"
skipping to change at line 54 skipping to change at line 66
const char * loaderFlags(); const char * loaderFlags();
const char * compilerFlags(); const char * compilerFlags();
void printGitVersion(); void printGitVersion();
const std::string openSSLVersion(const std::string &prefix = "", const std::string &suffix = ""); const std::string openSSLVersion(const std::string &prefix = "", const std::string &suffix = "");
void printOpenSSLVersion(); void printOpenSSLVersion();
std::string sysInfo(); std::string sysInfo();
void printSysInfo(); void printSysInfo();
void printTargetMinOS();
void printAllocator(); void printAllocator();
void show_warnings(); void show_warnings();
} // namespace mongo } // namespace mongo
#endif // UTIL_VERSION_HEADER #endif // UTIL_VERSION_HEADER
 End of changes. 2 change blocks. 
0 lines changed or deleted 18 lines changed or added


 version_manager.h   version_manager.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
namespace mongo { namespace mongo {
class ShardConnection; class ShardConnection;
class DBClientBase; class DBClientBase;
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added


 win32-math.h   win32-math.h 
skipping to change at line 40 skipping to change at line 40
// semantics for these functions. // semantics for these functions.
// (http://www.opengroup.org/onlinepubs/000095399/) // (http://www.opengroup.org/onlinepubs/000095399/)
#ifndef V8_WIN32_MATH_H_ #ifndef V8_WIN32_MATH_H_
#define V8_WIN32_MATH_H_ #define V8_WIN32_MATH_H_
#ifndef _MSC_VER #ifndef _MSC_VER
#error Wrong environment, expected MSVC. #error Wrong environment, expected MSVC.
#endif // _MSC_VER #endif // _MSC_VER
#if _MSC_VER < 1800
enum { enum {
FP_NAN, FP_NAN,
FP_INFINITE, FP_INFINITE,
FP_ZERO, FP_ZERO,
FP_SUBNORMAL, FP_SUBNORMAL,
FP_NORMAL FP_NORMAL
}; };
#endif // _MSC_VER < 1800
namespace v8 { namespace v8 {
int isfinite(double x); int isfinite(double x);
} // namespace v8 } // namespace v8
int isnan(double x); int isnan(double x);
int isinf(double x); int isinf(double x);
int isless(double x, double y); int isless(double x, double y);
int isgreater(double x, double y); int isgreater(double x, double y);
#if _MSC_VER < 1800
int fpclassify(double x); int fpclassify(double x);
int signbit(double x); int signbit(double x);
#endif // _MSC_VER < 1800
#endif // V8_WIN32_MATH_H_ #endif // V8_WIN32_MATH_H_
 End of changes. 4 change blocks. 
0 lines changed or deleted 4 lines changed or added


 winutil.h   winutil.h 
skipping to change at line 17 skipping to change at line 17
// * it under the terms of the GNU Affero General Public License, versio n 3, // * it under the terms of the GNU Affero General Public License, versio n 3,
// * as published by the Free Software Foundation. // * as published by the Free Software Foundation.
// * // *
// * This program is distributed in the hope that it will be useful, // * This program is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of // * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// * GNU Affero General Public License for more details. // * GNU Affero General Public License for more details.
// * // *
// * You should have received a copy of the GNU Affero General Public Li cense // * You should have received a copy of the GNU Affero General Public Li cense
// * along with this program. If not, see <http://www.gnu.org/licenses/ >. // * along with this program. If not, see <http://www.gnu.org/licenses/ >.
// *
// * As a special exception, the copyright holders give permission to li
nk the
// * code of portions of this program with the OpenSSL library under cer
tain
// * conditions as described in each individual source file and distribu
te
// * linked combinations including the program with the OpenSSL library.
You
// * must comply with the GNU Affero General Public License in all respe
cts
// * for all of the code used other than as permitted herein. If you mod
ify
// * file(s) with this exception, you may extend this exception to your
// * version of the file(s), but you are not obligated to do so. If you
do not
// * wish to do so, delete this exception statement from your version. I
f you
// * delete this exception statement from all source files in the progra
m,
// * then also delete it in the license file.
// */ // */
// //
// #include "mongo/pch.h" // #include "mongo/pch.h"
#pragma once #pragma once
#if defined(_WIN32) #if defined(_WIN32)
#include <windows.h> #include <windows.h>
#include "text.h" #include "text.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 21 lines changed or added


 wire_version.h   wire_version.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
for
* all of the code used other than as permitted herein. If you modify fil
e(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also de
lete
* it in the license file.
*/ */
namespace mongo { namespace mongo {
/** /**
* The 'WireVersion' captures all "protocol events" the write protocol went through. A * The 'WireVersion' captures all "protocol events" the write protocol went through. A
* protocol event is a change in the syntax of messages on the wire or the semantics of * protocol event is a change in the syntax of messages on the wire or the semantics of
* existing messages. We may also add "logical" entries for releases, a lthough that's not * existing messages. We may also add "logical" entries for releases, a lthough that's not
* mandatory. * mandatory.
* *
skipping to change at line 40 skipping to change at line 52
* *
* If two agents have at least one version in common they can communica te, but one of the * If two agents have at least one version in common they can communica te, but one of the
* sides has to be ready to compensate for not being on its partner ver sion. * sides has to be ready to compensate for not being on its partner ver sion.
*/ */
enum WireVersion { enum WireVersion {
// Everything before we started tracking. // Everything before we started tracking.
RELEASE_2_4_AND_BEFORE = 0, RELEASE_2_4_AND_BEFORE = 0,
// The aggregation command may now be requested to return cursors. // The aggregation command may now be requested to return cursors.
AGG_RETURNS_CURSORS = 1, AGG_RETURNS_CURSORS = 1,
// insert, update, and delele batch command
BATCH_COMMANDS = 2
}; };
// Latest version that the server accepts. This should always be at the latest entry in // Latest version that the server accepts. This should always be at the latest entry in
// WireVersion. // WireVersion.
static const int maxWireVersion = AGG_RETURNS_CURSORS; static const int maxWireVersion = BATCH_COMMANDS;
// Minimum version that the server accepts. We should bump this wheneve r we don't want // Minimum version that the server accepts. We should bump this wheneve r we don't want
// to allow communication with too old agents. // to allow communication with too old agents.
static const int minWireVersion = RELEASE_2_4_AND_BEFORE; static const int minWireVersion = RELEASE_2_4_AND_BEFORE;
} // namespace mongo } // namespace mongo
 End of changes. 3 change blocks. 
1 lines changed or deleted 24 lines changed or added


 working_set.h   working_set.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <vector> #include <vector>
#include "mongo/db/diskloc.h" #include "mongo/db/diskloc.h"
#include "mongo/db/jsobj.h" #include "mongo/db/jsobj.h"
#include "mongo/platform/unordered_map.h" #include "mongo/platform/unordered_map.h"
namespace mongo { namespace mongo {
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 working_set_common.h   working_set_common.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
struct WorkingSetMember; struct WorkingSetMember;
class WorkingSetCommon { class WorkingSetCommon {
public: public:
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 write_commands.h   write_commands.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
#include <string> #include <string>
#include "mongo/db/commands.h" #include "mongo/db/commands.h"
#include "mongo/db/commands/write_commands/batch.h" #include "mongo/s/batched_command_request.h"
namespace mongo { namespace mongo {
/** /**
* Base class for write commands. Write commands support batch writes and write concern, * Base class for write commands. Write commands support batch writes and write concern,
* and return per-item error information. All write commands use the ( non-virtual) entry * and return per-item error information. All write commands use the ( non-virtual) entry
* point WriteCmd::run(). * point WriteCmd::run().
* *
* Command parsing is performed by the WriteBatch class (command syntax documented there), * Command parsing is performed by the WriteBatch class (command syntax documented there),
* and command execution is performed by the WriteBatchExecutor class. * and command execution is performed by the WriteBatchExecutor class.
*/ */
class WriteCmd : public Command { class WriteCmd : public Command {
MONGO_DISALLOW_COPYING(WriteCmd); MONGO_DISALLOW_COPYING(WriteCmd);
public: public:
virtual ~WriteCmd() {} virtual ~WriteCmd() {}
protected: protected:
/** /**
* Instantiates a command that can be invoked by "name", which will be capable of issuing * Instantiates a command that can be invoked by "name", which will be capable of issuing
* write batches of type "writeType", and will require privilege "a ction" to run. * write batches of type "writeType", and will require privilege "a ction" to run.
*/ */
WriteCmd(const StringData& name, WriteBatch::WriteType writeType, A WriteCmd( const StringData& name,
ctionType action); BatchedCommandRequest::BatchType writeType,
ActionType action );
private: private:
virtual bool logTheOp(); virtual bool logTheOp();
virtual bool slaveOk() const; virtual bool slaveOk() const;
virtual LockType locktype() const; virtual LockType locktype() const;
virtual void addRequiredPrivileges(const std::string& dbname, virtual void addRequiredPrivileges(const std::string& dbname,
const BSONObj& cmdObj, const BSONObj& cmdObj,
skipping to change at line 71 skipping to change at line 86
BSONObj& cmdObj, BSONObj& cmdObj,
int options, int options,
string& errmsg, string& errmsg,
BSONObjBuilder& result, BSONObjBuilder& result,
bool fromRepl); bool fromRepl);
// Privilege required to execute command. // Privilege required to execute command.
ActionType _action; ActionType _action;
// Type of batch (e.g. insert). // Type of batch (e.g. insert).
WriteBatch::WriteType _writeType; BatchedCommandRequest::BatchType _writeType;
}; };
class CmdInsert : public WriteCmd { class CmdInsert : public WriteCmd {
MONGO_DISALLOW_COPYING(CmdInsert); MONGO_DISALLOW_COPYING(CmdInsert);
public: public:
CmdInsert(); CmdInsert();
private: private:
virtual void help(stringstream& help) const; virtual void help(stringstream& help) const;
}; };
 End of changes. 5 change blocks. 
4 lines changed or deleted 26 lines changed or added


 write_concern.h   write_concern.h 
skipping to change at line 15 skipping to change at line 15
* it under the terms of the GNU Affero General Public License, version 3, * it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Lice nse * You should have received a copy of the GNU Affero General Public Lice nse
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certa
in
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Y
ou
* must comply with the GNU Affero General Public License in all respect
s for
* all of the code used other than as permitted herein. If you modify fi
le(s)
* with this exception, you may extend this exception to your version of
the
* file(s), but you are not obligated to do so. If you do not wish to do
so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also d
elete
* it in the license file.
*/ */
#pragma once #pragma once
namespace mongo { namespace mongo {
/** /**
* Helper method for commands to call. Blocks until write concern (as specified in "cmdObj") * Helper method for commands to call. Blocks until write concern (as specified in "cmdObj")
* is satisfied. "err" should be set to true if the last operation suc ceeded, otherwise false. * is satisfied. "err" should be set to true if the last operation suc ceeded, otherwise false.
* "result" will be filled with write concern results. Returns false a nd sets "errmsg" on * "result" will be filled with write concern results. Returns false a nd sets "errmsg" on
 End of changes. 1 change blocks. 
0 lines changed or deleted 20 lines changed or added


 writeback_listener.h   writeback_listener.h 
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU Affero General Public License, version 3 , * it under the terms of the GNU Affero General Public License, version 3 ,
* as published by the Free Software Foundation. * as published by the Free Software Foundation.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
* *
* You should have received a copy of the GNU Affero General Public Licen se * You should have received a copy of the GNU Affero General Public Licen se
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, the copyright holders give permission to link
the
* code of portions of this program with the OpenSSL library under certai
n
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. Yo
u
* must comply with the GNU Affero General Public License in all respects
* for all of the code used other than as permitted herein. If you modify
* file(s) with this exception, you may extend this exception to your
* version of the file(s), but you are not obligated to do so. If you do
not
* wish to do so, delete this exception statement from your version. If y
ou
* delete this exception statement from all source files in the program,
* then also delete it in the license file.
*/ */
#pragma once #pragma once
#include "mongo/pch.h" #include "mongo/pch.h"
#include "mongo/client/connpool.h" #include "mongo/client/connpool.h"
#include "mongo/db/client.h" #include "mongo/db/client.h"
#include "mongo/platform/unordered_map.h" #include "mongo/platform/unordered_map.h"
#include "mongo/platform/unordered_set.h" #include "mongo/platform/unordered_set.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 17 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/