Skip to content

Commit 313b1fe

Browse files
committed
maybe fix sharding
1 parent 9b0b888 commit 313b1fe

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

internal/verifier/change_stream_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,12 @@ func (suite *IntegrationTestSuite) TestEventBeforeWritesOff() {
249249
checkDoneChan := make(chan struct{})
250250
checkContinueChan := make(chan struct{})
251251

252+
db := suite.srcMongoClient.Database(suite.DBNameForTest())
253+
coll := db.Collection("mycoll")
254+
suite.Require().NoError(
255+
db.CreateCollection(ctx, coll.Name()),
256+
)
257+
252258
// start verifier
253259
verifierDoneChan := make(chan struct{})
254260
go func() {
@@ -261,9 +267,6 @@ func (suite *IntegrationTestSuite) TestEventBeforeWritesOff() {
261267
// wait for generation 1
262268
<-checkDoneChan
263269

264-
db := suite.srcMongoClient.Database(suite.DBNameForTest())
265-
coll := db.Collection("mycoll")
266-
267270
docsCount := 10_000
268271
docs := lo.RepeatBy(docsCount, func(_ int) bson.D { return bson.D{} })
269272
_, err := coll.InsertMany(

internal/verifier/clustertime.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ func GetNewClusterTime(
2828

2929
var clusterTime primitive.Timestamp
3030

31-
// First we just fetch the latest cluster time without updating any
32-
// shards’ oplogs.
31+
// First we just fetch the latest cluster time among all shards without
32+
// updating any shards’ oplogs.
3333
err := retryer.RunForTransientErrorsOnly(
3434
ctx,
3535
logger,
@@ -107,7 +107,10 @@ func syncClusterTimeAcrossShards(
107107
)
108108

109109
if err != nil {
110-
return primitive.Timestamp{}, err
110+
return primitive.Timestamp{}, errors.Wrap(
111+
err,
112+
"failed to append note to oplog",
113+
)
111114
}
112115

113116
return getOpTimeFromRawResponse(rawResponse)

0 commit comments

Comments
 (0)