[SERVER-83378] IDL Compiler Should Generate Constant for Cluster Server Parameter Names Created: 16/Nov/23  Updated: 21/Nov/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Brett Nawrocki Assignee: Backlog - Service Architecture
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Service Arch
Participants:

 Description   

Right now the IDL generator hardcodes the parameter name when creating the IDLServerParameterWithStorage type. For example, this cluster parameter will generate the following block:

TenantIdMap<PauseMigrationsDuringMultiUpdatesParam> pauseMigrationsDuringMultiUpdates;
MONGO_SERVER_PARAMETER_REGISTER(idl_93f9b7ae669be332db86ad17ee9a278d1404cd21)(InitializerContext*) {
    /**
     * Cluster parameter determining if chunk migrations should be prevented while updateMany or deleteMany operations are ongoing.
     */
    [[maybe_unused]] auto* scp_0 = ([]() -> ServerParameter* {
        auto* ret = makeIDLServerParameterWithStorage<ServerParameterType::kClusterWide>("pauseMigrationsDuringMultiUpdates", pauseMigrationsDuringMultiUpdates);
        return ret;
    })();
 
}

And it will generate the following constants:

    static constexpr auto k_idFieldName = "_id"_sd;
    static constexpr auto kClusterParameterTimeFieldName = "clusterParameterTime"_sd;
    static constexpr auto kClusterServerParameterFieldName = "ClusterServerParameter"_sd;
    static constexpr auto kEnabledFieldName = "enabled"_sd;

It would be nice if the "pauseMigrationsDuringMultiUpdates" string literal was also defined as a constant. Right now we have to hardcode these values elsewhere if we want to reference cluster server parameter names.

The same issue might also affect ordinary (non-cluster) server parameters as well.


Generated at Thu Feb 08 06:52:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.