Operational Defect Database

BugZero found this defect 294 days ago.

MongoDB | 2404740

time-series bucket change-stream events lack `bucketRoundingSeconds`.

Last update date:

3/12/2024

Affected products:

MongoDB Server

Affected releases:

No affected releases provided.

Fixed releases:

No fixed releases provided.

Description:

Info

Whenever a time-series collection’s granularity changes, the resulting change-stream event always seems to lack `bucketRoundingSeconds`. This may complicate delivery of mongosync’s time-series collection support.

Top User Comments

JIRAUSER1272372 commented on Tue, 8 Aug 2023 16:01:40 +0000: ana.meza@mongodb.com: This doesn’t appear to impede mongosync’s time-series collection support in v6 thanks to the workaround that mickey.winters@mongodb.com mentioned. At present our logic is: +func FixGranularity(props bson.D) bson.D { + propsMap := props.Map() + + // If we got granularity, then the server will actually forbid + // bucketRoundingSeconds. So we should be done. + if _, hasGranularity := propsMap["granularity"]; hasGranularity { + return props + } + + // Check for bucketMaxSpanSeconds (“mss”). + if mss, hasMSS := propsMap["bucketMaxSpanSeconds"]; hasMSS { + + // If we got mss *and* rounding-seconds, then we should be done. + if _, hasRounding := propsMap["bucketRoundingSeconds"]; hasRounding { + return props + } + + // If mss matches a “granularity” preset, then just use that. + granularity, granOk := maxSpanSecondsToGranularity[cast.ToInt(mss)] + if granOk { + mbson.DReplace(props, "bucketMaxSpanSeconds", "granularity", granularity) + return props + } + + // Finally: if we have a custom max-span-seconds and no granularity, + // then just assign the mss value as rounding-seconds. + props = append(props, bson.D{{"bucketRoundingSeconds", mss}}...) + } + + return props +}

Steps to Reproduce


Additional Resources / Links

Share:

BugZero® Risk Score

What's this?

Coming soon

Status

Backlog

Learn More

Search:

...