diff options
author | Suganthi Mani <suganthi.mani@mongodb.com> | 2021-10-25 15:18:29 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-10-25 19:57:20 +0000 |
commit | 99f4696e26b26a33902067d2f3b71b053413b4ab (patch) | |
tree | 189b99e9f8a3fabde271c691d7217c7fd7d86624 /buildscripts | |
parent | d95d9dd1e6a34f7af53feee1e55fbc74ae6e32b3 (diff) | |
download | mongo-99f4696e26b26a33902067d2f3b71b053413b4ab.tar.gz |
Revert "SERVER-59495 Donor and recipient tenant migration state machines will persist the migration protocol info and tenantId info will be an empty string for 'Merge' protcol."
This reverts commit 56a5ddbf5a2ba92169e81ec24f9387c5fe1c0931.
Diffstat (limited to 'buildscripts')
-rw-r--r-- | buildscripts/idl/idl/generator.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/buildscripts/idl/idl/generator.py b/buildscripts/idl/idl/generator.py index c806d016296..51569af4d4f 100644 --- a/buildscripts/idl/idl/generator.py +++ b/buildscripts/idl/idl/generator.py @@ -230,15 +230,24 @@ class _FastFieldUsageChecker(_FieldUsageCheckerBase): with writer.IndentedScopedBlock(self._writer, 'if (MONGO_unlikely(!usedFields.all())) {', '}'): for field in self._fields: - # If 'field.default' is true, the fields(members) gets initialized with the default - # value in the class definition. So, it's ok to skip setting the field to - # default value here. - if (not field.optional) and (not field.ignore) and (not field.default): + if (not field.optional) and (not field.ignore): with writer.IndentedScopedBlock( self._writer, 'if (!usedFields[%s]) {' % (_gen_field_usage_constant(field)), '}'): - self._writer.write_line( - 'ctxt.throwMissingField(%s);' % (_get_field_constant_name(field))) + if field.default: + default_value = (field.type.cpp_type + "::" + field.default) \ + if field.type.is_enum else field.default + if field.chained_struct_field: + self._writer.write_line( + '%s.%s(%s);' % + (_get_field_member_name(field.chained_struct_field), + _get_field_member_setter_name(field), default_value)) + else: + self._writer.write_line( + '%s = %s;' % (_get_field_member_name(field), default_value)) + else: + self._writer.write_line( + 'ctxt.throwMissingField(%s);' % (_get_field_constant_name(field))) class _SlowFieldUsageChecker(_FastFieldUsageChecker): |