Skip to content

Commit 68d0948

Browse files
committed
Revert "CDRIVER-3850 allow URI to accept timeoutMS"
This reverts commit 6bacf92.
1 parent 90dcfba commit 68d0948

File tree

4 files changed

+325
-460
lines changed

4 files changed

+325
-460
lines changed

src/libmongoc/doc/mongoc_uri_t.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ MONGOC_URI_APPNAME appname Emp
9797
MONGOC_URI_TLS tls Empty (not set, same as false) {true|false}, indicating if TLS must be used. (See also :symbol:`mongoc_client_set_ssl_opts` and :symbol:`mongoc_client_pool_set_ssl_opts`.)
9898
MONGOC_URI_COMPRESSORS compressors Empty (no compressors) Comma separated list of compressors, if any, to use to compress the wire protocol messages. Snappy, zlib, and zstd are optional build time dependencies, and enable the "snappy", "zlib", and "zstd" values respectively.
9999
MONGOC_URI_CONNECTTIMEOUTMS connecttimeoutms 10,000 ms (10 seconds) This setting applies to new server connections. It is also used as the socket timeout for server discovery and monitoring operations.
100-
MONGOC_URI_SOCKETTIMEOUTMS sockettimeoutms 300,000 ms (5 minutes) Deprecated in favor of MONGOC_URI_TIMEOUTMS. The time in milliseconds to attempt to send or receive on a socket before the attempt times out.
101-
MONGOC_URI_TIMEOUTMS timeoutms Empty (no timeout) The time limit for the full execution of an operation.
100+
MONGOC_URI_SOCKETTIMEOUTMS sockettimeoutms 300,000 ms (5 minutes) The time in milliseconds to attempt to send or receive on a socket before the attempt times out.
102101
MONGOC_URI_REPLICASET replicaset Empty (no replicaset) The name of the Replica Set that the driver should connect to.
103102
MONGOC_URI_ZLIBCOMPRESSIONLEVEL zlibcompressionlevel -1 When the MONGOC_URI_COMPRESSORS includes "zlib" this options configures the zlib compression level, when the zlib compressor is used to compress client data.
104103
MONGOC_URI_LOADBALANCED loadbalanced false If true, this indicates the driver is connecting to a MongoDB cluster behind a load balancer.
@@ -195,7 +194,7 @@ MONGOC_URI_MAXPOOLSIZE maxpoolsize The
195194
MONGOC_URI_MINPOOLSIZE minpoolsize Deprecated. This option's behavior does not match its name, and its actual behavior will likely hurt performance.
196195
MONGOC_URI_MAXIDLETIMEMS maxidletimems Not implemented.
197196
MONGOC_URI_WAITQUEUEMULTIPLE waitqueuemultiple Not implemented.
198-
MONGOC_URI_WAITQUEUETIMEOUTMS waitqueuetimeoutms Deprecated in favor of MONGOC_URI_TIMEOUTMS. The maximum time to wait for a client to become available from the pool.
197+
MONGOC_URI_WAITQUEUETIMEOUTMS waitqueuetimeoutms The maximum time to wait for a client to become available from the pool.
199198
========================================== ================================= =========================================================================================================================================================================================================================
200199

201200
.. _mongoc_uri_t_write_concern_options:
@@ -213,7 +212,7 @@ MONGOC_URI_W w Det
213212
* majority = For replica sets, if you specify the special majority value to w option, write operations will only return successfully after a majority of the configured replica set members have acknowledged the write operation.
214213
* n = For replica sets, if you specify a number n greater than 1, operations with this write concern return only after n members of the set have acknowledged the write. If you set n to a number that is greater than the number of available set members or members that hold data, MongoDB will wait, potentially indefinitely, for these members to become available.
215214
* tags = For replica sets, you can specify a tag set to require that all members of the set that have these tags configured return confirmation of the write operation.
216-
MONGOC_URI_WTIMEOUTMS wtimeoutms Deprecated in favor of MONGOC_URI_TIMEOUTMS. The time in milliseconds to wait for replication to succeed, as specified in the w option, before timing out. When wtimeoutMS is 0, write operations will never time out.
215+
MONGOC_URI_WTIMEOUTMS wtimeoutms The time in milliseconds to wait for replication to succeed, as specified in the w option, before timing out. When wtimeoutMS is 0, write operations will never time out.
217216
MONGOC_URI_JOURNAL journal Controls whether write operations will wait until the mongod acknowledges the write operations and commits the data to the on disk journal.
218217

219218
* true = Enables journal commit acknowledgement write concern. Equivalent to specifying the getLastError command with the j option enabled.

src/libmongoc/src/mongoc/mongoc-uri.c

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -727,23 +727,21 @@ mongoc_uri_option_is_int32 (const char *key)
727727
!strcasecmp (key, MONGOC_URI_HEARTBEATFREQUENCYMS) ||
728728
!strcasecmp (key, MONGOC_URI_SERVERSELECTIONTIMEOUTMS) ||
729729
!strcasecmp (key, MONGOC_URI_SOCKETCHECKINTERVALMS) ||
730+
!strcasecmp (key, MONGOC_URI_SOCKETTIMEOUTMS) ||
730731
!strcasecmp (key, MONGOC_URI_LOCALTHRESHOLDMS) ||
731732
!strcasecmp (key, MONGOC_URI_MAXPOOLSIZE) ||
732733
!strcasecmp (key, MONGOC_URI_MAXSTALENESSSECONDS) ||
733734
!strcasecmp (key, MONGOC_URI_MINPOOLSIZE) ||
734735
!strcasecmp (key, MONGOC_URI_MAXIDLETIMEMS) ||
735736
!strcasecmp (key, MONGOC_URI_WAITQUEUEMULTIPLE) ||
736-
!strcasecmp (key, MONGOC_URI_ZLIBCOMPRESSIONLEVEL) ||
737-
/* deprecated options */
738737
!strcasecmp (key, MONGOC_URI_WAITQUEUETIMEOUTMS) ||
739-
!strcasecmp (key, MONGOC_URI_SOCKETTIMEOUTMS);
738+
!strcasecmp (key, MONGOC_URI_ZLIBCOMPRESSIONLEVEL);
740739
}
741740

742741
bool
743742
mongoc_uri_option_is_int64 (const char *key)
744743
{
745-
return !strcasecmp (key, MONGOC_URI_WTIMEOUTMS) ||
746-
!strcasecmp (key, MONGOC_URI_TIMEOUTMS);
744+
return !strcasecmp (key, MONGOC_URI_WTIMEOUTMS);
747745
}
748746

749747
bool
@@ -1134,8 +1132,7 @@ mongoc_uri_apply_options (mongoc_uri_t *uri,
11341132
MONGOC_ERROR_COMMAND,
11351133
MONGOC_ERROR_COMMAND_INVALID_ARG,
11361134
"Failed to set %s to %d",
1137-
canon,
1138-
bval);
1135+
canon, bval);
11391136
return false;
11401137
}
11411138
} else {
@@ -2509,36 +2506,6 @@ mongoc_uri_get_option_as_int32 (const mongoc_uri_t *uri,
25092506
return (int32_t) retval;
25102507
}
25112508

2512-
2513-
static void
2514-
_mongoc_uri_warn_for_bad_int_option_combos (const mongoc_uri_t *uri,
2515-
const char *option)
2516-
{
2517-
/* Warn for deprecated option combinations */
2518-
if (!strcasecmp (option, MONGOC_URI_TIMEOUTMS)) {
2519-
if (mongoc_uri_get_option_as_int64 (
2520-
uri, MONGOC_URI_WAITQUEUETIMEOUTMS, -1) > 0 ||
2521-
mongoc_uri_get_option_as_int64 (uri, MONGOC_URI_SOCKETTIMEOUTMS, -1) >
2522-
0 ||
2523-
mongoc_uri_get_option_as_int64 (uri, MONGOC_URI_WTIMEOUTMS, -1) > 0) {
2524-
MONGOC_WARNING ("Setting a deprecated timeout option %s in "
2525-
"combination with timeoutMS",
2526-
option);
2527-
}
2528-
}
2529-
2530-
if (!strcasecmp (option, MONGOC_URI_WAITQUEUETIMEOUTMS) ||
2531-
!strcasecmp (option, MONGOC_URI_SOCKETTIMEOUTMS) ||
2532-
!strcasecmp (option, MONGOC_URI_WTIMEOUTMS)) {
2533-
if (mongoc_uri_get_option_as_int64 (uri, MONGOC_URI_TIMEOUTMS, -1) > 0) {
2534-
MONGOC_WARNING ("Setting a deprecated timeout option %s in "
2535-
"combination with timeoutMS",
2536-
option);
2537-
}
2538-
}
2539-
}
2540-
2541-
25422509
/*
25432510
*--------------------------------------------------------------------------
25442511
*
@@ -2660,9 +2627,6 @@ _mongoc_uri_set_option_as_int32_with_error (mongoc_uri_t *uri,
26602627
return false;
26612628
}
26622629
}
2663-
2664-
_mongoc_uri_warn_for_bad_int_option_combos (uri, option);
2665-
26662630
option_lowercase = lowercase_str_new (option);
26672631
if (!bson_append_int32 (&uri->options, option_lowercase, -1, value)) {
26682632
bson_free (option_lowercase);
@@ -2856,16 +2820,6 @@ _mongoc_uri_set_option_as_int64_with_error (mongoc_uri_t *uri,
28562820

28572821
option = mongoc_uri_canonicalize_option (option_orig);
28582822

2859-
/* timeoutMS may not be a negative number. */
2860-
if (!bson_strcasecmp (option, MONGOC_URI_TIMEOUTMS) && value < 0) {
2861-
MONGOC_URI_ERROR (error,
2862-
"Invalid \"%s\" of %" PRId64
2863-
": must be a non-negative integer",
2864-
option_orig,
2865-
value);
2866-
return false;
2867-
}
2868-
28692823
if ((options = mongoc_uri_get_options (uri)) &&
28702824
bson_iter_init_find_case (&iter, options, option)) {
28712825
if (BSON_ITER_HOLDS_INT64 (&iter)) {
@@ -2882,8 +2836,6 @@ _mongoc_uri_set_option_as_int64_with_error (mongoc_uri_t *uri,
28822836
}
28832837
}
28842838

2885-
_mongoc_uri_warn_for_bad_int_option_combos (uri, option);
2886-
28872839
option_lowercase = lowercase_str_new (option);
28882840
if (!bson_append_int64 (&uri->options, option_lowercase, -1, value)) {
28892841
bson_free (option_lowercase);

src/libmongoc/src/mongoc/mongoc-uri.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
#define MONGOC_URI_SLAVEOK "slaveok"
6363
#define MONGOC_URI_SOCKETCHECKINTERVALMS "socketcheckintervalms"
6464
#define MONGOC_URI_SOCKETTIMEOUTMS "sockettimeoutms"
65-
#define MONGOC_URI_TIMEOUTMS "timeoutms"
6665
#define MONGOC_URI_TLS "tls"
6766
#define MONGOC_URI_TLSCERTIFICATEKEYFILE "tlscertificatekeyfile"
6867
#define MONGOC_URI_TLSCERTIFICATEKEYFILEPASSWORD "tlscertificatekeyfilepassword"

0 commit comments

Comments
 (0)