From ccfbb0cf935cb5533b0a7857d174823b39517787 Mon Sep 17 00:00:00 2001 From: Matt Dale <9760375+matthewdale@users.noreply.github.com> Date: Thu, 14 Nov 2024 09:18:55 -0800 Subject: [PATCH] GODRIVER-3030 Retry ReadConcernMajorityNotAvailableYet errors. --- .../integration/unified/unified_spec_test.go | 1 + internal/integration/unified_spec_test.go | 2 +- .../{ => legacy}/aggregate-merge.json | 0 .../{ => legacy}/aggregate-merge.yml | 0 .../{ => legacy}/aggregate-serverErrors.json | 0 .../{ => legacy}/aggregate-serverErrors.yml | 0 .../{ => legacy}/aggregate.json | 0 .../{ => legacy}/aggregate.yml | 0 ...angeStreams-client.watch-serverErrors.json | 0 ...hangeStreams-client.watch-serverErrors.yml | 0 .../changeStreams-client.watch.json | 0 .../changeStreams-client.watch.yml | 0 ...ngeStreams-db.coll.watch-serverErrors.json | 0 ...angeStreams-db.coll.watch-serverErrors.yml | 0 .../changeStreams-db.coll.watch.json | 0 .../changeStreams-db.coll.watch.yml | 0 .../changeStreams-db.watch-serverErrors.json | 0 .../changeStreams-db.watch-serverErrors.yml | 0 .../{ => legacy}/changeStreams-db.watch.json | 0 .../{ => legacy}/changeStreams-db.watch.yml | 0 .../{ => legacy}/count-serverErrors.json | 0 .../{ => legacy}/count-serverErrors.yml | 0 .../retryable-reads/{ => legacy}/count.json | 0 .../retryable-reads/{ => legacy}/count.yml | 0 .../countDocuments-serverErrors.json | 0 .../countDocuments-serverErrors.yml | 0 .../{ => legacy}/countDocuments.json | 0 .../{ => legacy}/countDocuments.yml | 0 .../{ => legacy}/distinct-serverErrors.json | 0 .../{ => legacy}/distinct-serverErrors.yml | 0 .../{ => legacy}/distinct.json | 0 .../retryable-reads/{ => legacy}/distinct.yml | 0 .../estimatedDocumentCount-serverErrors.json | 0 .../estimatedDocumentCount-serverErrors.yml | 0 .../{ => legacy}/estimatedDocumentCount.json | 0 .../{ => legacy}/estimatedDocumentCount.yml | 0 .../{ => legacy}/find-serverErrors.json | 0 .../{ => legacy}/find-serverErrors.yml | 0 .../retryable-reads/{ => legacy}/find.json | 0 .../retryable-reads/{ => legacy}/find.yml | 0 .../{ => legacy}/findOne-serverErrors.json | 0 .../{ => legacy}/findOne-serverErrors.yml | 0 .../retryable-reads/{ => legacy}/findOne.json | 0 .../retryable-reads/{ => legacy}/findOne.yml | 0 .../gridfs-download-serverErrors.json | 0 .../gridfs-download-serverErrors.yml | 0 .../{ => legacy}/gridfs-download.json | 0 .../{ => legacy}/gridfs-download.yml | 0 .../gridfs-downloadByName-serverErrors.json | 0 .../gridfs-downloadByName-serverErrors.yml | 0 .../{ => legacy}/gridfs-downloadByName.json | 0 .../{ => legacy}/gridfs-downloadByName.yml | 0 .../listCollectionNames-serverErrors.json | 0 .../listCollectionNames-serverErrors.yml | 0 .../{ => legacy}/listCollectionNames.json | 0 .../{ => legacy}/listCollectionNames.yml | 0 .../listCollectionObjects-serverErrors.json | 0 .../listCollectionObjects-serverErrors.yml | 0 .../{ => legacy}/listCollectionObjects.json | 0 .../{ => legacy}/listCollectionObjects.yml | 0 .../listCollections-serverErrors.json | 0 .../listCollections-serverErrors.yml | 0 .../{ => legacy}/listCollections.json | 0 .../{ => legacy}/listCollections.yml | 0 .../listDatabaseNames-serverErrors.json | 0 .../listDatabaseNames-serverErrors.yml | 0 .../{ => legacy}/listDatabaseNames.json | 0 .../{ => legacy}/listDatabaseNames.yml | 0 .../listDatabaseObjects-serverErrors.json | 0 .../listDatabaseObjects-serverErrors.yml | 0 .../{ => legacy}/listDatabaseObjects.json | 0 .../{ => legacy}/listDatabaseObjects.yml | 0 .../listDatabases-serverErrors.json | 0 .../listDatabases-serverErrors.yml | 0 .../{ => legacy}/listDatabases.json | 0 .../{ => legacy}/listDatabases.yml | 0 .../listIndexNames-serverErrors.json | 0 .../listIndexNames-serverErrors.yml | 0 .../{ => legacy}/listIndexNames.json | 0 .../{ => legacy}/listIndexNames.yml | 0 .../listIndexes-serverErrors.json | 0 .../{ => legacy}/listIndexes-serverErrors.yml | 0 .../{ => legacy}/listIndexes.json | 0 .../{ => legacy}/listIndexes.yml | 0 .../{ => legacy}/mapReduce.json | 0 .../{ => legacy}/mapReduce.yml | 0 .../readConcernMajorityNotAvailableYet.json | 147 ++++++++++++++++++ .../readConcernMajorityNotAvailableYet.yml | 68 ++++++++ x/mongo/driver/errors.go | 17 +- 89 files changed, 233 insertions(+), 2 deletions(-) rename testdata/retryable-reads/{ => legacy}/aggregate-merge.json (100%) rename testdata/retryable-reads/{ => legacy}/aggregate-merge.yml (100%) rename testdata/retryable-reads/{ => legacy}/aggregate-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/aggregate-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/aggregate.json (100%) rename testdata/retryable-reads/{ => legacy}/aggregate.yml (100%) rename testdata/retryable-reads/{ => legacy}/changeStreams-client.watch-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/changeStreams-client.watch-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/changeStreams-client.watch.json (100%) rename testdata/retryable-reads/{ => legacy}/changeStreams-client.watch.yml (100%) rename testdata/retryable-reads/{ => legacy}/changeStreams-db.coll.watch-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/changeStreams-db.coll.watch-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/changeStreams-db.coll.watch.json (100%) rename testdata/retryable-reads/{ => legacy}/changeStreams-db.coll.watch.yml (100%) rename testdata/retryable-reads/{ => legacy}/changeStreams-db.watch-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/changeStreams-db.watch-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/changeStreams-db.watch.json (100%) rename testdata/retryable-reads/{ => legacy}/changeStreams-db.watch.yml (100%) rename testdata/retryable-reads/{ => legacy}/count-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/count-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/count.json (100%) rename testdata/retryable-reads/{ => legacy}/count.yml (100%) rename testdata/retryable-reads/{ => legacy}/countDocuments-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/countDocuments-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/countDocuments.json (100%) rename testdata/retryable-reads/{ => legacy}/countDocuments.yml (100%) rename testdata/retryable-reads/{ => legacy}/distinct-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/distinct-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/distinct.json (100%) rename testdata/retryable-reads/{ => legacy}/distinct.yml (100%) rename testdata/retryable-reads/{ => legacy}/estimatedDocumentCount-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/estimatedDocumentCount-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/estimatedDocumentCount.json (100%) rename testdata/retryable-reads/{ => legacy}/estimatedDocumentCount.yml (100%) rename testdata/retryable-reads/{ => legacy}/find-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/find-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/find.json (100%) rename testdata/retryable-reads/{ => legacy}/find.yml (100%) rename testdata/retryable-reads/{ => legacy}/findOne-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/findOne-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/findOne.json (100%) rename testdata/retryable-reads/{ => legacy}/findOne.yml (100%) rename testdata/retryable-reads/{ => legacy}/gridfs-download-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/gridfs-download-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/gridfs-download.json (100%) rename testdata/retryable-reads/{ => legacy}/gridfs-download.yml (100%) rename testdata/retryable-reads/{ => legacy}/gridfs-downloadByName-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/gridfs-downloadByName-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/gridfs-downloadByName.json (100%) rename testdata/retryable-reads/{ => legacy}/gridfs-downloadByName.yml (100%) rename testdata/retryable-reads/{ => legacy}/listCollectionNames-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/listCollectionNames-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/listCollectionNames.json (100%) rename testdata/retryable-reads/{ => legacy}/listCollectionNames.yml (100%) rename testdata/retryable-reads/{ => legacy}/listCollectionObjects-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/listCollectionObjects-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/listCollectionObjects.json (100%) rename testdata/retryable-reads/{ => legacy}/listCollectionObjects.yml (100%) rename testdata/retryable-reads/{ => legacy}/listCollections-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/listCollections-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/listCollections.json (100%) rename testdata/retryable-reads/{ => legacy}/listCollections.yml (100%) rename testdata/retryable-reads/{ => legacy}/listDatabaseNames-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/listDatabaseNames-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/listDatabaseNames.json (100%) rename testdata/retryable-reads/{ => legacy}/listDatabaseNames.yml (100%) rename testdata/retryable-reads/{ => legacy}/listDatabaseObjects-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/listDatabaseObjects-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/listDatabaseObjects.json (100%) rename testdata/retryable-reads/{ => legacy}/listDatabaseObjects.yml (100%) rename testdata/retryable-reads/{ => legacy}/listDatabases-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/listDatabases-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/listDatabases.json (100%) rename testdata/retryable-reads/{ => legacy}/listDatabases.yml (100%) rename testdata/retryable-reads/{ => legacy}/listIndexNames-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/listIndexNames-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/listIndexNames.json (100%) rename testdata/retryable-reads/{ => legacy}/listIndexNames.yml (100%) rename testdata/retryable-reads/{ => legacy}/listIndexes-serverErrors.json (100%) rename testdata/retryable-reads/{ => legacy}/listIndexes-serverErrors.yml (100%) rename testdata/retryable-reads/{ => legacy}/listIndexes.json (100%) rename testdata/retryable-reads/{ => legacy}/listIndexes.yml (100%) rename testdata/retryable-reads/{ => legacy}/mapReduce.json (100%) rename testdata/retryable-reads/{ => legacy}/mapReduce.yml (100%) create mode 100644 testdata/retryable-reads/unified/readConcernMajorityNotAvailableYet.json create mode 100644 testdata/retryable-reads/unified/readConcernMajorityNotAvailableYet.yml diff --git a/internal/integration/unified/unified_spec_test.go b/internal/integration/unified/unified_spec_test.go index 8871a48127..eba98345f4 100644 --- a/internal/integration/unified/unified_spec_test.go +++ b/internal/integration/unified/unified_spec_test.go @@ -25,6 +25,7 @@ var ( "command-monitoring/logging", "connection-monitoring-and-pooling/logging", "sessions", + "retryable-reads/unified", "retryable-writes/unified", "client-side-encryption/unified", "client-side-operations-timeout", diff --git a/internal/integration/unified_spec_test.go b/internal/integration/unified_spec_test.go index 6b37dc254c..0a69e4300b 100644 --- a/internal/integration/unified_spec_test.go +++ b/internal/integration/unified_spec_test.go @@ -178,7 +178,7 @@ const dataPath string = "../../testdata/" var directories = []string{ "transactions/legacy", "convenient-transactions", - "retryable-reads", + "retryable-reads/legacy", "read-write-concern/operation", "server-discovery-and-monitoring/integration", "atlas-data-lake-testing", diff --git a/testdata/retryable-reads/aggregate-merge.json b/testdata/retryable-reads/legacy/aggregate-merge.json similarity index 100% rename from testdata/retryable-reads/aggregate-merge.json rename to testdata/retryable-reads/legacy/aggregate-merge.json diff --git a/testdata/retryable-reads/aggregate-merge.yml b/testdata/retryable-reads/legacy/aggregate-merge.yml similarity index 100% rename from testdata/retryable-reads/aggregate-merge.yml rename to testdata/retryable-reads/legacy/aggregate-merge.yml diff --git a/testdata/retryable-reads/aggregate-serverErrors.json b/testdata/retryable-reads/legacy/aggregate-serverErrors.json similarity index 100% rename from testdata/retryable-reads/aggregate-serverErrors.json rename to testdata/retryable-reads/legacy/aggregate-serverErrors.json diff --git a/testdata/retryable-reads/aggregate-serverErrors.yml b/testdata/retryable-reads/legacy/aggregate-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/aggregate-serverErrors.yml rename to testdata/retryable-reads/legacy/aggregate-serverErrors.yml diff --git a/testdata/retryable-reads/aggregate.json b/testdata/retryable-reads/legacy/aggregate.json similarity index 100% rename from testdata/retryable-reads/aggregate.json rename to testdata/retryable-reads/legacy/aggregate.json diff --git a/testdata/retryable-reads/aggregate.yml b/testdata/retryable-reads/legacy/aggregate.yml similarity index 100% rename from testdata/retryable-reads/aggregate.yml rename to testdata/retryable-reads/legacy/aggregate.yml diff --git a/testdata/retryable-reads/changeStreams-client.watch-serverErrors.json b/testdata/retryable-reads/legacy/changeStreams-client.watch-serverErrors.json similarity index 100% rename from testdata/retryable-reads/changeStreams-client.watch-serverErrors.json rename to testdata/retryable-reads/legacy/changeStreams-client.watch-serverErrors.json diff --git a/testdata/retryable-reads/changeStreams-client.watch-serverErrors.yml b/testdata/retryable-reads/legacy/changeStreams-client.watch-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/changeStreams-client.watch-serverErrors.yml rename to testdata/retryable-reads/legacy/changeStreams-client.watch-serverErrors.yml diff --git a/testdata/retryable-reads/changeStreams-client.watch.json b/testdata/retryable-reads/legacy/changeStreams-client.watch.json similarity index 100% rename from testdata/retryable-reads/changeStreams-client.watch.json rename to testdata/retryable-reads/legacy/changeStreams-client.watch.json diff --git a/testdata/retryable-reads/changeStreams-client.watch.yml b/testdata/retryable-reads/legacy/changeStreams-client.watch.yml similarity index 100% rename from testdata/retryable-reads/changeStreams-client.watch.yml rename to testdata/retryable-reads/legacy/changeStreams-client.watch.yml diff --git a/testdata/retryable-reads/changeStreams-db.coll.watch-serverErrors.json b/testdata/retryable-reads/legacy/changeStreams-db.coll.watch-serverErrors.json similarity index 100% rename from testdata/retryable-reads/changeStreams-db.coll.watch-serverErrors.json rename to testdata/retryable-reads/legacy/changeStreams-db.coll.watch-serverErrors.json diff --git a/testdata/retryable-reads/changeStreams-db.coll.watch-serverErrors.yml b/testdata/retryable-reads/legacy/changeStreams-db.coll.watch-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/changeStreams-db.coll.watch-serverErrors.yml rename to testdata/retryable-reads/legacy/changeStreams-db.coll.watch-serverErrors.yml diff --git a/testdata/retryable-reads/changeStreams-db.coll.watch.json b/testdata/retryable-reads/legacy/changeStreams-db.coll.watch.json similarity index 100% rename from testdata/retryable-reads/changeStreams-db.coll.watch.json rename to testdata/retryable-reads/legacy/changeStreams-db.coll.watch.json diff --git a/testdata/retryable-reads/changeStreams-db.coll.watch.yml b/testdata/retryable-reads/legacy/changeStreams-db.coll.watch.yml similarity index 100% rename from testdata/retryable-reads/changeStreams-db.coll.watch.yml rename to testdata/retryable-reads/legacy/changeStreams-db.coll.watch.yml diff --git a/testdata/retryable-reads/changeStreams-db.watch-serverErrors.json b/testdata/retryable-reads/legacy/changeStreams-db.watch-serverErrors.json similarity index 100% rename from testdata/retryable-reads/changeStreams-db.watch-serverErrors.json rename to testdata/retryable-reads/legacy/changeStreams-db.watch-serverErrors.json diff --git a/testdata/retryable-reads/changeStreams-db.watch-serverErrors.yml b/testdata/retryable-reads/legacy/changeStreams-db.watch-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/changeStreams-db.watch-serverErrors.yml rename to testdata/retryable-reads/legacy/changeStreams-db.watch-serverErrors.yml diff --git a/testdata/retryable-reads/changeStreams-db.watch.json b/testdata/retryable-reads/legacy/changeStreams-db.watch.json similarity index 100% rename from testdata/retryable-reads/changeStreams-db.watch.json rename to testdata/retryable-reads/legacy/changeStreams-db.watch.json diff --git a/testdata/retryable-reads/changeStreams-db.watch.yml b/testdata/retryable-reads/legacy/changeStreams-db.watch.yml similarity index 100% rename from testdata/retryable-reads/changeStreams-db.watch.yml rename to testdata/retryable-reads/legacy/changeStreams-db.watch.yml diff --git a/testdata/retryable-reads/count-serverErrors.json b/testdata/retryable-reads/legacy/count-serverErrors.json similarity index 100% rename from testdata/retryable-reads/count-serverErrors.json rename to testdata/retryable-reads/legacy/count-serverErrors.json diff --git a/testdata/retryable-reads/count-serverErrors.yml b/testdata/retryable-reads/legacy/count-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/count-serverErrors.yml rename to testdata/retryable-reads/legacy/count-serverErrors.yml diff --git a/testdata/retryable-reads/count.json b/testdata/retryable-reads/legacy/count.json similarity index 100% rename from testdata/retryable-reads/count.json rename to testdata/retryable-reads/legacy/count.json diff --git a/testdata/retryable-reads/count.yml b/testdata/retryable-reads/legacy/count.yml similarity index 100% rename from testdata/retryable-reads/count.yml rename to testdata/retryable-reads/legacy/count.yml diff --git a/testdata/retryable-reads/countDocuments-serverErrors.json b/testdata/retryable-reads/legacy/countDocuments-serverErrors.json similarity index 100% rename from testdata/retryable-reads/countDocuments-serverErrors.json rename to testdata/retryable-reads/legacy/countDocuments-serverErrors.json diff --git a/testdata/retryable-reads/countDocuments-serverErrors.yml b/testdata/retryable-reads/legacy/countDocuments-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/countDocuments-serverErrors.yml rename to testdata/retryable-reads/legacy/countDocuments-serverErrors.yml diff --git a/testdata/retryable-reads/countDocuments.json b/testdata/retryable-reads/legacy/countDocuments.json similarity index 100% rename from testdata/retryable-reads/countDocuments.json rename to testdata/retryable-reads/legacy/countDocuments.json diff --git a/testdata/retryable-reads/countDocuments.yml b/testdata/retryable-reads/legacy/countDocuments.yml similarity index 100% rename from testdata/retryable-reads/countDocuments.yml rename to testdata/retryable-reads/legacy/countDocuments.yml diff --git a/testdata/retryable-reads/distinct-serverErrors.json b/testdata/retryable-reads/legacy/distinct-serverErrors.json similarity index 100% rename from testdata/retryable-reads/distinct-serverErrors.json rename to testdata/retryable-reads/legacy/distinct-serverErrors.json diff --git a/testdata/retryable-reads/distinct-serverErrors.yml b/testdata/retryable-reads/legacy/distinct-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/distinct-serverErrors.yml rename to testdata/retryable-reads/legacy/distinct-serverErrors.yml diff --git a/testdata/retryable-reads/distinct.json b/testdata/retryable-reads/legacy/distinct.json similarity index 100% rename from testdata/retryable-reads/distinct.json rename to testdata/retryable-reads/legacy/distinct.json diff --git a/testdata/retryable-reads/distinct.yml b/testdata/retryable-reads/legacy/distinct.yml similarity index 100% rename from testdata/retryable-reads/distinct.yml rename to testdata/retryable-reads/legacy/distinct.yml diff --git a/testdata/retryable-reads/estimatedDocumentCount-serverErrors.json b/testdata/retryable-reads/legacy/estimatedDocumentCount-serverErrors.json similarity index 100% rename from testdata/retryable-reads/estimatedDocumentCount-serverErrors.json rename to testdata/retryable-reads/legacy/estimatedDocumentCount-serverErrors.json diff --git a/testdata/retryable-reads/estimatedDocumentCount-serverErrors.yml b/testdata/retryable-reads/legacy/estimatedDocumentCount-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/estimatedDocumentCount-serverErrors.yml rename to testdata/retryable-reads/legacy/estimatedDocumentCount-serverErrors.yml diff --git a/testdata/retryable-reads/estimatedDocumentCount.json b/testdata/retryable-reads/legacy/estimatedDocumentCount.json similarity index 100% rename from testdata/retryable-reads/estimatedDocumentCount.json rename to testdata/retryable-reads/legacy/estimatedDocumentCount.json diff --git a/testdata/retryable-reads/estimatedDocumentCount.yml b/testdata/retryable-reads/legacy/estimatedDocumentCount.yml similarity index 100% rename from testdata/retryable-reads/estimatedDocumentCount.yml rename to testdata/retryable-reads/legacy/estimatedDocumentCount.yml diff --git a/testdata/retryable-reads/find-serverErrors.json b/testdata/retryable-reads/legacy/find-serverErrors.json similarity index 100% rename from testdata/retryable-reads/find-serverErrors.json rename to testdata/retryable-reads/legacy/find-serverErrors.json diff --git a/testdata/retryable-reads/find-serverErrors.yml b/testdata/retryable-reads/legacy/find-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/find-serverErrors.yml rename to testdata/retryable-reads/legacy/find-serverErrors.yml diff --git a/testdata/retryable-reads/find.json b/testdata/retryable-reads/legacy/find.json similarity index 100% rename from testdata/retryable-reads/find.json rename to testdata/retryable-reads/legacy/find.json diff --git a/testdata/retryable-reads/find.yml b/testdata/retryable-reads/legacy/find.yml similarity index 100% rename from testdata/retryable-reads/find.yml rename to testdata/retryable-reads/legacy/find.yml diff --git a/testdata/retryable-reads/findOne-serverErrors.json b/testdata/retryable-reads/legacy/findOne-serverErrors.json similarity index 100% rename from testdata/retryable-reads/findOne-serverErrors.json rename to testdata/retryable-reads/legacy/findOne-serverErrors.json diff --git a/testdata/retryable-reads/findOne-serverErrors.yml b/testdata/retryable-reads/legacy/findOne-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/findOne-serverErrors.yml rename to testdata/retryable-reads/legacy/findOne-serverErrors.yml diff --git a/testdata/retryable-reads/findOne.json b/testdata/retryable-reads/legacy/findOne.json similarity index 100% rename from testdata/retryable-reads/findOne.json rename to testdata/retryable-reads/legacy/findOne.json diff --git a/testdata/retryable-reads/findOne.yml b/testdata/retryable-reads/legacy/findOne.yml similarity index 100% rename from testdata/retryable-reads/findOne.yml rename to testdata/retryable-reads/legacy/findOne.yml diff --git a/testdata/retryable-reads/gridfs-download-serverErrors.json b/testdata/retryable-reads/legacy/gridfs-download-serverErrors.json similarity index 100% rename from testdata/retryable-reads/gridfs-download-serverErrors.json rename to testdata/retryable-reads/legacy/gridfs-download-serverErrors.json diff --git a/testdata/retryable-reads/gridfs-download-serverErrors.yml b/testdata/retryable-reads/legacy/gridfs-download-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/gridfs-download-serverErrors.yml rename to testdata/retryable-reads/legacy/gridfs-download-serverErrors.yml diff --git a/testdata/retryable-reads/gridfs-download.json b/testdata/retryable-reads/legacy/gridfs-download.json similarity index 100% rename from testdata/retryable-reads/gridfs-download.json rename to testdata/retryable-reads/legacy/gridfs-download.json diff --git a/testdata/retryable-reads/gridfs-download.yml b/testdata/retryable-reads/legacy/gridfs-download.yml similarity index 100% rename from testdata/retryable-reads/gridfs-download.yml rename to testdata/retryable-reads/legacy/gridfs-download.yml diff --git a/testdata/retryable-reads/gridfs-downloadByName-serverErrors.json b/testdata/retryable-reads/legacy/gridfs-downloadByName-serverErrors.json similarity index 100% rename from testdata/retryable-reads/gridfs-downloadByName-serverErrors.json rename to testdata/retryable-reads/legacy/gridfs-downloadByName-serverErrors.json diff --git a/testdata/retryable-reads/gridfs-downloadByName-serverErrors.yml b/testdata/retryable-reads/legacy/gridfs-downloadByName-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/gridfs-downloadByName-serverErrors.yml rename to testdata/retryable-reads/legacy/gridfs-downloadByName-serverErrors.yml diff --git a/testdata/retryable-reads/gridfs-downloadByName.json b/testdata/retryable-reads/legacy/gridfs-downloadByName.json similarity index 100% rename from testdata/retryable-reads/gridfs-downloadByName.json rename to testdata/retryable-reads/legacy/gridfs-downloadByName.json diff --git a/testdata/retryable-reads/gridfs-downloadByName.yml b/testdata/retryable-reads/legacy/gridfs-downloadByName.yml similarity index 100% rename from testdata/retryable-reads/gridfs-downloadByName.yml rename to testdata/retryable-reads/legacy/gridfs-downloadByName.yml diff --git a/testdata/retryable-reads/listCollectionNames-serverErrors.json b/testdata/retryable-reads/legacy/listCollectionNames-serverErrors.json similarity index 100% rename from testdata/retryable-reads/listCollectionNames-serverErrors.json rename to testdata/retryable-reads/legacy/listCollectionNames-serverErrors.json diff --git a/testdata/retryable-reads/listCollectionNames-serverErrors.yml b/testdata/retryable-reads/legacy/listCollectionNames-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/listCollectionNames-serverErrors.yml rename to testdata/retryable-reads/legacy/listCollectionNames-serverErrors.yml diff --git a/testdata/retryable-reads/listCollectionNames.json b/testdata/retryable-reads/legacy/listCollectionNames.json similarity index 100% rename from testdata/retryable-reads/listCollectionNames.json rename to testdata/retryable-reads/legacy/listCollectionNames.json diff --git a/testdata/retryable-reads/listCollectionNames.yml b/testdata/retryable-reads/legacy/listCollectionNames.yml similarity index 100% rename from testdata/retryable-reads/listCollectionNames.yml rename to testdata/retryable-reads/legacy/listCollectionNames.yml diff --git a/testdata/retryable-reads/listCollectionObjects-serverErrors.json b/testdata/retryable-reads/legacy/listCollectionObjects-serverErrors.json similarity index 100% rename from testdata/retryable-reads/listCollectionObjects-serverErrors.json rename to testdata/retryable-reads/legacy/listCollectionObjects-serverErrors.json diff --git a/testdata/retryable-reads/listCollectionObjects-serverErrors.yml b/testdata/retryable-reads/legacy/listCollectionObjects-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/listCollectionObjects-serverErrors.yml rename to testdata/retryable-reads/legacy/listCollectionObjects-serverErrors.yml diff --git a/testdata/retryable-reads/listCollectionObjects.json b/testdata/retryable-reads/legacy/listCollectionObjects.json similarity index 100% rename from testdata/retryable-reads/listCollectionObjects.json rename to testdata/retryable-reads/legacy/listCollectionObjects.json diff --git a/testdata/retryable-reads/listCollectionObjects.yml b/testdata/retryable-reads/legacy/listCollectionObjects.yml similarity index 100% rename from testdata/retryable-reads/listCollectionObjects.yml rename to testdata/retryable-reads/legacy/listCollectionObjects.yml diff --git a/testdata/retryable-reads/listCollections-serverErrors.json b/testdata/retryable-reads/legacy/listCollections-serverErrors.json similarity index 100% rename from testdata/retryable-reads/listCollections-serverErrors.json rename to testdata/retryable-reads/legacy/listCollections-serverErrors.json diff --git a/testdata/retryable-reads/listCollections-serverErrors.yml b/testdata/retryable-reads/legacy/listCollections-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/listCollections-serverErrors.yml rename to testdata/retryable-reads/legacy/listCollections-serverErrors.yml diff --git a/testdata/retryable-reads/listCollections.json b/testdata/retryable-reads/legacy/listCollections.json similarity index 100% rename from testdata/retryable-reads/listCollections.json rename to testdata/retryable-reads/legacy/listCollections.json diff --git a/testdata/retryable-reads/listCollections.yml b/testdata/retryable-reads/legacy/listCollections.yml similarity index 100% rename from testdata/retryable-reads/listCollections.yml rename to testdata/retryable-reads/legacy/listCollections.yml diff --git a/testdata/retryable-reads/listDatabaseNames-serverErrors.json b/testdata/retryable-reads/legacy/listDatabaseNames-serverErrors.json similarity index 100% rename from testdata/retryable-reads/listDatabaseNames-serverErrors.json rename to testdata/retryable-reads/legacy/listDatabaseNames-serverErrors.json diff --git a/testdata/retryable-reads/listDatabaseNames-serverErrors.yml b/testdata/retryable-reads/legacy/listDatabaseNames-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/listDatabaseNames-serverErrors.yml rename to testdata/retryable-reads/legacy/listDatabaseNames-serverErrors.yml diff --git a/testdata/retryable-reads/listDatabaseNames.json b/testdata/retryable-reads/legacy/listDatabaseNames.json similarity index 100% rename from testdata/retryable-reads/listDatabaseNames.json rename to testdata/retryable-reads/legacy/listDatabaseNames.json diff --git a/testdata/retryable-reads/listDatabaseNames.yml b/testdata/retryable-reads/legacy/listDatabaseNames.yml similarity index 100% rename from testdata/retryable-reads/listDatabaseNames.yml rename to testdata/retryable-reads/legacy/listDatabaseNames.yml diff --git a/testdata/retryable-reads/listDatabaseObjects-serverErrors.json b/testdata/retryable-reads/legacy/listDatabaseObjects-serverErrors.json similarity index 100% rename from testdata/retryable-reads/listDatabaseObjects-serverErrors.json rename to testdata/retryable-reads/legacy/listDatabaseObjects-serverErrors.json diff --git a/testdata/retryable-reads/listDatabaseObjects-serverErrors.yml b/testdata/retryable-reads/legacy/listDatabaseObjects-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/listDatabaseObjects-serverErrors.yml rename to testdata/retryable-reads/legacy/listDatabaseObjects-serverErrors.yml diff --git a/testdata/retryable-reads/listDatabaseObjects.json b/testdata/retryable-reads/legacy/listDatabaseObjects.json similarity index 100% rename from testdata/retryable-reads/listDatabaseObjects.json rename to testdata/retryable-reads/legacy/listDatabaseObjects.json diff --git a/testdata/retryable-reads/listDatabaseObjects.yml b/testdata/retryable-reads/legacy/listDatabaseObjects.yml similarity index 100% rename from testdata/retryable-reads/listDatabaseObjects.yml rename to testdata/retryable-reads/legacy/listDatabaseObjects.yml diff --git a/testdata/retryable-reads/listDatabases-serverErrors.json b/testdata/retryable-reads/legacy/listDatabases-serverErrors.json similarity index 100% rename from testdata/retryable-reads/listDatabases-serverErrors.json rename to testdata/retryable-reads/legacy/listDatabases-serverErrors.json diff --git a/testdata/retryable-reads/listDatabases-serverErrors.yml b/testdata/retryable-reads/legacy/listDatabases-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/listDatabases-serverErrors.yml rename to testdata/retryable-reads/legacy/listDatabases-serverErrors.yml diff --git a/testdata/retryable-reads/listDatabases.json b/testdata/retryable-reads/legacy/listDatabases.json similarity index 100% rename from testdata/retryable-reads/listDatabases.json rename to testdata/retryable-reads/legacy/listDatabases.json diff --git a/testdata/retryable-reads/listDatabases.yml b/testdata/retryable-reads/legacy/listDatabases.yml similarity index 100% rename from testdata/retryable-reads/listDatabases.yml rename to testdata/retryable-reads/legacy/listDatabases.yml diff --git a/testdata/retryable-reads/listIndexNames-serverErrors.json b/testdata/retryable-reads/legacy/listIndexNames-serverErrors.json similarity index 100% rename from testdata/retryable-reads/listIndexNames-serverErrors.json rename to testdata/retryable-reads/legacy/listIndexNames-serverErrors.json diff --git a/testdata/retryable-reads/listIndexNames-serverErrors.yml b/testdata/retryable-reads/legacy/listIndexNames-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/listIndexNames-serverErrors.yml rename to testdata/retryable-reads/legacy/listIndexNames-serverErrors.yml diff --git a/testdata/retryable-reads/listIndexNames.json b/testdata/retryable-reads/legacy/listIndexNames.json similarity index 100% rename from testdata/retryable-reads/listIndexNames.json rename to testdata/retryable-reads/legacy/listIndexNames.json diff --git a/testdata/retryable-reads/listIndexNames.yml b/testdata/retryable-reads/legacy/listIndexNames.yml similarity index 100% rename from testdata/retryable-reads/listIndexNames.yml rename to testdata/retryable-reads/legacy/listIndexNames.yml diff --git a/testdata/retryable-reads/listIndexes-serverErrors.json b/testdata/retryable-reads/legacy/listIndexes-serverErrors.json similarity index 100% rename from testdata/retryable-reads/listIndexes-serverErrors.json rename to testdata/retryable-reads/legacy/listIndexes-serverErrors.json diff --git a/testdata/retryable-reads/listIndexes-serverErrors.yml b/testdata/retryable-reads/legacy/listIndexes-serverErrors.yml similarity index 100% rename from testdata/retryable-reads/listIndexes-serverErrors.yml rename to testdata/retryable-reads/legacy/listIndexes-serverErrors.yml diff --git a/testdata/retryable-reads/listIndexes.json b/testdata/retryable-reads/legacy/listIndexes.json similarity index 100% rename from testdata/retryable-reads/listIndexes.json rename to testdata/retryable-reads/legacy/listIndexes.json diff --git a/testdata/retryable-reads/listIndexes.yml b/testdata/retryable-reads/legacy/listIndexes.yml similarity index 100% rename from testdata/retryable-reads/listIndexes.yml rename to testdata/retryable-reads/legacy/listIndexes.yml diff --git a/testdata/retryable-reads/mapReduce.json b/testdata/retryable-reads/legacy/mapReduce.json similarity index 100% rename from testdata/retryable-reads/mapReduce.json rename to testdata/retryable-reads/legacy/mapReduce.json diff --git a/testdata/retryable-reads/mapReduce.yml b/testdata/retryable-reads/legacy/mapReduce.yml similarity index 100% rename from testdata/retryable-reads/mapReduce.yml rename to testdata/retryable-reads/legacy/mapReduce.yml diff --git a/testdata/retryable-reads/unified/readConcernMajorityNotAvailableYet.json b/testdata/retryable-reads/unified/readConcernMajorityNotAvailableYet.json new file mode 100644 index 0000000000..8aa6a6b5e5 --- /dev/null +++ b/testdata/retryable-reads/unified/readConcernMajorityNotAvailableYet.json @@ -0,0 +1,147 @@ +{ + "description": "ReadConcernMajorityNotAvailableYet is a retryable read", + "schemaVersion": "1.3", + "runOnRequirements": [ + { + "minServerVersion": "4.0", + "topologies": [ + "single", + "replicaset" + ] + }, + { + "minServerVersion": "4.1.7", + "topologies": [ + "sharded", + "load-balanced" + ] + } + ], + "createEntities": [ + { + "client": { + "id": "client0", + "useMultipleMongoses": false, + "observeEvents": [ + "commandStartedEvent" + ] + } + }, + { + "database": { + "id": "database0", + "client": "client0", + "databaseName": "retryable-reads-tests" + } + }, + { + "collection": { + "id": "collection0", + "database": "database0", + "collectionName": "readconcernmajoritynotavailableyet_test" + } + } + ], + "initialData": [ + { + "collectionName": "readconcernmajoritynotavailableyet_test", + "databaseName": "retryable-reads-tests", + "documents": [ + { + "_id": 1, + "x": 11 + }, + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "tests": [ + { + "description": "Find succeeds on second attempt after ReadConcernMajorityNotAvailableYet", + "operations": [ + { + "name": "failPoint", + "object": "testRunner", + "arguments": { + "client": "client0", + "failPoint": { + "configureFailPoint": "failCommand", + "mode": { + "times": 1 + }, + "data": { + "failCommands": [ + "find" + ], + "errorCode": 134 + } + } + } + }, + { + "name": "find", + "arguments": { + "filter": { + "_id": { + "$gt": 1 + } + } + }, + "object": "collection0", + "expectResult": [ + { + "_id": 2, + "x": 22 + }, + { + "_id": 3, + "x": 33 + } + ] + } + ], + "expectEvents": [ + { + "client": "client0", + "events": [ + { + "commandStartedEvent": { + "command": { + "find": "readconcernmajoritynotavailableyet_test", + "filter": { + "_id": { + "$gt": 1 + } + } + }, + "commandName": "find", + "databaseName": "retryable-reads-tests" + } + }, + { + "commandStartedEvent": { + "command": { + "find": "readconcernmajoritynotavailableyet_test", + "filter": { + "_id": { + "$gt": 1 + } + } + }, + "commandName": "find", + "databaseName": "retryable-reads-tests" + } + } + ] + } + ] + } + ] +} diff --git a/testdata/retryable-reads/unified/readConcernMajorityNotAvailableYet.yml b/testdata/retryable-reads/unified/readConcernMajorityNotAvailableYet.yml new file mode 100644 index 0000000000..707a62acd7 --- /dev/null +++ b/testdata/retryable-reads/unified/readConcernMajorityNotAvailableYet.yml @@ -0,0 +1,68 @@ +description: "ReadConcernMajorityNotAvailableYet is a retryable read" + +schemaVersion: "1.3" + +runOnRequirements: + - minServerVersion: "4.0" + topologies: [single, replicaset] + - minServerVersion: "4.1.7" + topologies: [sharded, load-balanced] + +createEntities: + - client: + id: &client0 client0 + # Ensure the `configureFailpoint` and `find` commands are run on the same mongos + useMultipleMongoses: false + observeEvents: [ commandStartedEvent ] + - database: + id: &database0 database0 + client: *client0 + databaseName: &database0Name "retryable-reads-tests" + - collection: + id: &collection0 collection0 + database: *database0 + collectionName: &collection0Name "readconcernmajoritynotavailableyet_test" + +initialData: + - collectionName: *collection0Name + databaseName: *database0Name + documents: + - { _id: 1, x: 11 } + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + +tests: + - description: "Find succeeds on second attempt after ReadConcernMajorityNotAvailableYet" + operations: + - name: failPoint + object: testRunner + arguments: + client: *client0 + failPoint: + configureFailPoint: failCommand + mode: { times: 1 } + data: + failCommands: [ "find" ] + errorCode: 134 # ReadConcernMajorityNotAvailableYet + - name: find + arguments: + filter: { _id: { $gt: 1 } } + object: *collection0 + expectResult: + - { _id: 2, x: 22 } + - { _id: 3, x: 33 } + expectEvents: + - client: *client0 + events: + - commandStartedEvent: + command: + find: *collection0Name + filter: { _id: { $gt: 1 } } + commandName: find + databaseName: *database0Name + - commandStartedEvent: + command: + find: *collection0Name + filter: { _id: { $gt: 1 } } + commandName: find + databaseName: *database0Name diff --git a/x/mongo/driver/errors.go b/x/mongo/driver/errors.go index 61847329f2..f4bd46deb5 100644 --- a/x/mongo/driver/errors.go +++ b/x/mongo/driver/errors.go @@ -25,7 +25,22 @@ import ( const LegacyNotPrimaryErrMsg = "not master" var ( - retryableCodes = []int32{11600, 11602, 10107, 13435, 13436, 189, 91, 7, 6, 89, 9001, 262} + retryableCodes = []int32{ + 6, // HostUnreachable + 7, // HostNotFound + 89, // NetworkTimeout + 91, // ShutdownInProgress + 134, // ReadConcernMajorityNotAvailableYet + 189, // PrimarySteppedDown + 262, // ExceededTimeLimit + 9001, // SocketException + 10107, // NotWritablePrimary + 11600, // InterruptedAtShutdown + 11602, // InterruptedDueToReplStateChange + 13435, // NotPrimaryNoSecondaryOk + 13436, // NotPrimaryOrSecondary + } + nodeIsRecoveringCodes = []int32{11600, 11602, 13436, 189, 91} notPrimaryCodes = []int32{10107, 13435, 10058} nodeIsShuttingDownCodes = []int32{11600, 91}