Skip to content

Commit cfec8bd

Browse files
committed
Implement Retryable Reads
GODRIVER-624 Change-Id: I7a82d23ac449b8f8595ca3df9cfb7b671ec25efb
1 parent 58da8e6 commit cfec8bd

File tree

126 files changed

+24458
-221
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+24458
-221
lines changed

Makefile

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,27 @@ errcheck:
5555

5656
.PHONY: test
5757
test:
58-
go test $(BUILD_TAGS) -timeout $(TEST_TIMEOUT)s $(TEST_PKGS)
58+
for TEST in $(TEST_PKGS) ; do \
59+
go test $(BUILD_TAGS) -timeout $(TEST_TIMEOUT)s $$TEST ; \
60+
done
5961

6062
.PHONY: test-cover
6163
test-cover:
62-
go test $(BUILD_TAGS) -timeout $(TEST_TIMEOUT)s -cover $(COVER_ARGS) $(TEST_PKGS)
64+
for TEST in $(TEST_PKGS) ; do \
65+
go test $(BUILD_TAGS) -timeout $(TEST_TIMEOUT)s -cover $(COVER_ARGS) $$TEST ; \
66+
done
6367

6468
.PHONY: test-race
6569
test-race:
66-
go test $(BUILD_TAGS) -timeout $(TEST_TIMEOUT)s -race $(TEST_PKGS)
70+
for TEST in $(TEST_PKGS) ; do \
71+
go test $(BUILD_TAGS) -timeout $(TEST_TIMEOUT)s -race $(COVER_ARGS) $$TEST ; \
72+
done
6773

6874
.PHONY: test-short
6975
test-short:
70-
go test $(BUILD_TAGS) -timeout $(TEST_TIMEOUT)s -short $(TEST_PKGS)
76+
for TEST in $(TEST_PKGS) ; do \
77+
go test $(BUILD_TAGS) -timeout $(TEST_TIMEOUT)s -short $(COVER_ARGS) $$TEST ; \
78+
done
7179

7280
.PHONY: update-bson-corpus-tests
7381
update-bson-corpus-tests:
@@ -109,7 +117,9 @@ vet:
109117
# Evergreen specific targets
110118
.PHONY: evg-test
111119
evg-test:
112-
go test $(BUILD_TAGS) -v -timeout $(TEST_TIMEOUT)s $(TEST_PKGS) > test.suite
120+
for TEST in $(TEST_PKGS) ; do \
121+
go test $(BUILD_TAGS) -v -timeout $(TEST_TIMEOUT)s $$TEST >> test.suite ; \
122+
done
113123

114124
.PHONY: evg-test-auth
115125
evg-test-auth:
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"runOn": [
3+
{
4+
"minServerVersion": "4.2.0"
5+
}
6+
],
7+
"database_name": "retryable-reads-tests",
8+
"collection_name": "coll",
9+
"data": [
10+
{
11+
"_id": 1,
12+
"x": 11
13+
},
14+
{
15+
"_id": 2,
16+
"x": 22
17+
},
18+
{
19+
"_id": 3,
20+
"x": 33
21+
}
22+
],
23+
"tests": [
24+
{
25+
"description": "Aggregate with $merge does not retry",
26+
"failPoint": {
27+
"configureFailPoint": "failCommand",
28+
"mode": {
29+
"times": 1
30+
},
31+
"data": {
32+
"failCommands": [
33+
"aggregate"
34+
],
35+
"closeConnection": true
36+
}
37+
},
38+
"operations": [
39+
{
40+
"object": "collection",
41+
"name": "aggregate",
42+
"arguments": {
43+
"pipeline": [
44+
{
45+
"$match": {
46+
"_id": {
47+
"$gt": 1
48+
}
49+
}
50+
},
51+
{
52+
"$sort": {
53+
"x": 1
54+
}
55+
},
56+
{
57+
"$merge": {
58+
"into": "output-collection"
59+
}
60+
}
61+
]
62+
},
63+
"error": true
64+
}
65+
],
66+
"expectations": [
67+
{
68+
"command_started_event": {
69+
"command": {
70+
"aggregate": "coll",
71+
"pipeline": [
72+
{
73+
"$match": {
74+
"_id": {
75+
"$gt": 1
76+
}
77+
}
78+
},
79+
{
80+
"$sort": {
81+
"x": 1
82+
}
83+
},
84+
{
85+
"$merge": {
86+
"into": "output-collection"
87+
}
88+
}
89+
]
90+
},
91+
"command_name": "aggregate",
92+
"database_name": "retryable-reads-tests"
93+
}
94+
}
95+
]
96+
}
97+
]
98+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
runOn:
2+
-
3+
minServerVersion: "4.2.0"
4+
5+
database_name: &database_name "retryable-reads-tests"
6+
collection_name: &collection_name "coll"
7+
8+
data:
9+
- {_id: 1, x: 11}
10+
- {_id: 2, x: 22}
11+
- {_id: 3, x: 33}
12+
13+
tests:
14+
-
15+
description: "Aggregate with $merge does not retry"
16+
failPoint:
17+
configureFailPoint: failCommand
18+
mode: { times: 1 }
19+
data:
20+
failCommands: [aggregate]
21+
closeConnection: true
22+
operations:
23+
-
24+
object: collection
25+
name: aggregate
26+
arguments:
27+
pipeline: &pipeline
28+
- $match: {_id: {$gt: 1}}
29+
- $sort: {x: 1}
30+
- $merge: { into: "output-collection" }
31+
error: true
32+
expectations:
33+
-
34+
command_started_event:
35+
command:
36+
aggregate: *collection_name
37+
pipeline: *pipeline
38+
command_name: aggregate
39+
database_name: *database_name

0 commit comments

Comments
 (0)