Skip to content

Commit e760cd7

Browse files
authored
CDRIVER-5946 remove deprecated index management API (#1957)
* remove deprecated index functions * update tests to use non-deprecated alternatives ** add a skip to inheritance test due to CDRIVER-5945 * remove unused index types * disable tasks testing r4.0.0 of C++ driver ** r4.0.0 refers to removed symbols.
1 parent 2ea7749 commit e760cd7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+158
-1228
lines changed

Diff for: .evergreen/config_generator/components/earthly.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"Valid options for the SASL configuration parameter"
3939
TLSOption = Literal["OpenSSL", "off"]
4040
"Options for the TLS backend configuration parameter (AKA 'ENABLE_SSL')"
41-
CxxVersion = Literal["r4.0.0", "none"]
41+
CxxVersion = Literal["none"] # TODO: Once CXX-3103 is released, add latest C++ release tag.
4242
"C++ driver refs that are under CI test"
4343

4444
# A separator character, since we cannot use whitespace
@@ -146,10 +146,6 @@ def task_filter(env: EarthlyVariant, conf: Configuration) -> bool:
146146
case e, (_sasl, _tls, cxx) if re.match(r"^Ubuntu 16|^CentOS 7", e.display_name):
147147
# Only build if C++ driver is test is disabled
148148
return cxx == "none"
149-
# Skip other platforms where the C++ driver test is disabled, since they would be
150-
# redundant
151-
case _, (_sasl, _tls, "none"):
152-
return False
153149
# Anything else: Allow it to run:
154150
case _:
155151
return True

Diff for: .evergreen/generated_configs/tasks.yml

+4-164
Original file line numberDiff line numberDiff line change
@@ -1103,7 +1103,7 @@ tasks:
11031103
- debian10-large
11041104
- debian11-large
11051105
- amazon2
1106-
tags: [earthly, pr-merge-gate, centos7-clang, centos7-gcc, u16-clang, u16-gcc]
1106+
tags: [earthly, pr-merge-gate, alpine3.16-clang, alpine3.16-gcc, alpine3.17-clang, alpine3.17-gcc, alpine3.18-clang, alpine3.18-gcc, alpine3.19-clang, alpine3.19-gcc, archlinux-clang, archlinux-gcc, centos7-clang, centos7-gcc, u16-clang, u16-gcc, u18-clang, u18-gcc, u20-clang, u20-gcc, u22-clang, u22-gcc]
11071107
commands:
11081108
- command: subprocess.exec
11091109
type: setup
@@ -1137,53 +1137,13 @@ tasks:
11371137
- --test_mongocxx_ref=none
11381138
- --env=${MONGOC_EARTHLY_ENV}
11391139
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
1140-
- name: "check:sasl=Cyrus\_\u2022\_tls=OpenSSL\_\u2022\_test_mongocxx_ref=r4.0.0"
1141-
run_on:
1142-
- ubuntu2204-large
1143-
- debian10-large
1144-
- debian11-large
1145-
- amazon2
1146-
tags: [earthly, pr-merge-gate, alpine3.16-clang, alpine3.16-gcc, alpine3.17-clang, alpine3.17-gcc, alpine3.18-clang, alpine3.18-gcc, alpine3.19-clang, alpine3.19-gcc, archlinux-clang, archlinux-gcc, u18-clang, u18-gcc, u20-clang, u20-gcc, u22-clang, u22-gcc]
1147-
commands:
1148-
- command: subprocess.exec
1149-
type: setup
1150-
params:
1151-
binary: bash
1152-
args:
1153-
- -c
1154-
- docker login -u "${artifactory_username}" --password-stdin artifactory.corp.mongodb.com <<<"${artifactory_password}"
1155-
- command: subprocess.exec
1156-
type: setup
1157-
params:
1158-
binary: ./tools/earthly.sh
1159-
working_dir: mongoc
1160-
args:
1161-
- +env-warmup
1162-
- --sasl=Cyrus
1163-
- --tls=OpenSSL
1164-
- --test_mongocxx_ref=r4.0.0
1165-
- --env=${MONGOC_EARTHLY_ENV}
1166-
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
1167-
- command: subprocess.exec
1168-
type: test
1169-
params:
1170-
binary: ./tools/earthly.sh
1171-
working_dir: mongoc
1172-
args:
1173-
- +run
1174-
- --targets=test-example test-cxx-driver
1175-
- --sasl=Cyrus
1176-
- --tls=OpenSSL
1177-
- --test_mongocxx_ref=r4.0.0
1178-
- --env=${MONGOC_EARTHLY_ENV}
1179-
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
11801140
- name: "check:sasl=Cyrus\_\u2022\_tls=off\_\u2022\_test_mongocxx_ref=none"
11811141
run_on:
11821142
- ubuntu2204-large
11831143
- debian10-large
11841144
- debian11-large
11851145
- amazon2
1186-
tags: [earthly, pr-merge-gate, centos7-clang, centos7-gcc, u16-clang, u16-gcc]
1146+
tags: [earthly, pr-merge-gate, alpine3.16-clang, alpine3.16-gcc, alpine3.17-clang, alpine3.17-gcc, alpine3.18-clang, alpine3.18-gcc, alpine3.19-clang, alpine3.19-gcc, archlinux-clang, archlinux-gcc, centos7-clang, centos7-gcc, u16-clang, u16-gcc, u18-clang, u18-gcc, u20-clang, u20-gcc, u22-clang, u22-gcc]
11871147
commands:
11881148
- command: subprocess.exec
11891149
type: setup
@@ -1217,53 +1177,13 @@ tasks:
12171177
- --test_mongocxx_ref=none
12181178
- --env=${MONGOC_EARTHLY_ENV}
12191179
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
1220-
- name: "check:sasl=Cyrus\_\u2022\_tls=off\_\u2022\_test_mongocxx_ref=r4.0.0"
1221-
run_on:
1222-
- ubuntu2204-large
1223-
- debian10-large
1224-
- debian11-large
1225-
- amazon2
1226-
tags: [earthly, pr-merge-gate, alpine3.16-clang, alpine3.16-gcc, alpine3.17-clang, alpine3.17-gcc, alpine3.18-clang, alpine3.18-gcc, alpine3.19-clang, alpine3.19-gcc, archlinux-clang, archlinux-gcc, u18-clang, u18-gcc, u20-clang, u20-gcc, u22-clang, u22-gcc]
1227-
commands:
1228-
- command: subprocess.exec
1229-
type: setup
1230-
params:
1231-
binary: bash
1232-
args:
1233-
- -c
1234-
- docker login -u "${artifactory_username}" --password-stdin artifactory.corp.mongodb.com <<<"${artifactory_password}"
1235-
- command: subprocess.exec
1236-
type: setup
1237-
params:
1238-
binary: ./tools/earthly.sh
1239-
working_dir: mongoc
1240-
args:
1241-
- +env-warmup
1242-
- --sasl=Cyrus
1243-
- --tls=off
1244-
- --test_mongocxx_ref=r4.0.0
1245-
- --env=${MONGOC_EARTHLY_ENV}
1246-
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
1247-
- command: subprocess.exec
1248-
type: test
1249-
params:
1250-
binary: ./tools/earthly.sh
1251-
working_dir: mongoc
1252-
args:
1253-
- +run
1254-
- --targets=test-example test-cxx-driver
1255-
- --sasl=Cyrus
1256-
- --tls=off
1257-
- --test_mongocxx_ref=r4.0.0
1258-
- --env=${MONGOC_EARTHLY_ENV}
1259-
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
12601180
- name: "check:sasl=off\_\u2022\_tls=OpenSSL\_\u2022\_test_mongocxx_ref=none"
12611181
run_on:
12621182
- ubuntu2204-large
12631183
- debian10-large
12641184
- debian11-large
12651185
- amazon2
1266-
tags: [earthly, pr-merge-gate, centos7-clang, centos7-gcc, u16-clang, u16-gcc]
1186+
tags: [earthly, pr-merge-gate, alpine3.16-clang, alpine3.16-gcc, alpine3.17-clang, alpine3.17-gcc, alpine3.18-clang, alpine3.18-gcc, alpine3.19-clang, alpine3.19-gcc, archlinux-clang, archlinux-gcc, centos7-clang, centos7-gcc, u16-clang, u16-gcc, u18-clang, u18-gcc, u20-clang, u20-gcc, u22-clang, u22-gcc]
12671187
commands:
12681188
- command: subprocess.exec
12691189
type: setup
@@ -1297,53 +1217,13 @@ tasks:
12971217
- --test_mongocxx_ref=none
12981218
- --env=${MONGOC_EARTHLY_ENV}
12991219
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
1300-
- name: "check:sasl=off\_\u2022\_tls=OpenSSL\_\u2022\_test_mongocxx_ref=r4.0.0"
1301-
run_on:
1302-
- ubuntu2204-large
1303-
- debian10-large
1304-
- debian11-large
1305-
- amazon2
1306-
tags: [earthly, pr-merge-gate, alpine3.16-clang, alpine3.16-gcc, alpine3.17-clang, alpine3.17-gcc, alpine3.18-clang, alpine3.18-gcc, alpine3.19-clang, alpine3.19-gcc, archlinux-clang, archlinux-gcc, u18-clang, u18-gcc, u20-clang, u20-gcc, u22-clang, u22-gcc]
1307-
commands:
1308-
- command: subprocess.exec
1309-
type: setup
1310-
params:
1311-
binary: bash
1312-
args:
1313-
- -c
1314-
- docker login -u "${artifactory_username}" --password-stdin artifactory.corp.mongodb.com <<<"${artifactory_password}"
1315-
- command: subprocess.exec
1316-
type: setup
1317-
params:
1318-
binary: ./tools/earthly.sh
1319-
working_dir: mongoc
1320-
args:
1321-
- +env-warmup
1322-
- --sasl=off
1323-
- --tls=OpenSSL
1324-
- --test_mongocxx_ref=r4.0.0
1325-
- --env=${MONGOC_EARTHLY_ENV}
1326-
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
1327-
- command: subprocess.exec
1328-
type: test
1329-
params:
1330-
binary: ./tools/earthly.sh
1331-
working_dir: mongoc
1332-
args:
1333-
- +run
1334-
- --targets=test-example test-cxx-driver
1335-
- --sasl=off
1336-
- --tls=OpenSSL
1337-
- --test_mongocxx_ref=r4.0.0
1338-
- --env=${MONGOC_EARTHLY_ENV}
1339-
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
13401220
- name: "check:sasl=off\_\u2022\_tls=off\_\u2022\_test_mongocxx_ref=none"
13411221
run_on:
13421222
- ubuntu2204-large
13431223
- debian10-large
13441224
- debian11-large
13451225
- amazon2
1346-
tags: [earthly, pr-merge-gate, centos7-clang, centos7-gcc, u16-clang, u16-gcc]
1226+
tags: [earthly, pr-merge-gate, alpine3.16-clang, alpine3.16-gcc, alpine3.17-clang, alpine3.17-gcc, alpine3.18-clang, alpine3.18-gcc, alpine3.19-clang, alpine3.19-gcc, archlinux-clang, archlinux-gcc, centos7-clang, centos7-gcc, u16-clang, u16-gcc, u18-clang, u18-gcc, u20-clang, u20-gcc, u22-clang, u22-gcc]
13471227
commands:
13481228
- command: subprocess.exec
13491229
type: setup
@@ -1377,46 +1257,6 @@ tasks:
13771257
- --test_mongocxx_ref=none
13781258
- --env=${MONGOC_EARTHLY_ENV}
13791259
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
1380-
- name: "check:sasl=off\_\u2022\_tls=off\_\u2022\_test_mongocxx_ref=r4.0.0"
1381-
run_on:
1382-
- ubuntu2204-large
1383-
- debian10-large
1384-
- debian11-large
1385-
- amazon2
1386-
tags: [earthly, pr-merge-gate, alpine3.16-clang, alpine3.16-gcc, alpine3.17-clang, alpine3.17-gcc, alpine3.18-clang, alpine3.18-gcc, alpine3.19-clang, alpine3.19-gcc, archlinux-clang, archlinux-gcc, u18-clang, u18-gcc, u20-clang, u20-gcc, u22-clang, u22-gcc]
1387-
commands:
1388-
- command: subprocess.exec
1389-
type: setup
1390-
params:
1391-
binary: bash
1392-
args:
1393-
- -c
1394-
- docker login -u "${artifactory_username}" --password-stdin artifactory.corp.mongodb.com <<<"${artifactory_password}"
1395-
- command: subprocess.exec
1396-
type: setup
1397-
params:
1398-
binary: ./tools/earthly.sh
1399-
working_dir: mongoc
1400-
args:
1401-
- +env-warmup
1402-
- --sasl=off
1403-
- --tls=off
1404-
- --test_mongocxx_ref=r4.0.0
1405-
- --env=${MONGOC_EARTHLY_ENV}
1406-
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
1407-
- command: subprocess.exec
1408-
type: test
1409-
params:
1410-
binary: ./tools/earthly.sh
1411-
working_dir: mongoc
1412-
args:
1413-
- +run
1414-
- --targets=test-example test-cxx-driver
1415-
- --sasl=off
1416-
- --tls=off
1417-
- --test_mongocxx_ref=r4.0.0
1418-
- --env=${MONGOC_EARTHLY_ENV}
1419-
- --c_compiler=${MONGOC_EARTHLY_C_COMPILER}
14201260
- name: clang-format
14211261
tags: [clang-format]
14221262
commands:

Diff for: NEWS

+5-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ Unreleased (2.0.0)
5151
* `mongoc_bulk_operation_delete_one` is removed. Use `mongoc_bulk_operation_remove_one` instead.
5252
* `mongoc_bulk_operation_get_hint` is removed. Use `mongoc_bulk_operation_get_server_id` instead.
5353
* `mongoc_bulk_operation_set_hint` is removed. Use `mongoc_bulk_operation_set_server_id` instead.
54-
* Deprecated `mongoc_apm_command_*_get_server_connection_id` functions are removed. Use `mongoc_apm_command_*_get_server_connection_id_int64` instead.
54+
* Deprecated index management API has been removed:
55+
* `mongoc_collection_create_index_with_opts`, `mongoc_collection_create_index`, and `mongoc_collection_ensure_index` are removed. Use `mongoc_collection_create_indexes_with_opts` instead.
56+
* `mongoc_index_opt_t`, `mongoc_index_opt_geo_t` `mongoc_index_opt_wt_t` are removed. Pass options using `bson_t` to `mongoc_collection_create_indexes_with_opts` instead.
57+
* `mongoc_collection_find_indexes` is removed. Use `mongoc_collection_find_indexes_with_opts` instead.
58+
* See [MongoDB documentation](https://www.mongodb.com/docs/languages/c/c-driver/current/indexes/) for working with indexes.
5559

5660
### Forwarding headers (`#include <bson.h>` and `#include <mongoc.h>`)
5761

Diff for: build/generate-future-functions.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
typedef("mongoc_iovec_ptr", "mongoc_iovec_t *"),
8888
typedef("mongoc_server_stream_ptr", "mongoc_server_stream_t *"),
8989
typedef("mongoc_query_flags_t", None),
90-
typedef("const_mongoc_index_opt_t", "const mongoc_index_opt_t *"),
9190
typedef("mongoc_server_description_ptr", "mongoc_server_description_t *"),
9291
typedef("mongoc_ss_optype_t", None),
9392
typedef("mongoc_topology_ptr", "mongoc_topology_t *"),
@@ -104,6 +103,7 @@
104103
"const mongoc_write_concern_t *"),
105104
typedef("const_mongoc_ss_log_context_ptr",
106105
"const mongoc_ss_log_context_t *"),
106+
typedef("mongoc_index_model_t_ptr_const_ptr", "mongoc_index_model_t *const *")
107107
]
108108

109109
type_list = [T.name for T in typedef_list]
@@ -237,10 +237,10 @@
237237
param("bson_error_ptr", "error")]),
238238

239239
future_function("bool",
240-
"mongoc_collection_create_index_with_opts",
240+
"mongoc_collection_create_indexes_with_opts",
241241
[param("mongoc_collection_ptr", "collection"),
242-
param("const_bson_ptr", "keys"),
243-
param("const_mongoc_index_opt_t", "opt"),
242+
param("mongoc_index_model_t_ptr_const_ptr", "models"),
243+
param("size_t", "num_models"),
244244
param("const_bson_ptr", "opts"),
245245
param("bson_ptr", "reply"),
246246
param("bson_error_ptr", "error")]),

Diff for: src/libmongoc/CMakeLists.txt

-2
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,6 @@ set (MONGOC_SOURCES
587587
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-handshake.c
588588
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-host-list.c
589589
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-http.c
590-
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-index.c
591590
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-init.c
592591
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-interrupt.c
593592
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-list.c
@@ -713,7 +712,6 @@ set (HEADERS
713712
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-handshake.h
714713
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-host-list.h
715714
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-init.h
716-
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-index.h
717715
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-iovec.h
718716
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-log.h
719717
${PROJECT_SOURCE_DIR}/src/mongoc/mongoc-macros.h

Diff for: src/libmongoc/doc/api.rst

-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ API Reference
3737
mongoc_gridfs_bucket_t
3838
mongoc_gridfs_t
3939
mongoc_host_list_t
40-
mongoc_index_opt_geo_t
41-
mongoc_index_opt_t
42-
mongoc_index_opt_wt_t
4340
mongoc_insert_flags_t
4441
mongoc_iovec_t
4542
mongoc_optional_t

Diff for: src/libmongoc/doc/errors.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Many C Driver functions report errors by returning ``false`` or -1 and filling o
5757
+-----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
5858
| ``MONGOC_ERROR_SASL`` | A SASL error code. | ``man sasl_errors`` for a list of codes. |
5959
+-----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
60-
| ``MONGOC_ERROR_BSON`` | ``MONGOC_ERROR_BSON_INVALID`` | You passed an invalid or oversized BSON document as a parameter, or called :symbol:`mongoc_collection_create_index` with invalid keys, or the server reply was corrupt. |
60+
| ``MONGOC_ERROR_BSON`` | ``MONGOC_ERROR_BSON_INVALID`` | You passed an invalid or oversized BSON document as a parameter or the server reply was corrupt. |
6161
+-----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
6262
| ``MONGOC_ERROR_NAMESPACE`` | ``MONGOC_ERROR_NAMESPACE_INVALID`` | You tried to create a collection with an invalid name. |
6363
+-----------------------------------------+----------------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Diff for: src/libmongoc/doc/mongoc_collection_create_index.rst

-28
This file was deleted.

0 commit comments

Comments
 (0)