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

GODRIVER-2943 Re-organize client entity expected log messages #1366

Merged
merged 12 commits into from
Dec 7, 2023
Prev Previous commit
Next Next commit
GODRIVER-2943 Fix sharded case
  • Loading branch information
prestonvasquez committed Oct 11, 2023
commit 58cb48e73541c543952941254afab3cd173231c6
2 changes: 0 additions & 2 deletions mongo/integration/unified/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ func (log *Logger) Info(level int, msg string, args ...interface{}) {
}
}

defer func() { log.lastOrder++ }()

// Send the log message to the "orderedLogMessage" channel for
// validation.
log.logQueue <- orderedLogMessage{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,22 +187,6 @@
}
}
},
{
"level": "debug",
"component": "topology",
"data": {
"message": "Topology description changed",
"topologyId": {
"$$exists": true
},
"previousDescription": {
"$$exists": true
},
"newDescription": {
"$$exists": true
}
}
},
{
"level": "debug",
"component": "topology",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ tests:
topologyId: { $$exists: true }
serverHost: { $$type: string }
serverPort: { $$type: [int, long] }
# TODO(GODRIVER-2967): The following log message has been removed from
# the JSON analogue because it assumes that
# "TopologyDescriptionChangedEvent" should occur when a topolgoy is
# closed. This behavior is not clearly defined anywhere and some
# drivers support and some don't.
#
# Need to sync whenever GODRIVER-2967 is unblocked.
- level: debug
component: topology
data:
Expand Down
14 changes: 13 additions & 1 deletion x/mongo/driver/topology/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,19 @@ func (s *Server) publishServerHeartbeatSucceededEvent(connectionID string,
}

if mustLogServerMessage(s) {
descRaw, _ := bson.Marshal(desc)
descRaw, _ := bson.Marshal(struct {
description.Server `bson:",inline"`
Ok int32
}{
Server: desc,
Ok: func() int32 {
if desc.LastError != nil {
return 0
}

return 1
}(),
})

logServerMessage(s, logger.TopologyServerHeartbeatSucceeded,
logger.KeyAwaited, await,
Expand Down