@@ -2794,6 +2794,7 @@ _mongoc_cluster_select_server_id (mongoc_client_session_t *cs,
27942794 mongoc_ss_optype_t optype ,
27952795 const mongoc_read_prefs_t * read_prefs ,
27962796 bool * must_use_primary ,
2797+ const mongoc_deprioritized_servers_t * ds ,
27972798 bson_error_t * error )
27982799{
27992800 BSON_ASSERT (cs || true);
@@ -2808,14 +2809,14 @@ _mongoc_cluster_select_server_id (mongoc_client_session_t *cs,
28082809 server_id = cs -> server_id ;
28092810 if (!server_id ) {
28102811 server_id = mongoc_topology_select_server_id (
2811- topology , optype , read_prefs , must_use_primary , error );
2812+ topology , optype , read_prefs , must_use_primary , ds , error );
28122813 if (server_id ) {
28132814 _mongoc_client_session_pin (cs , server_id );
28142815 }
28152816 }
28162817 } else {
28172818 server_id = mongoc_topology_select_server_id (
2818- topology , optype , read_prefs , must_use_primary , error );
2819+ topology , optype , read_prefs , must_use_primary , ds , error );
28192820 /* Transactions Spec: Additionally, any non-transaction operation using a
28202821 * pinned ClientSession MUST unpin the session and the operation MUST
28212822 * perform normal server selection. */
@@ -2851,6 +2852,7 @@ _mongoc_cluster_stream_for_optype (mongoc_cluster_t *cluster,
28512852 const mongoc_read_prefs_t * read_prefs ,
28522853 mongoc_client_session_t * cs ,
28532854 bool is_retryable ,
2855+ const mongoc_deprioritized_servers_t * ds ,
28542856 bson_t * reply ,
28552857 bson_error_t * error )
28562858{
@@ -2870,7 +2872,7 @@ _mongoc_cluster_stream_for_optype (mongoc_cluster_t *cluster,
28702872 BSON_ASSERT (cluster );
28712873
28722874 server_id = _mongoc_cluster_select_server_id (
2873- cs , topology , optype , read_prefs , & must_use_primary , error );
2875+ cs , topology , optype , read_prefs , & must_use_primary , ds , error );
28742876
28752877 if (!server_id ) {
28762878 if (reply ) {
@@ -2883,7 +2885,7 @@ _mongoc_cluster_stream_for_optype (mongoc_cluster_t *cluster,
28832885 if (!mongoc_cluster_check_interval (cluster , server_id )) {
28842886 /* Server Selection Spec: try once more */
28852887 server_id = _mongoc_cluster_select_server_id (
2886- cs , topology , optype , read_prefs , & must_use_primary , error );
2888+ cs , topology , optype , read_prefs , & must_use_primary , ds , error );
28872889
28882890 if (!server_id ) {
28892891 if (reply ) {
@@ -2967,6 +2969,7 @@ mongoc_server_stream_t *
29672969mongoc_cluster_stream_for_reads (mongoc_cluster_t * cluster ,
29682970 const mongoc_read_prefs_t * read_prefs ,
29692971 mongoc_client_session_t * cs ,
2972+ const mongoc_deprioritized_servers_t * ds ,
29702973 bson_t * reply ,
29712974 bson_error_t * error )
29722975{
@@ -2979,21 +2982,28 @@ mongoc_cluster_stream_for_reads (mongoc_cluster_t *cluster,
29792982 const bool is_retryable = mongoc_uri_get_option_as_bool (
29802983 cluster -> uri , MONGOC_URI_RETRYREADS , MONGOC_DEFAULT_RETRYREADS );
29812984
2982- return _mongoc_cluster_stream_for_optype (
2983- cluster , MONGOC_SS_READ , prefs_override , cs , is_retryable , reply , error );
2985+ return _mongoc_cluster_stream_for_optype (cluster ,
2986+ MONGOC_SS_READ ,
2987+ prefs_override ,
2988+ cs ,
2989+ is_retryable ,
2990+ ds ,
2991+ reply ,
2992+ error );
29842993}
29852994
29862995mongoc_server_stream_t *
29872996mongoc_cluster_stream_for_writes (mongoc_cluster_t * cluster ,
29882997 mongoc_client_session_t * cs ,
2998+ const mongoc_deprioritized_servers_t * ds ,
29892999 bson_t * reply ,
29903000 bson_error_t * error )
29913001{
29923002 const bool is_retryable = mongoc_uri_get_option_as_bool (
29933003 cluster -> uri , MONGOC_URI_RETRYWRITES , MONGOC_DEFAULT_RETRYWRITES );
29943004
29953005 return _mongoc_cluster_stream_for_optype (
2996- cluster , MONGOC_SS_WRITE , NULL , cs , is_retryable , reply , error );
3006+ cluster , MONGOC_SS_WRITE , NULL , cs , is_retryable , ds , reply , error );
29973007}
29983008
29993009mongoc_server_stream_t *
@@ -3015,6 +3025,7 @@ mongoc_cluster_stream_for_aggr_with_write (
30153025 prefs_override ,
30163026 cs ,
30173027 is_retryable ,
3028+ NULL ,
30183029 reply ,
30193030 error );
30203031}
0 commit comments