Skip to content

Commit 08d3f68

Browse files
committed
CDRIVER-3535 implement streamable ismaster
- add backtrace print to evergreen timeout - add support for awaitable ismaster to mock server - move server monitor into separate file and model after spec pseudo code - fix connection count checks in stepdown tests (resolving CDRIVER-3569)
1 parent 344e1ef commit 08d3f68

38 files changed

+2539
-803
lines changed

.evergreen/compile-unix.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ else
256256
}
257257
fi
258258

259+
export MONGOC_TEST_SERVER_LOG=stdout
260+
259261
# Write stderr to error.log and to console. Turn off tracing to avoid spurious
260262
# log messages that CHECK_LOG considers failures.
261263
mkfifo pipe || true

.evergreen/compile-windows.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,6 @@ if [ "$SKIP_MOCK_TESTS" = "ON" ]; then
132132
exit 0
133133
fi
134134

135+
export MONGOC_TEST_SERVER_LOG=stdout
136+
135137
"$TEST_PATH" --no-fork -d -F test-results.json

.evergreen/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,8 @@ post:
726726
- func: upload mo artifacts
727727
- func: upload test results
728728
- func: cleanup
729+
timeout:
730+
- func: backtrace
729731
tasks:
730732
- name: check-headers
731733
commands:

.evergreen/debug-core-evergreen.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
#!/usr/bin/env bash
22

3+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
4+
5+
case "$OS" in
6+
cygwin*)
7+
echo "debug-core-evergreen.sh is not supported on Windows"
8+
exit 0
9+
;;
10+
esac
11+
312
echo "Debugging core files"
413

514
shopt -s nullglob
615
for i in *.core; do
716
echo $i
817
echo "backtrace full" | gdb -q ./src/libmongoc/test-libmongoc $i
918
done
19+
20+
# If there is still a test-libmongoc process running (perhaps due to
21+
# deadlock, or very slow test) attach a debugger and print stacks.
22+
TEST_LIBMONGOC_PID="$(pgrep test-libmongoc)"
23+
if [ -n "$TEST_LIBMONGOC_PID" ]; then
24+
echo "test-libmongoc processes still running with PID=$TEST_LIBMONGOC_PID"
25+
echo "backtrace full" | gdb -q -p $TEST_LIBMONGOC_PID
26+
kill $TEST_LIBMONGOC_PID
27+
fi

.evergreen/run-tests.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ check_mongocryptd() {
8787
fi
8888
}
8989

90+
export MONGOC_TEST_MONITORING_VERBOSE=on
91+
9092
case "$OS" in
9193
cygwin*)
9294
export PATH=$PATH:/cygdrive/c/mongodb/bin:/cygdrive/c/libmongocrypt/bin

build/generate-evergreen-config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@
6161
OD([('func', 'upload test results')]),
6262
OD([('func', 'cleanup')]),
6363
]),
64+
('timeout', [
65+
OD([('func', 'backtrace')])
66+
]),
6467
('tasks', all_tasks),
6568
('buildvariants', all_variants),
6669
])

src/libmongoc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,7 @@ set (SOURCES ${SOURCES}
531531
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-server-description.c
532532
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-server-stream.c
533533
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-client-session.c
534+
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-server-monitor.c
534535
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-set.c
535536
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-socket.c
536537
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-stream-buffered.c

src/libmongoc/doc/mongoc_client_pool_set_apm_callbacks.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Synopsis
1515
1616
Register a set of callbacks to receive Application Performance Monitoring events.
1717

18-
The callbacks are copied by the pool and may be destroyed at any time after.
18+
The ``callbacks`` are copied by the pool and may be destroyed at any time after. If a ``context`` is passed, it is the application's responsibility to ensure ``context`` remains valid for the lifetime of the pool.
1919

2020
Parameters
2121
----------

src/libmongoc/doc/mongoc_client_set_apm_callbacks.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Synopsis
1515
1616
Register a set of callbacks to receive Application Performance Monitoring events.
1717

18-
The callbacks are copied by the client and may be destroyed at any time after.
18+
The ``callbacks`` are copied by the client and may be destroyed at any time after. If a ``context`` is passed, it is the application's responsibility to ensure ``context`` remains valid for the lifetime of the client.
1919

2020
Parameters
2121
----------

src/libmongoc/doc/mongoc_client_set_stream_initiator.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Synopsis
1515
1616
The :symbol:`mongoc_client_set_stream_initiator()` function shall associate a given :symbol:`mongoc_client_t` with a new stream initiator. This will completely replace the default transport (buffered TCP, possibly with TLS). The ``initiator`` should fulfill the :symbol:`mongoc_stream_t` contract. ``user_data`` is passed through to the ``initiator`` callback and may be used for whatever run time customization is necessary.
1717

18+
If ``user_data`` is passed, it is the application's responsibility to ensure ``user_data`` remains valid for the lifetime of the client.
19+
1820
Parameters
1921
----------
2022

0 commit comments

Comments
 (0)