@@ -16,6 +16,7 @@ package healthcheck
16
16
17
17
import (
18
18
"context"
19
+ "encoding/json"
19
20
20
21
v "github.com/hashicorp/go-version"
21
22
"github.com/percona/percona-server-mongodb-operator/pkg/psmdb/mongo"
@@ -110,14 +111,31 @@ func HealthCheckMongodLiveness(client mongo.Client, startupDelaySeconds int64) (
110
111
// standalone mongod nodes in an unmanaged cluster doesn't need
111
112
// to die before they added to a replset
112
113
if res .Err ().Error () == ErrNoReplsetConfigStr {
113
- return nil , nil
114
+ state := mongo .MemberStateUnknown
115
+ return & state , nil
114
116
}
115
117
return nil , errors .Wrap (res .Err (), "get replsetGetStatus response" )
116
118
}
117
119
120
+ // this is a workaround to fix decoding of empty interfaces
121
+ // https://jira.mongodb.org/browse/GODRIVER-988
118
122
rsStatus := ReplSetStatus {}
119
- if err := res .Decode (& rsStatus ); err != nil {
120
- return nil , errors .Wrap (err , "get replsetGetStatus response" )
123
+ tempResult := bson.M {}
124
+ err = res .Decode (& tempResult )
125
+ if err != nil {
126
+ return nil , errors .Wrap (err , "decode replsetGetStatus response" )
127
+ }
128
+
129
+ if err == nil {
130
+ result , err := json .Marshal (tempResult )
131
+ if err != nil {
132
+ return nil , errors .Wrap (err , "marshal temp result" )
133
+ }
134
+
135
+ err = json .Unmarshal (result , & rsStatus )
136
+ if err != nil {
137
+ return nil , errors .Wrap (err , "unmarshal temp result" )
138
+ }
121
139
}
122
140
123
141
oplogRs := OplogRs {}
0 commit comments