summaryrefslogtreecommitdiff
path: root/src/mongo/db/ftdc/compressor.h
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2015-10-08 13:47:43 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2015-10-22 14:45:38 -0400
commita7863d44d31812ff24d5db4e1af650ad5411bea8 (patch)
treece2679a93977fea2dc677c0c2aebf395e08bf872 /src/mongo/db/ftdc/compressor.h
parent58a313d94332eff0164d99092d5692e965501961 (diff)
downloadmongo-a7863d44d31812ff24d5db4e1af650ad5411bea8.tar.gz
SERVER-20582: _id time reflects end of chunk instead of beginning
Diffstat (limited to 'src/mongo/db/ftdc/compressor.h')
-rw-r--r--src/mongo/db/ftdc/compressor.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/mongo/db/ftdc/compressor.h b/src/mongo/db/ftdc/compressor.h
index 58c8f1c0012..d70354419cf 100644
--- a/src/mongo/db/ftdc/compressor.h
+++ b/src/mongo/db/ftdc/compressor.h
@@ -88,9 +88,12 @@ public:
* 1. kCompressorFull if the compressor is considered full.
* 2. kSchemaChanged if there was a schema change, and buffer should be flushed.
* 3. kHasSpace if it has room for more metrics in the current buffer.
+ *
+ * date is the date at which the sample as started to be captured. It will be saved in the
+ * compressor if this sample is used as the reference document.N
*/
- StatusWith<boost::optional<std::tuple<ConstDataRange, CompressorState>>> addSample(
- const BSONObj& sample);
+ StatusWith<boost::optional<std::tuple<ConstDataRange, CompressorState, Date_t>>> addSample(
+ const BSONObj& sample, Date_t date);
/**
* Returns the number of enqueued samples.
@@ -122,7 +125,7 @@ public:
* The returned buffer is valid until next call to addSample() or getCompressedSamples() with
* CompressBuffer::kGenerateNewCompressedBuffer.
*/
- StatusWith<ConstDataRange> getCompressedSamples();
+ StatusWith<std::tuple<ConstDataRange, Date_t>> getCompressedSamples();
/**
* Reset the state of the compressor.
@@ -144,7 +147,7 @@ private:
/**
* Reset the state
*/
- void _reset(const BSONObj& referenceDoc);
+ void _reset(const BSONObj& referenceDoc, Date_t date);
private:
// Block Compressor
@@ -156,6 +159,10 @@ private:
// Reference schema document
BSONObj _referenceDoc;
+ // Time at which reference schema document was collected.
+ // Passed in via addSample and returned with each chunk.
+ Date_t _referenceDocDate;
+
// Number of Metrics for the reference document
std::uint32_t _metricsCount{0};