summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/catalog/index_catalog.cpp13
-rw-r--r--src/mongo/db/catalog/index_catalog.h4
-rw-r--r--src/mongo/db/dbcommands.cpp2
-rw-r--r--src/mongo/db/instance.cpp17
-rw-r--r--src/mongo/db/jsobjmanipulator.h82
-rw-r--r--src/mongo/db/mongod.vcxproj1
-rw-r--r--src/mongo/db/mongod.vcxproj.filters3
7 files changed, 11 insertions, 111 deletions
diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp
index 5fd15c916b7..1b671b7dfa1 100644
--- a/src/mongo/db/catalog/index_catalog.cpp
+++ b/src/mongo/db/catalog/index_catalog.cpp
@@ -53,7 +53,6 @@
#include "mongo/db/index_legacy.h"
#include "mongo/db/index_names.h"
#include "mongo/db/jsobj.h"
-#include "mongo/db/jsobjmanipulator.h"
#include "mongo/db/keypattern.h"
#include "mongo/db/kill_current_op.h"
#include "mongo/db/ops/delete.h"
@@ -962,7 +961,9 @@ namespace mongo {
return toReturn;
}
- void IndexCatalog::updateTTLSetting( const IndexDescriptor* idx, long long newExpireSeconds ) {
+ void IndexCatalog::updateTTLSetting( TransactionExperiment* txn,
+ const IndexDescriptor* idx,
+ long long newExpireSeconds ) {
IndexDetails* indexDetails = _getIndexDetails( idx );
const BSONElement oldExpireSecs =
@@ -971,19 +972,19 @@ namespace mongo {
// Important that we set the new value in-place. We are writing directly to the
// object here so must be careful not to overwrite with a longer numeric type.
- BSONElementManipulator manip( oldExpireSecs );
+ char* nonConstPtr = const_cast<char*>(oldExpireSecs.value());
switch( oldExpireSecs.type() ) {
case EOO:
massert( 16631, "index does not have an 'expireAfterSeconds' field", false );
break;
case NumberInt:
- manip.SetInt( static_cast<int>( newExpireSeconds ) );
+ *txn->writing(reinterpret_cast<int*>(nonConstPtr)) = newExpireSeconds;
break;
case NumberDouble:
- manip.SetNumber( static_cast<double>( newExpireSeconds ) );
+ *txn->writing(reinterpret_cast<double*>(nonConstPtr)) = newExpireSeconds;
break;
case NumberLong:
- manip.SetLong( newExpireSeconds );
+ *txn->writing(reinterpret_cast<long long*>(nonConstPtr)) = newExpireSeconds;
break;
default:
massert( 16632, "current 'expireAfterSeconds' is not a number", false );
diff --git a/src/mongo/db/catalog/index_catalog.h b/src/mongo/db/catalog/index_catalog.h
index 7646cbd53f1..249f922efd9 100644
--- a/src/mongo/db/catalog/index_catalog.h
+++ b/src/mongo/db/catalog/index_catalog.h
@@ -185,7 +185,9 @@ namespace mongo {
* The specified index must already contain an expireAfterSeconds field, and the value in
* that field and newExpireSecs must both be numeric.
*/
- void updateTTLSetting( const IndexDescriptor* idx, long long newExpireSeconds );
+ void updateTTLSetting( TransactionExperiment* txn,
+ const IndexDescriptor* idx,
+ long long newExpireSeconds );
bool isMultikey( const IndexDescriptor* idex );
diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp
index c41fd2b65a5..c639b770d79 100644
--- a/src/mongo/db/dbcommands.cpp
+++ b/src/mongo/db/dbcommands.cpp
@@ -1279,7 +1279,7 @@ namespace mongo {
if ( oldExpireSecs != newExpireSecs ) {
// change expireAfterSeconds
result.appendAs( oldExpireSecs, "expireAfterSeconds_old" );
- coll->getIndexCatalog()->updateTTLSetting( idx, newExpireSecs.numberLong() );
+ coll->getIndexCatalog()->updateTTLSetting( &txn, idx, newExpireSecs.numberLong() );
result.appendAs( newExpireSecs , "expireAfterSeconds_new" );
}
}
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp
index 2efe48f1160..69d834cf332 100644
--- a/src/mongo/db/instance.cpp
+++ b/src/mongo/db/instance.cpp
@@ -58,7 +58,6 @@
#include "mongo/db/storage/mmap_v1/dur_transaction.h"
#include "mongo/db/instance.h"
#include "mongo/db/introspect.h"
-#include "mongo/db/jsobjmanipulator.h"
#include "mongo/db/json.h"
#include "mongo/db/kill_current_op.h"
#include "mongo/db/lasterror.h"
@@ -115,22 +114,6 @@ namespace mongo {
MONGO_FP_DECLARE(rsStopGetMore);
- void BSONElementManipulator::SetNumber(double d) {
- if ( _element.type() == NumberDouble )
- *getDur().writing( reinterpret_cast< double * >( value() ) ) = d;
- else if ( _element.type() == NumberInt )
- *getDur().writing( reinterpret_cast< int * >( value() ) ) = (int) d;
- else verify(0);
- }
- void BSONElementManipulator::SetLong(long long n) {
- verify( _element.type() == NumberLong );
- *getDur().writing( reinterpret_cast< long long * >(value()) ) = n;
- }
- void BSONElementManipulator::SetInt(int n) {
- verify( _element.type() == NumberInt );
- getDur().writingInt( *reinterpret_cast< int * >( value() ) ) = n;
- }
-
void inProgCmd( Message &m, DbResponse &dbresponse ) {
DbMessage d(m);
QueryMessage q(d);
diff --git a/src/mongo/db/jsobjmanipulator.h b/src/mongo/db/jsobjmanipulator.h
deleted file mode 100644
index 85f2b5cc65a..00000000000
--- a/src/mongo/db/jsobjmanipulator.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/** jsobjManipulator.h */
-
-/**
- * Copyright (C) 2009 10gen Inc.
- *
- * 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,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * 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/>.
- *
- * As a special exception, the copyright holders give permission to link the
- * 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 not wish to 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
-
-#include "mongo/db/jsobj.h"
-
-namespace mongo {
-
- /** Manipulate the binary representation of a BSONElement in-place.
- Careful, this casts away const.
- */
- class BSONElementManipulator {
- public:
- BSONElementManipulator( const BSONElement &element ) :
- _element( element ) {
- verify( !_element.eoo() );
- }
-
- // Note the ones with a capital letter call getDur().writing and journal
-
- /** Change the value, in place, of the number. */
- void setNumber(double d) {
- if ( _element.type() == NumberDouble ) *reinterpret_cast< double * >( value() ) = d;
- else if ( _element.type() == NumberInt ) *reinterpret_cast< int * >( value() ) = (int) d;
- else verify(0);
- }
- void SetNumber(double d);
- void setLong(long long n) {
- verify( _element.type() == NumberLong );
- *reinterpret_cast< long long * >( value() ) = n;
- }
- void SetLong(long long n);
- void setInt(int n) {
- verify( _element.type() == NumberInt );
- *reinterpret_cast< int * >( value() ) = n;
- }
- void SetInt(int n);
-
- /** Replace the type and value of the element with the type and value of e,
- preserving the original fieldName */
- void replaceTypeAndValue( const BSONElement &e ) {
- *data() = e.type();
- memcpy( value(), e.value(), e.valuesize() );
- }
-
- private:
- char *data() { return nonConst( _element.rawdata() ); }
- char *value() { return nonConst( _element.value() ); }
- static char *nonConst( const char *s ) { return const_cast< char * >( s ); }
-
- const BSONElement _element;
- };
-
-} // namespace mongo
diff --git a/src/mongo/db/mongod.vcxproj b/src/mongo/db/mongod.vcxproj
index 516ea3485f3..ccc3e6fa3f0 100644
--- a/src/mongo/db/mongod.vcxproj
+++ b/src/mongo/db/mongod.vcxproj
@@ -4474,7 +4474,6 @@ cscript //Nologo "$(ProjectDir)..\shell\createCPPfromJavaScriptFiles.js" "$(Proj
<ClInclude Include="index_update.h" />
<ClInclude Include="initialize_server_global_state.h" />
<ClInclude Include="intervalbtreecursor.h" />
- <ClInclude Include="jsobjmanipulator.h" />
<ClInclude Include="key.h" />
<ClInclude Include="keypattern.h" />
<ClInclude Include="kill_current_op.h" />
diff --git a/src/mongo/db/mongod.vcxproj.filters b/src/mongo/db/mongod.vcxproj.filters
index c1445e3635e..c1696cd9c6f 100644
--- a/src/mongo/db/mongod.vcxproj.filters
+++ b/src/mongo/db/mongod.vcxproj.filters
@@ -3896,9 +3896,6 @@
<ClInclude Include="filever.h">
<Filter>db\Header Files\e to n</Filter>
</ClInclude>
- <ClInclude Include="jsobjmanipulator.h">
- <Filter>db\Header Files\e to n</Filter>
- </ClInclude>
<ClInclude Include="key.h">
<Filter>db\Header Files\e to n</Filter>
</ClInclude>