Skip to content

Commit 89c66a8

Browse files
committed
Revert "CDRIVER-3850 allow URI to accept timeoutMS"
This reverts commit 6bacf92.
1 parent d47bca3 commit 89c66a8

File tree

4 files changed

+325
-453
lines changed

4 files changed

+325
-453
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
========================================== ================================= ================================= ============================================================================================================================================================================================================================================
@@ -194,7 +193,7 @@ MONGOC_URI_MAXPOOLSIZE maxpoolsize The
194193
MONGOC_URI_MINPOOLSIZE minpoolsize Deprecated. This option's behavior does not match its name, and its actual behavior will likely hurt performance.
195194
MONGOC_URI_MAXIDLETIMEMS maxidletimems Not implemented.
196195
MONGOC_URI_WAITQUEUEMULTIPLE waitqueuemultiple Not implemented.
197-
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.
196+
MONGOC_URI_WAITQUEUETIMEOUTMS waitqueuetimeoutms The maximum time to wait for a client to become available from the pool.
198197
========================================== ================================= =========================================================================================================================================================================================================================
199198

200199
.. _mongoc_uri_t_write_concern_options:
@@ -212,7 +211,7 @@ MONGOC_URI_W w Det
212211
* 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.
213212
* 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.
214213
* 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.
215-
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.
214+
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.
216215
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.
217216

218217
* 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 & 45 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
@@ -1132,8 +1130,7 @@ mongoc_uri_apply_options (mongoc_uri_t *uri,
11321130
MONGOC_ERROR_COMMAND,
11331131
MONGOC_ERROR_COMMAND_INVALID_ARG,
11341132
"Failed to set %s to %d",
1135-
canon,
1136-
bval);
1133+
canon, bval);
11371134
return false;
11381135
}
11391136
} else {
@@ -2500,30 +2497,6 @@ mongoc_uri_get_option_as_int32 (const mongoc_uri_t *uri,
25002497
return (int32_t) retval;
25012498
}
25022499

2503-
2504-
static void
2505-
_mongoc_uri_warn_for_bad_int_option_combos (const mongoc_uri_t *uri,
2506-
const char *option)
2507-
{
2508-
/* Warn for deprecated option combinations */
2509-
if (!strcasecmp (option, MONGOC_URI_TIMEOUTMS)) {
2510-
if (mongoc_uri_get_option_as_int64 (uri, MONGOC_URI_WAITQUEUETIMEOUTMS, -1) > 0 ||
2511-
mongoc_uri_get_option_as_int64 (uri, MONGOC_URI_SOCKETTIMEOUTMS, -1) > 0 ||
2512-
mongoc_uri_get_option_as_int64 (uri, MONGOC_URI_WTIMEOUTMS, -1) > 0) {
2513-
MONGOC_WARNING ("Setting a deprecated timeout option %s in combination with timeoutMS", option);
2514-
}
2515-
}
2516-
2517-
if (!strcasecmp (option, MONGOC_URI_WAITQUEUETIMEOUTMS) ||
2518-
!strcasecmp (option, MONGOC_URI_SOCKETTIMEOUTMS) ||
2519-
!strcasecmp (option, MONGOC_URI_WTIMEOUTMS)) {
2520-
if (mongoc_uri_get_option_as_int64 (uri, MONGOC_URI_TIMEOUTMS, -1) > 0) {
2521-
MONGOC_WARNING ("Setting a deprecated timeout option %s in combination with timeoutMS", option);
2522-
}
2523-
}
2524-
}
2525-
2526-
25272500
/*
25282501
*--------------------------------------------------------------------------
25292502
*
@@ -2646,8 +2619,6 @@ _mongoc_uri_set_option_as_int32_with_error (mongoc_uri_t *uri,
26462619
}
26472620
}
26482621

2649-
_mongoc_uri_warn_for_bad_int_option_combos (uri, option);
2650-
26512622
option_lowercase = lowercase_str_new (option);
26522623
if (!bson_append_int32 (&uri->options, option_lowercase, -1, value)) {
26532624
bson_free (option_lowercase);
@@ -2841,16 +2812,6 @@ _mongoc_uri_set_option_as_int64_with_error (mongoc_uri_t *uri,
28412812

28422813
option = mongoc_uri_canonicalize_option (option_orig);
28432814

2844-
/* timeoutMS may not be a negative number. */
2845-
if (!bson_strcasecmp (option, MONGOC_URI_TIMEOUTMS) && value < 0) {
2846-
MONGOC_URI_ERROR (
2847-
error,
2848-
"Invalid \"%s\" of %" PRId64 ": must be a non-negative integer",
2849-
option_orig,
2850-
value);
2851-
return false;
2852-
}
2853-
28542815
if ((options = mongoc_uri_get_options (uri)) &&
28552816
bson_iter_init_find_case (&iter, options, option)) {
28562817
if (BSON_ITER_HOLDS_INT64 (&iter)) {
@@ -2867,8 +2828,6 @@ _mongoc_uri_set_option_as_int64_with_error (mongoc_uri_t *uri,
28672828
}
28682829
}
28692830

2870-
_mongoc_uri_warn_for_bad_int_option_combos (uri, option);
2871-
28722831
option_lowercase = lowercase_str_new (option);
28732832
if (!bson_append_int64 (&uri->options, option_lowercase, -1, value)) {
28742833
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
@@ -61,7 +61,6 @@
6161
#define MONGOC_URI_SLAVEOK "slaveok"
6262
#define MONGOC_URI_SOCKETCHECKINTERVALMS "socketcheckintervalms"
6363
#define MONGOC_URI_SOCKETTIMEOUTMS "sockettimeoutms"
64-
#define MONGOC_URI_TIMEOUTMS "timeoutms"
6564
#define MONGOC_URI_TLS "tls"
6665
#define MONGOC_URI_TLSCERTIFICATEKEYFILE "tlscertificatekeyfile"
6766
#define MONGOC_URI_TLSCERTIFICATEKEYFILEPASSWORD "tlscertificatekeyfilepassword"

0 commit comments

Comments
 (0)