diff options
author | Matthew Saltz <matthew.saltz@mongodb.com> | 2018-06-21 15:15:43 -0400 |
---|---|---|
committer | Matthew Saltz <matthew.saltz@mongodb.com> | 2018-06-21 15:15:43 -0400 |
commit | 4e82f220a09fd817d850775433871c8aa2ea035b (patch) | |
tree | d408acddecbbe57f30cb16709d52fd28ad5a757a /src/mongo/s/chunk.h | |
parent | 9a4c1c4cdde2829ded5eddd3a99fbe5d1d4c70cd (diff) | |
download | mongo-4e82f220a09fd817d850775433871c8aa2ea035b.tar.gz |
Revert "SERVER-35612 Implement ChunkWritesTracker with unit tests, make ChunkInfo use it"
This reverts commit 1821dca10b769bb078a851ac8329a1b461a7b6c6.
Diffstat (limited to 'src/mongo/s/chunk.h')
-rw-r--r-- | src/mongo/s/chunk.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/mongo/s/chunk.h b/src/mongo/s/chunk.h index 4e26d006402..34a2e02b57d 100644 --- a/src/mongo/s/chunk.h +++ b/src/mongo/s/chunk.h @@ -35,7 +35,6 @@ namespace mongo { class BSONObj; -class ChunkWritesTracker; /** * Represents a cache entry for a single Chunk. Owned by a RoutingTableHistory. @@ -81,10 +80,10 @@ public: * Get/increment/set the estimation of how much data was written for this chunk. */ uint64_t getBytesWritten() const; - void addBytesWritten(uint64_t bytesWrittenIncrement); + uint64_t addBytesWritten(uint64_t bytesWrittenIncrement); void clearBytesWritten(); - bool shouldSplit(uint64_t desiredChunkSize) const; + bool shouldSplit(uint64_t desiredChunkSize, bool minIsInf, bool maxIsInf) const; /** * Marks this chunk as jumbo. Only moves from false to true once and is used by the balancer. @@ -104,14 +103,15 @@ private: // split mutable bool _jumbo; - // Used for tracking writes to this chunk, to estimate its size for the autosplitter. Since - // ChunkInfo obejcts are always treated as const, and this contains metadata about the chunk - // that needs to change, it's okay (and necessary) to mark it mutable - mutable std::shared_ptr<ChunkWritesTracker> _writesTracker; + // Statistics for the approximate data written to this chunk + mutable uint64_t _dataWritten; }; class Chunk { public: + // Test whether we should split once data * kSplitTestFactor > chunkSize (approximately) + static const uint64_t kSplitTestFactor = 5; + Chunk(ChunkInfo& chunkInfo, const boost::optional<Timestamp>& atClusterTime) : _chunkInfo(chunkInfo), _atClusterTime(atClusterTime) {} @@ -160,15 +160,15 @@ public: uint64_t getBytesWritten() const { return _chunkInfo.getBytesWritten(); } - void addBytesWritten(uint64_t bytesWrittenIncrement) { - _chunkInfo.addBytesWritten(bytesWrittenIncrement); + uint64_t addBytesWritten(uint64_t bytesWrittenIncrement) { + return _chunkInfo.addBytesWritten(bytesWrittenIncrement); } void clearBytesWritten() { _chunkInfo.clearBytesWritten(); } - bool shouldSplit(uint64_t desiredChunkSize) const { - return _chunkInfo.shouldSplit(desiredChunkSize); + bool shouldSplit(uint64_t desiredChunkSize, bool minIsInf, bool maxIsInf) const { + return _chunkInfo.shouldSplit(desiredChunkSize, minIsInf, maxIsInf); } /** |