summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_oplog_stones.h
diff options
context:
space:
mode:
authorwolfkdy <kdy71107216@aliyun.com>2017-03-04 16:10:58 +0800
committerGeert Bosch <geert@mongodb.com>2017-07-05 17:44:39 -0400
commit93beb0234eba9dc58ab6070ad472022f96e019e6 (patch)
tree2187cdfef5e3b602fb736d175677e4eb7db562f5 /src/mongo/db/storage/wiredtiger/wiredtiger_record_store_oplog_stones.h
parent2aefd80d1acea065c77bd3bd69abf686a27ae3e0 (diff)
downloadmongo-93beb0234eba9dc58ab6070ad472022f96e019e6.tar.gz
SERVER-22766 wiredtiger engine support update oplogsize online
Diffstat (limited to 'src/mongo/db/storage/wiredtiger/wiredtiger_record_store_oplog_stones.h')
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store_oplog_stones.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_oplog_stones.h b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_oplog_stones.h
index f42ade90db8..dfd3dddb902 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_oplog_stones.h
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_oplog_stones.h
@@ -57,8 +57,14 @@ public:
void kill();
- bool hasExcessStones() const {
- return _stones.size() > _numStonesToKeep;
+ bool hasExcessStones_inlock() const {
+ int64_t total_bytes = 0;
+ for (std::deque<OplogStones::Stone>::const_iterator it = _stones.begin();
+ it != _stones.end();
+ ++it) {
+ total_bytes += it->bytes;
+ }
+ return total_bytes > _rs->cappedMaxSize();
}
void awaitHasExcessStonesOrDead();
@@ -81,6 +87,9 @@ public:
int64_t bytesRemoved,
RecordId firstRemovedId);
+ // Resize oplog size
+ void adjust(int64_t maxSize);
+
// The start point of where to truncate next. Used by the background reclaim thread to
// efficiently truncate records with WiredTiger by skipping over tombstones, etc.
RecordId firstRecord;
@@ -104,13 +113,11 @@ public:
void setMinBytesPerStone(int64_t size);
- void setNumStonesToKeep(size_t numStones);
-
private:
class InsertChange;
class TruncateChange;
- void _calculateStones(OperationContext* opCtx);
+ void _calculateStones(OperationContext* opCtx, size_t size);
void _calculateStonesByScanning(OperationContext* opCtx);
void _calculateStonesBySampling(OperationContext* opCtx,
int64_t estRecordsPerStone,
@@ -129,12 +136,8 @@ private:
// database, and false otherwise.
bool _isDead = false;
- // Maximum number of stones to keep in the deque before the background reclaim thread should
- // truncate the oldest ones. Does not include the stone currently being filled. This value
- // should not be changed after initialization.
- size_t _numStonesToKeep;
// Minimum number of bytes the stone being filled should contain before it gets added to the
- // deque of oplog stones. This value should not be changed after initialization.
+ // deque of oplog stones.
int64_t _minBytesPerStone;
AtomicInt64 _currentRecords; // Number of records in the stone being filled.