Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8SPSMDB-937: Fix decoding initialSyncStatus to empty interface #1235

Merged
merged 5 commits into from
Sep 8, 2023

Conversation

egegunes
Copy link
Contributor

@egegunes egegunes commented Jun 5, 2023

K8SPSMDB-937 Powered by Pull Request Badge

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 uses bson.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 then json.Marshal and json.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

  • Is the Jira ticket created and referenced properly?
  • Does the Jira ticket have the proper statuses for documentation (Needs Doc) and QA (Needs QA)?
  • Does the Jira ticket link to the proper milestone (Fix Version field)?

Tests

  • Is an E2E test/test case added for the new feature/change?
  • Are unit tests added where appropriate?
  • Are OpenShift compare files changed for E2E tests (compare/*-oc.yml)?

Config/Logging/Testability

  • Are all needed new/changed options added to default YAML files?
  • Are the manifests (crd/bundle) regenerated if needed?
  • Did we add proper logging messages for operator actions?
  • Did we ensure compatibility with the previous version or cluster upgrade process?
  • Does the change support oldest and newest supported MongoDB version?
  • Does the change support oldest and newest supported Kubernetes version?

@pull-request-size pull-request-size bot added the size/S 10-29 lines label Jun 5, 2023
@inelpandzic inelpandzic self-requested a review June 5, 2023 09:17
inelpandzic
inelpandzic previously approved these changes Jun 5, 2023
pooknull
pooknull previously approved these changes Jun 5, 2023
@egegunes egegunes changed the base branch from 1.11.0-CUSTOM-140 to main June 6, 2023 07:57
@egegunes egegunes dismissed stale reviews from pooknull and inelpandzic June 6, 2023 07:57

The base branch was changed.

@JNKPercona
Copy link
Collaborator

Test name Status
arbiter passed
balancer passed
cross-site-sharded passed
data-at-rest-encryption passed
data-sharded passed
demand-backup passed
demand-backup-eks-credentials passed
demand-backup-physical passed
demand-backup-physical-sharded passed
demand-backup-sharded passed
expose-sharded passed
ignore-labels-annotations passed
init-deploy passed
finalizer passed
limits passed
liveness passed
mongod-major-upgrade passed
mongod-major-upgrade-sharded passed
monitoring-2-0 passed
multi-cluster-service passed
non-voting passed
one-pod passed
operator-self-healing-chaos passed
pitr passed
pitr-sharded passed
recover-no-primary passed
rs-shard-migration passed
scaling passed
scheduled-backup passed
security-context passed
self-healing-chaos passed
service-per-pod passed
serviceless-external-nodes passed
smart-update passed
storage passed
upgrade passed
upgrade-consistency passed
upgrade-consistency-sharded passed
upgrade-sharded passed
users passed
version-service passed
We run 41 out of 41

commit: 2a70836
image: perconalab/percona-server-mongodb-operator:PR-1235-2a708368

@hors hors merged commit 60a7fca into main Sep 8, 2023
8 checks passed
@hors hors deleted the K8SPSMDB-937 branch September 8, 2023 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/S 10-29 lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants