mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
readability of code
This commit is contained in:
parent
e593c1fe4c
commit
35d37b5199
@ -313,7 +313,7 @@ namespace mongo {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if( ! nsDollarCheck( from_name ) ){
|
||||
if( ! isANormalNSName( from_name ) ){
|
||||
log(2) << "\t\t not cloning because has $ " << endl;
|
||||
continue;
|
||||
}
|
||||
|
@ -469,6 +469,7 @@
|
||||
<ClCompile Include="commands\distinct.cpp" />
|
||||
<ClCompile Include="commands\group.cpp" />
|
||||
<ClCompile Include="commands\mr.cpp" />
|
||||
<ClCompile Include="compact.cpp" />
|
||||
<ClCompile Include="dbcommands_generic.cpp" />
|
||||
<ClCompile Include="geo\2d.cpp" />
|
||||
<ClCompile Include="geo\haystack.cpp" />
|
||||
|
@ -405,6 +405,9 @@
|
||||
<ClCompile Include="mongommf.cpp">
|
||||
<Filter>db\storage engine</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="compact.cpp">
|
||||
<Filter>db\storage engine</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="repl\rs_config.h">
|
||||
|
@ -1422,7 +1422,7 @@ namespace mongo {
|
||||
*/
|
||||
DiskLoc DataFileMgr::insert(const char *ns, const void *obuf, int len, bool god, const BSONElement &writeId, bool mayAddIndex) {
|
||||
bool wouldAddIndex = false;
|
||||
massert( 10093 , "cannot insert into reserved $ collection", god || nsDollarCheck( ns ) );
|
||||
massert( 10093 , "cannot insert into reserved $ collection", god || isANormalNSName( ns ) );
|
||||
uassert( 10094 , "invalid ns", strchr( ns , '.' ) > 0 );
|
||||
const char *sys = strstr(ns, "system.");
|
||||
if ( sys ) {
|
||||
|
39
db/pdfile.h
39
db/pdfile.h
@ -51,7 +51,7 @@ namespace mongo {
|
||||
bool userCreateNS(const char *ns, BSONObj j, string& err, bool logForReplication, bool *deferIdIndex = 0);
|
||||
shared_ptr<Cursor> findTableScan(const char *ns, const BSONObj& order, const DiskLoc &startLoc=DiskLoc());
|
||||
|
||||
// -1 if library unavailable.
|
||||
// -1 if library unavailable.
|
||||
boost::intmax_t freeSpace( const string &path = dbpath );
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
@ -269,9 +269,10 @@ namespace mongo {
|
||||
DiskLoc _reuse(const char *nsname);
|
||||
};
|
||||
|
||||
/*
|
||||
/* a datafile - i.e. the "dbname.<#>" files :
|
||||
|
||||
----------------------
|
||||
Header
|
||||
DataFileHeader
|
||||
----------------------
|
||||
Extent (for a particular namespace)
|
||||
Record
|
||||
@ -281,7 +282,6 @@ namespace mongo {
|
||||
more Extents...
|
||||
----------------------
|
||||
*/
|
||||
|
||||
class DataFileHeader {
|
||||
public:
|
||||
int version;
|
||||
@ -295,18 +295,10 @@ namespace mongo {
|
||||
|
||||
enum { HeaderSize = 8192 };
|
||||
|
||||
bool currentVersion() const {
|
||||
return ( version == VERSION ) && ( versionMinor == VERSION_MINOR );
|
||||
}
|
||||
bool currentVersion() const { return ( version == VERSION ) && ( versionMinor == VERSION_MINOR ); }
|
||||
|
||||
bool uninitialized() const { return version == 0; }
|
||||
|
||||
/*Record* __getRecord(DiskLoc dl) {
|
||||
int ofs = dl.getOfs();
|
||||
assert( ofs >= HeaderSize );
|
||||
return (Record*) (((char *) this) + ofs);
|
||||
}*/
|
||||
|
||||
void init(int fileno, int filelength) {
|
||||
if ( uninitialized() ) {
|
||||
assert(filelength > 32768 );
|
||||
@ -318,7 +310,6 @@ namespace mongo {
|
||||
h->unused.set( fileno, HeaderSize );
|
||||
assert( (data-(char*)this) == HeaderSize );
|
||||
h->unusedLength = fileLength - HeaderSize - 16;
|
||||
//memcpy(data+unusedLength, " \nthe end\n", 16);
|
||||
}
|
||||
}
|
||||
|
||||
@ -407,8 +398,6 @@ namespace mongo {
|
||||
return (BtreeBucket *) rec()->data;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
|
||||
} // namespace mongo
|
||||
|
||||
#include "database.h"
|
||||
@ -438,11 +427,6 @@ namespace mongo {
|
||||
return nsindex(ns)->details(ns);
|
||||
}
|
||||
|
||||
/*inline MongoDataFile& DiskLoc::pdf() const {
|
||||
assert( fileNo != -1 );
|
||||
return *cc().database()->getFile(fileNo);
|
||||
}*/
|
||||
|
||||
inline Extent* DataFileMgr::getExtent(const DiskLoc& dl) {
|
||||
assert( dl.a() != -1 );
|
||||
return cc().database()->getFile(dl.a())->getExtent(dl);
|
||||
@ -455,11 +439,6 @@ namespace mongo {
|
||||
|
||||
BOOST_STATIC_ASSERT( 16 == sizeof(DeletedRecord) );
|
||||
|
||||
/*inline void DataFileMgr::grow(const DiskLoc& dl, int len) {
|
||||
assert( dl.a() != -1 );
|
||||
cc().database()->getFile(dl.a())->grow(dl, len);
|
||||
}*/
|
||||
|
||||
inline DeletedRecord* DataFileMgr::makeDeletedRecord(const DiskLoc& dl, int len) {
|
||||
assert( dl.a() != -1 );
|
||||
return (DeletedRecord*) cc().database()->getFile(dl.a())->makeRecord(dl, sizeof(DeletedRecord));
|
||||
@ -471,12 +450,12 @@ namespace mongo {
|
||||
|
||||
|
||||
/**
|
||||
* @return true if ns is ok
|
||||
* @return true if ns is 'normal'. $ used for collections holding index data, which do not contain BSON objects in their records.
|
||||
* special case for the local.oplog.$main ns -- naming it as such was a mistake.
|
||||
*/
|
||||
inline bool nsDollarCheck( const char* ns ){
|
||||
inline bool isANormalNSName( const char* ns ){
|
||||
if ( strchr( ns , '$' ) == 0 )
|
||||
return true;
|
||||
|
||||
return true;
|
||||
return strcmp( ns, "local.oplog.$main" ) == 0;
|
||||
}
|
||||
|
||||
|
@ -401,9 +401,9 @@ namespace BasicTests {
|
||||
ASSERT( ! Database::validDBName( "foo/bar" ) );
|
||||
ASSERT( ! Database::validDBName( "foo.bar" ) );
|
||||
|
||||
ASSERT( nsDollarCheck( "asdads" ) );
|
||||
ASSERT( ! nsDollarCheck( "asda$ds" ) );
|
||||
ASSERT( nsDollarCheck( "local.oplog.$main" ) );
|
||||
ASSERT( isANormalNSName( "asdads" ) );
|
||||
ASSERT( ! isANormalNSName( "asda$ds" ) );
|
||||
ASSERT( isANormalNSName( "local.oplog.$main" ) );
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -104,7 +104,7 @@
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4355;4800;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
|
@ -654,7 +654,10 @@ const StringData _jscode_raw_utils =
|
||||
"\"jstests/mr3.js\",\n"
|
||||
"\"jstests/indexh.js\",\n"
|
||||
"\"jstests/apitest_db.js\",\n"
|
||||
"\"jstests/evalb.js\"] );\n"
|
||||
"\"jstests/evalb.js\",\n"
|
||||
"\"jstests/evald.js\",\n"
|
||||
"\"jstests/evalf.js\",\n"
|
||||
"\"jstests/killop.js\"] );\n"
|
||||
"\n"
|
||||
"// some tests can't be run in parallel with each other\n"
|
||||
"var serialTestsArr = [ \"jstests/fsync.js\",\n"
|
||||
|
Loading…
Reference in New Issue
Block a user