Skip to content

Commit fd671c9

Browse files
committed
WIP
1 parent a8b7c8c commit fd671c9

File tree

5 files changed

+10
-24
lines changed

5 files changed

+10
-24
lines changed

internal/integration/sessions_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -526,26 +526,30 @@ func TestSessionsProse(t *testing.T) {
526526
SetDirect(true).
527527
SetHeartbeatInterval(500 * time.Millisecond).
528528
SetMonitor(&event.CommandMonitor{
529-
Started: func(ctx context.Context, cse *event.CommandStartedEvent) {
529+
Started: func(_ context.Context, cse *event.CommandStartedEvent) {
530530
fmt.Println("Command started:", cse.CommandName, cse.Command)
531531
},
532-
Succeeded: func(ctx context.Context, cse *event.CommandSucceededEvent) {
532+
Succeeded: func(_ context.Context, cse *event.CommandSucceededEvent) {
533533
fmt.Println("Command succeeded:", cse.CommandName, cse.Reply)
534534
},
535535
}).
536536
SetServerMonitor(serverMonitor)
537537

538538
client, err := mongo.Connect(opts)
539539
require.NoError(mt, err, "expected no error connecting to client, got: %v", err)
540-
defer client.Disconnect(context.Background())
540+
defer func() {
541+
err = client.Disconnect(context.Background())
542+
require.NoError(mt, err, "expected no error disconnecting client, got: %v", err)
543+
}()
541544

542545
res, err := client.Database("admin").RunCommand(context.Background(), bson.D{
543546
{"ping", 1},
544547
}).Raw()
545548
require.NoError(mt, err, "expected no error, got: %v", err)
546549
mt.Log("result of ping command:", res)
547550

548-
mt.Client.Database("test").Collection("test").InsertOne(context.Background(), bson.D{{"advance", "$clusterTime"}})
551+
_, err = mt.Client.Database("test").Collection("test").InsertOne(context.Background(), bson.D{{"advance", "$clusterTime"}})
552+
require.NoError(mt, err, "expected no error inserting document, got: %v", err)
549553

550554
time.Sleep(3 * time.Second)
551555

x/mongo/driver/auth/auth.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ func (ah *authHandshaker) GetHandshakeInformation(
103103
AppName(ah.options.AppName).
104104
Compressors(ah.options.Compressors).
105105
SASLSupportedMechs(ah.options.DBUser).
106-
ClusterClock(ah.options.ClusterClock).
107106
ServerAPI(ah.options.ServerAPI).
108107
LoadBalanced(ah.options.LoadBalanced).
109108
OuterLibraryName(ah.options.OuterLibraryName).

x/mongo/driver/operation/hello.go

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"go.mongodb.org/mongo-driver/v2/x/mongo/driver"
2727
"go.mongodb.org/mongo-driver/v2/x/mongo/driver/description"
2828
"go.mongodb.org/mongo-driver/v2/x/mongo/driver/mnet"
29-
"go.mongodb.org/mongo-driver/v2/x/mongo/driver/session"
3029
)
3130

3231
// maxClientMetadataSize is the maximum size of the client metadata document
@@ -44,7 +43,6 @@ type Hello struct {
4443
compressors []string
4544
saslSupportedMechs string
4645
d driver.Deployment
47-
clock *session.ClusterClock
4846
speculativeAuth bsoncore.Document
4947
topologyVersion *description.TopologyVersion
5048
maxAwaitTimeMS *int64
@@ -71,16 +69,6 @@ func (h *Hello) AppName(appname string) *Hello {
7169
return h
7270
}
7371

74-
// ClusterClock sets the cluster clock for this operation.
75-
func (h *Hello) ClusterClock(clock *session.ClusterClock) *Hello {
76-
if h == nil {
77-
h = new(Hello)
78-
}
79-
80-
h.clock = clock
81-
return h
82-
}
83-
8472
// Compressors sets the compressors that can be used.
8573
func (h *Hello) Compressors(compressors []string) *Hello {
8674
h.compressors = compressors
@@ -611,7 +599,6 @@ func (h *Hello) Execute(ctx context.Context) error {
611599
return errors.New("a Hello must have a Deployment set before Execute can be called")
612600
}
613601

614-
fmt.Println("Executing Hello operation...")
615602
return h.createOperation().Execute(ctx)
616603
}
617604

@@ -630,7 +617,6 @@ func isLegacyHandshake(srvAPI *driver.ServerAPIOptions, loadbalanced bool) bool
630617

631618
func (h *Hello) createOperation() driver.Operation {
632619
op := driver.Operation{
633-
// Clock: h.clock,
634620
CommandFn: h.command,
635621
Database: "admin",
636622
Deployment: h.d,
@@ -641,10 +627,10 @@ func (h *Hello) createOperation() driver.Operation {
641627
ServerAPI: h.serverAPI,
642628
OmitMaxTimeMS: h.omitMaxTimeMS,
643629
CommandMonitor: &event.CommandMonitor{
644-
Started: func(ctx context.Context, e *event.CommandStartedEvent) {
630+
Started: func(_ context.Context, e *event.CommandStartedEvent) {
645631
fmt.Println("Hello started:", e.CommandName, e.Command)
646632
},
647-
Succeeded: func(ctx context.Context, e *event.CommandSucceededEvent) {
633+
Succeeded: func(_ context.Context, e *event.CommandSucceededEvent) {
648634
fmt.Println("Hello succeeded:", e.CommandName, e.Reply)
649635
},
650636
},
@@ -663,7 +649,6 @@ func (h *Hello) GetHandshakeInformation(ctx context.Context, _ address.Address,
663649
deployment := driver.SingleConnectionDeployment{C: conn}
664650

665651
op := driver.Operation{
666-
// Clock: h.clock,
667652
CommandFn: h.handshakeCommand,
668653
Deployment: deployment,
669654
Database: "admin",

x/mongo/driver/topology/server.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,6 @@ func (s *Server) setupHeartbeatConnection(ctx context.Context) error {
842842
func (s *Server) createBaseOperation(conn *mnet.Connection) *operation.Hello {
843843
return operation.
844844
NewHello().
845-
ClusterClock(s.cfg.clock).
846845
Deployment(driver.SingleConnectionDeployment{C: conn}).
847846
ServerAPI(s.cfg.serverAPI)
848847
}

x/mongo/driver/topology/topology_options.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ func NewConfigFromOptionsWithAuthenticator(opts *options.ClientOptions, clock *s
290290
return operation.NewHello().
291291
AppName(appName).
292292
Compressors(comps).
293-
ClusterClock(clock).
294293
ServerAPI(serverAPI).
295294
LoadBalanced(loadBalanced).
296295
OuterLibraryName(outerLibraryName).

0 commit comments

Comments
 (0)