-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Server Programmability
-
SP Prioritized List
A common pattern is to set an IDL string field using an explicit StringData, such as idlObject.setStringField(StringData(something.toString())). This isn't usually needed, though it doesn't cause any major problems right now. However, with SERVER-90167, we'll support setting IDL string fields by move, so passing a StringData instead of an rvalue string will inhibit a move.
I've identified 28 places in non-test code that are likely instances of this pattern. These may not all be instances of the pattern, and most of them won't inhibit a move - some definitely will though (e.g., 1 2 3). Still, we should probably get rid of the StringData conversions here, at least where the thing being converted is a std::string.
src/mongo/client/sasl_aws_client_protocol.cpp: second.setXAmzSecurityToken(boost::optional<StringData>(credentials.sessionToken.value())); src/mongo/client/sasl_oidc_client_conversation.cpp: firstClientRequest.setPrincipalName(StringData(_principalName)); src/mongo/db/auth/privilege.cpp: rsrc.setDb(StringData{_resource.dbNameToMatch().serializeWithoutTenantPrefix_UNSAFE()}); src/mongo/db/catalog/clustered_collection_util.cpp: indexSpec.setName(StringData(clusterKey + "_1")); src/mongo/db/commands/create_command.cpp: reply.setNote(StringData(DEPR_23800)); src/mongo/db/index/columns_access_method.cpp: stateInfo.setFileName(StringData(state.fileName)); src/mongo/db/index/index_access_method.cpp: stateInfo.setFileName(StringData(state.fileName)); src/mongo/db/modules/enterprise/src/streams/exec/checkpoint/local_disk_checkpoint_storage.cpp: metadata.setHostName(StringData{_opts.hostName}); src/mongo/db/modules/enterprise/src/streams/exec/kafka_consumer_operator.cpp: streamMetaSource.setTopic(StringData{_options.topicName}); src/mongo/db/modules/enterprise/src/streams/exec/kafka_consumer_operator.cpp: state.setConsumerGroupId(StringData(_options.consumerGroupId)); src/mongo/db/modules/enterprise/src/streams/exec/kafka_consumer_operator.cpp: streamMetaSource.setTopic(StringData{_options.topicName}); src/mongo/db/modules/enterprise/src/streams/exec/sample_data_source_operator.cpp: sampleDataSpec.setEvent_details(StringData{"Network error"}); src/mongo/db/modules/enterprise/src/streams/management/stream_manager.cpp: stopCommand.setProcessorId(StringData(sp->context->streamProcessorId)); src/mongo/db/modules/enterprise/src/streams/management/stream_manager.cpp: sampleRequest.setName(StringData(name)); src/mongo/db/modules/enterprise/src/streams/management/stream_manager.cpp: statsRequest.setName(StringData(name)); src/mongo/db/pipeline/document_source_internal_convert_bucket_index_stats.cpp: timeseriesOptions.setMetaField(StringData(*bucketSpec.metaField)); src/mongo/db/repl/tenant_migration_donor_service.cpp: commonData.setTenantId(boost::optional<StringData>(_tenantId)); src/mongo/db/repl/tenant_migration_donor_service.cpp: commonData.setTenantId(boost::optional<StringData>(_tenantId)); src/mongo/db/s/analyze_shard_key_cmd_util.cpp: metrics.setNote(StringData(kOrphanDocsWarningMessage)); src/mongo/db/s/config/configsvr_set_cluster_parameter_command.cpp: cid.setSubId(StringData(tenantId ? tenantId->toString() : "")); src/mongo/db/session/logical_session_id_helpers.cpp: lsr.setUser(StringData(user.value()->getName().getDisplayName())); src/mongo/db/session/logical_session_id_helpers.cpp: lsr.setUser(StringData(user.value()->getName().getDisplayName())); src/mongo/db/ttl.cpp: collModIndex.setName(StringData{indexName}); src/mongo/rpc/write_concern_error_detail.cpp: wce.setCodeName(boost::optional<StringData>(_status.codeString())); src/mongo/s/commands/cluster_query_without_shard_key_cmd.cpp: res.setShardId(boost::optional<mongo::StringData>(response.shardId)); src/mongo/s/commands/cluster_query_without_shard_key_cmd.cpp: res.setShardId(boost::optional<mongo::StringData>(nextResponse.getShardId())); src/mongo/s/commands/cluster_validate_db_metadata_cmd.cpp: apiVersionError.setShard(StringData(shardRes.shardId.toString())); src/mongo/util/net/ssl_parameters.cpp: currentValue.setAttributes(StringData{sslGlobalParams.clusterAuthX509OverrideAttributes});
- is related to
-
SERVER-90167 Allow setting string fields by without copying in IDL-generated structs
-
- Closed
-