Skip to content

Commit 679ae70

Browse files
Enable disk usage for aggregations on MongoDB (#197)
1 parent 99bb237 commit 679ae70

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

.github/workflows/pr-test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,25 @@ jobs:
2121
args: jacocoTestReport
2222

2323
- name: Upload coverage to Codecov
24-
uses: codecov/codecov-action@v3
24+
uses: codecov/codecov-action@v4
2525
with:
2626
name: unit test reports
2727
fail_ci_if_error: true
2828
flags: unit
29+
token: ${{ secrets.CODECOV_TOKEN }}
2930

3031
- name: Integration test
3132
uses: hypertrace/github-actions/gradle@main
3233
with:
3334
args: jacocoIntegrationTestReport
3435

3536
- name: Upload coverage to Codecov
36-
uses: codecov/codecov-action@v3
37+
uses: codecov/codecov-action@v4
3738
with:
3839
name: integration test reports
3940
fail_ci_if_error: true
4041
flags: integration
42+
token: ${{ secrets.CODECOV_TOKEN }}
4143

4244
- name: copy test reports
4345
uses: hypertrace/github-actions/gradle@main

document-store/src/main/java/org/hypertrace/core/documentstore/mongo/query/MongoQueryExecutor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ public MongoCursor<BasicDBObject> aggregate(final Query originalQuery) {
130130
logPipeline(pipeline);
131131

132132
try {
133-
final AggregateIterable<BasicDBObject> iterable = collection.aggregate(pipeline);
133+
final AggregateIterable<BasicDBObject> iterable =
134+
collection.aggregate(pipeline).allowDiskUse(true);
134135
return iterable.cursor();
135136
} catch (final MongoCommandException e) {
136137
log.error("Execution failed for query: {}. Aggregation Pipeline: {}", query, pipeline);

document-store/src/test/java/org/hypertrace/core/documentstore/mongo/MongoCollectionTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ void testBulkUpdateWithFilter() throws IOException {
378378

379379
when(mockClock.millis()).thenReturn(1660721309000L);
380380
when(collection.aggregate(anyList())).thenReturn(mockIterable);
381+
when(mockIterable.allowDiskUse(true)).thenReturn(mockIterable);
381382
when(mockIterable.cursor()).thenReturn(mockCursor);
382383
when(mockCursor.hasNext()).thenReturn(true).thenReturn(false);
383384
when(mockCursor.next()).thenReturn(response);

document-store/src/test/java/org/hypertrace/core/documentstore/mongo/MongoQueryExecutorTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ void setUp() {
9696
when(iterable.sort(any(BasicDBObject.class))).thenReturn(iterable);
9797

9898
when(iterable.cursor()).thenReturn(cursor);
99+
when(aggIterable.allowDiskUse(true)).thenReturn(aggIterable);
99100
when(aggIterable.cursor()).thenReturn(cursor);
100101
}
101102

@@ -522,6 +523,7 @@ private void testAggregation(Query query, final String filePath)
522523
executor.aggregate(query);
523524
verify(collection).getNamespace();
524525
verify(collection).aggregate(pipeline);
526+
verify(aggIterable).allowDiskUse(true);
525527
verify(aggIterable).cursor();
526528
}
527529

0 commit comments

Comments
 (0)