Skip to content

Commit 17a380c

Browse files
committed
storage analyze
1 parent 9b84368 commit 17a380c

File tree

6 files changed

+744
-4
lines changed

6 files changed

+744
-4
lines changed

mongo/src/mongo/db/repl/replication_info.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class OplogInfoServerStatus : public ServerStatusSection {
196196
}
197197

198198
BSONObjBuilder result;
199-
// TODO(siyuan) Output term of OpTime
199+
// TODO(siyuan) Output term of OpTime
200200
result.append("latestOptime", replCoord->getMyLastAppliedOpTime().getTimestamp());
201201

202202
const std::string& oplogNS =

mongo/src/mongo/db/storage/kv/kv_catalog.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ void KVCatalog::FeatureTracker::putInfo(OperationContext* opCtx, const FeatureBi
420420

421421
////KVStorageEngine::KVStorageEngine中构造初始化
422422
KVCatalog::KVCatalog(RecordStore* rs, bool directoryPerDb, bool directoryForIndexes)
423-
: _rs(rs), //对应WiredTigerRecordStore
423+
: _rs(rs), //对应WiredTigerRecordStore,对应_mdb_catalog.wt元数据文件操作
424424
_directoryPerDb(directoryPerDb),
425425
_directoryForIndexes(directoryForIndexes),
426426
_rand(_newRand()) {}
@@ -444,6 +444,7 @@ bool KVCatalog::_hasEntryCollidingWithRand() const {
444444

445445
//KVCatalog::newCollection KVCatalog::putMetaData中调用
446446
//_newUniqueIdent()函数获得collection对应的文件名字(ident),一个集合对应一个wt文件
447+
//注意,这里是生成一个唯一的ident,这里的算法值得学习
447448
std::string KVCatalog::_newUniqueIdent(StringData ns, const char* kind) {
448449
// If this changes to not put _rand at the end, _hasEntryCollidingWithRand will need fixing.
449450
StringBuilder buf;

mongo/src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class WiredTigerRecordStore;
5454
class WiredTigerSessionCache;
5555
class WiredTigerSizeStorer;
5656

57-
//wiredtiger中的wt文件通过以下方式打开wt内容:
57+
//wiredtiger中的wt文件通过以下方式打开wt内容(注意wt用官方的):
5858
// 1. wt -C "extensions=[/usr/local/lib/libwiredtiger_snappy.so]" -h . dump table:_mdb_catalog
5959
// 2. ./wt -v -h /home/yangyazhou/backup2 -C "extensions=[./ext/compressors/snappy/.libs/libwiredtiger_snappy.so]" dump file:WiredTigerLAS.wt
6060
// 3. ./wt -v -h /home/yangyazhou/backup2 -C "extensions=[./ext/compressors/snappy/.libs/libwiredtiger_snappy.so]" dump file:WiredTiger.wt

mongo/src/mongo/db/storage/wiredtiger/wiredtiger_record_store.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ int64_t WiredTigerRecordStore::cappedMaxSize() const {
765765
return _cappedMaxSize;
766766
}
767767

768-
//获取WiredTigerRecordStore对应表的大小
768+
//获取WiredTigerRecordStore对应表的磁盘空间占用大小
769769
int64_t WiredTigerRecordStore::storageSize(OperationContext* opCtx,
770770
BSONObjBuilder* extraInfo,
771771
int infoLevel) const {

mongo/src/mongo/db/ttl.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ class TTLMonitor : public BackgroundJob {
134134
ttlPasses.increment();
135135

136136
// Get all TTL indexes from every collection.
137+
//把拥有TTL的索引找出来
137138
for (const std::string& collectionNS : ttlCollections) {
138139
NamespaceString collectionNSS(collectionNS);
139140
AutoGetCollection autoGetCollection(&opCtx, collectionNSS, MODE_IS);

0 commit comments

Comments
 (0)