K8SPSMDB-937: Fix decoding initialSyncStatus to empty interface #1235
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CHANGE DESCRIPTION
Problem:
We started to use official mongo go driver in v1.10.0. Looking at the ticket of mongo driver, it seems driver has problems on decoding to empty interfaces:
https://jira.mongodb.org/browse/GODRIVER-710
https://jira.mongodb.org/browse/GODRIVER-988
https://jira.mongodb.org/browse/GODRIVER-2060
Problems arise most likely because of different behaviors in community driver (mgo, which we were using until v1.10.0) and in the official driver. mgo uses
bson.M
while official driver usesbson.D
for empty interfaces.Solution:
We'll use a workaround as suggested by Mongo team in GODRIVER-988. Rather than directly decoding to struct, we'll decode into an empty
bson.M
and thenjson.Marshal
andjson.Unmarshal
the document into our struct. This is not optimal but since it's only in liveness probe it shouldn't cause any performance issue.CHECKLIST
Jira
Needs Doc
) and QA (Needs QA
)?Tests
compare/*-oc.yml
)?Config/Logging/Testability