diff options
author | Ted Tuckman <ted.tuckman@mongodb.com> | 2022-03-02 22:20:32 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-03-02 23:11:24 +0000 |
commit | f25675cc8ea9d89672ce063f49dbdaa39e63ce1b (patch) | |
tree | b1867e1b1e3db4dc5083da673bd62aa4cc218767 /buildscripts/idl | |
parent | 27ce39ba637159ae0be6e7734b1d7f114af7141c (diff) | |
download | mongo-f25675cc8ea9d89672ce063f49dbdaa39e63ce1b.tar.gz |
SERVER-62535 Allow sharded aggregation to return two cursors
Diffstat (limited to 'buildscripts/idl')
-rw-r--r-- | buildscripts/idl/idl/ast.py | 1 | ||||
-rw-r--r-- | buildscripts/idl/idl/binder.py | 1 | ||||
-rw-r--r-- | buildscripts/idl/idl/generator.py | 3 | ||||
-rw-r--r-- | buildscripts/idl/idl/parser.py | 1 | ||||
-rw-r--r-- | buildscripts/idl/idl/syntax.py | 1 | ||||
-rw-r--r-- | buildscripts/idl/idl_check_compatibility.py | 12 | ||||
-rw-r--r-- | buildscripts/idl/tests/test_parser.py | 2 |
7 files changed, 19 insertions, 2 deletions
diff --git a/buildscripts/idl/idl/ast.py b/buildscripts/idl/idl/ast.py index 1098cb606d6..5e6958a17c6 100644 --- a/buildscripts/idl/idl/ast.py +++ b/buildscripts/idl/idl/ast.py @@ -143,6 +143,7 @@ class Struct(common.SourceLocation): self.fields = [] # type: List[Field] self.allow_global_collection_name = False # type: bool self.non_const_getter = False # type: bool + self.cpp_validator_func = None # type: str super(Struct, self).__init__(file_name, line, column) diff --git a/buildscripts/idl/idl/binder.py b/buildscripts/idl/idl/binder.py index 0ef5eb966e8..14a4c23a3bb 100644 --- a/buildscripts/idl/idl/binder.py +++ b/buildscripts/idl/idl/binder.py @@ -266,6 +266,7 @@ def _bind_struct_common(ctxt, parsed_spec, struct, ast_struct): ast_struct.immutable = struct.immutable ast_struct.inline_chained_structs = struct.inline_chained_structs ast_struct.generate_comparison_operators = struct.generate_comparison_operators + ast_struct.cpp_validator_func = struct.cpp_validator_func ast_struct.cpp_name = struct.cpp_name or struct.name ast_struct.qualified_cpp_name = _get_struct_qualified_cpp_name(struct) ast_struct.allow_global_collection_name = struct.allow_global_collection_name diff --git a/buildscripts/idl/idl/generator.py b/buildscripts/idl/idl/generator.py index ff9da001069..08a3caecaf8 100644 --- a/buildscripts/idl/idl/generator.py +++ b/buildscripts/idl/idl/generator.py @@ -1784,6 +1784,9 @@ class _CppSourceFileWriter(_CppFileWriterBase): field_usage_check.add_final_checks() self._writer.write_empty_line() + if struct.cpp_validator_func is not None: + self._writer.write_line(struct.cpp_validator_func + "(this);") + self._gen_command_deserializer(struct, "bsonObject") def gen_op_msg_request_deserializer_methods(self, struct): diff --git a/buildscripts/idl/idl/parser.py b/buildscripts/idl/idl/parser.py index d624b4f4473..f7a133783fd 100644 --- a/buildscripts/idl/idl/parser.py +++ b/buildscripts/idl/idl/parser.py @@ -526,6 +526,7 @@ def _parse_struct(ctxt, spec, name, node): "immutable": _RuleDesc('bool_scalar'), "generate_comparison_operators": _RuleDesc("bool_scalar"), "non_const_getter": _RuleDesc('bool_scalar'), + "cpp_validator_func": _RuleDesc('scalar'), }) # PyLint has difficulty with some iterables: https://github.com/PyCQA/pylint/issues/3105 diff --git a/buildscripts/idl/idl/syntax.py b/buildscripts/idl/idl/syntax.py index 69be6288cbe..89af355cca4 100644 --- a/buildscripts/idl/idl/syntax.py +++ b/buildscripts/idl/idl/syntax.py @@ -529,6 +529,7 @@ class Struct(common.SourceLocation): self.fields = None # type: List[Field] self.allow_global_collection_name = False # type: bool self.non_const_getter = False # type: bool + self.cpp_validator_func = None # type: str # Command only property self.cpp_name = None # type: str diff --git a/buildscripts/idl/idl_check_compatibility.py b/buildscripts/idl/idl_check_compatibility.py index 256339ca07c..0cb6a7e25f4 100644 --- a/buildscripts/idl/idl_check_compatibility.py +++ b/buildscripts/idl/idl_check_compatibility.py @@ -166,6 +166,14 @@ IGNORE_UNSTABLE_LIST: List[str] = [ # visible. This is part of the listIndexes output when executed against system.bucket.* # collections, which users should avoid doing. 'listIndexes-reply-originalSpec', + # The 'vars' field was introduced to facilitate communication between mongot and mongod and is + # not user visible. + 'find-reply-vars', + 'aggregate-reply-vars', + # The 'cursor' field is now optional in a reply, as inter-node communication in aggregation + # can return one or more cursors. Multiple cursors are covered under the 'cursors' field. + 'find-reply-cursor', + 'aggregate-reply-cursor', ] SKIPPED_FILES = ["unittest.idl"] @@ -499,8 +507,8 @@ def check_reply_field(ctxt: IDLCompatibilityContext, old_field: syntax.Field, and old_field_type.name == "optionalBool") new_field_optional = new_field.optional or (new_field_type and new_field_type.name == "optionalBool") - if not old_field.unstable: - field_name: str = cmd_name + "-reply-" + new_field.name + field_name: str = cmd_name + "-reply-" + new_field.name + if not old_field.unstable and field_name not in IGNORE_UNSTABLE_LIST: if new_field.unstable and field_name not in IGNORE_UNSTABLE_LIST: ctxt.add_new_reply_field_unstable_error(cmd_name, new_field.name, new_idl_file_path) if new_field_optional and not old_field_optional: diff --git a/buildscripts/idl/tests/test_parser.py b/buildscripts/idl/tests/test_parser.py index 1439d58c383..8fc760caf13 100644 --- a/buildscripts/idl/tests/test_parser.py +++ b/buildscripts/idl/tests/test_parser.py @@ -286,6 +286,7 @@ class TestParser(testcase.IDLTestcase): immutable: true inline_chained_structs: true generate_comparison_operators: true + cpp_validator_func: funcName fields: foo: bar """)) @@ -300,6 +301,7 @@ class TestParser(testcase.IDLTestcase): immutable: false inline_chained_structs: false generate_comparison_operators: false + cpp_validator_func: funcName fields: foo: bar """)) |