Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start using and adding default properties #2146

Merged
merged 6 commits into from
May 10, 2024

Conversation

externl
Copy link
Member

@externl externl commented May 9, 2024

This PR starts the process of updating the code to use default properties. I specifically focused on C++ and primarily on functions that used getProperty(AsXXX)WithDefault. I also replaced many calls to getProperty where we were fetching an Ice property or relying on the default of "" or 0.

So, not all properties have defaults set yet. I set the defaults with the following logic:

  • If we documented that the property had a default, e.g. 0, 100, Random. then I used that. If the property had no documented default, or if we documented that the default relies on other properties, the os, etc. then I did not set any explicit default value.

There is still more to do after this:

  • Set defaults that are currently missing.
  • Update C# and Java

@externl externl added this to the 3.8.0 milestone May 9, 2024
Copy link
Member

@bernardnormier bernardnormier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start!

<property name="ACM.Client" deprecated="true"/>
<property name="ACM.Server" deprecated="true"/>
<property name="ACM" class="acm"/>
<property name="ACM.Client" class="acm"/>
<property name="ACM.Server" class="acm"/>
<property name="Admin" class="objectadapter" />
<property name="Admin.DelayCreation" />
<property name="Admin.DelayCreation" default="0" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Admin.Enabled, I would add a comment about the default, something like:

<!-- default is computed using ... -->

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for all other Admin (and more) without a specified default.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should start documenting this XML file too heavily. It's too hard to keep in sync with the docs.

<property name="Admin.Logger.Properties" />
<property name="Admin.ServerId" />
<property name="BackgroundLocatorCacheUpdates"/>
<property name="BackgroundLocatorCacheUpdates" default="0" />
<property name="BatchAutoFlush" deprecated="true"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default is 0 (false), right?

Should we actually eliminate deprecated properties in a follow-up PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which property are you referring to?

<property name="Default.SourceAddress" />
<property name="Default.Timeout" />
<property name="Default.Timeout" default="60000" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a comment: TODO: remove

<property name="ChangeUser" />
<property name="ClassGraphDepthMax" />
<property name="ClassGraphDepthMax" default="100" />
<property name="ClientAccessPolicyProtocol" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove ClientAccessPolicyProtocol.

<property name="ClientAccessPolicyProtocol" />
<property name="Compression.Level" />
<property name="Compression.Level" default="1" />
<property name="Config" />
<property name="Connection" class="connection"/>
<property name="ConsoleListener" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default for ConsoleListener is undocumented. It's 1 in the code (C# only).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened an issue to fix the docs

<property name="Registry.RequireNodeCertCN" />
<property name="Registry.RequireReplicaCertCN" />
<property name="Registry.Server" class="objectadapter" />
<property name="Registry.SessionFilters" />
<property name="Registry.SessionFilters" default="0" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all the Trace below, the default is not 0?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, I haven't gotten to properties that we don't read plainly.
For instance grepping for Node.Trace.Activator doesn't show anything.

❯ rg -F Node.Trace.Activator
config/PropertyNames.xml
504:        <property name="Node.Trace.Activator" />

scripts/IceGridUtil.py
131:            "IceGrid.Node.Trace.Activator": 0,

java/src/Ice/src/main/java/com/zeroc/IceInternal/PropertyNames.java
810:    new Property("IceGrid.Node.Trace.Activator", false, "", false, null),

csharp/src/Ice/Internal/PropertyNames.cs
784:         new(@"IceGrid.Node.Trace.Activator", false, "", false, null),

cpp/config/icegridnode.cfg
58:IceGrid.Node.Trace.Activator=3

cpp/src/Ice/PropertyNames.cpp
802:    IceInternal::Property("IceGrid.Node.Trace.Activator", false, "", false, nullptr),

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const_cast<int&>(activator) = properties->getPropertyAsInt(keyBase + activatorCat);

@@ -301,64 +301,64 @@ generated from the section label.
<class name="mx" prefix-only="false">
<suffix name="GroupBy" />
<suffix name="Map" />
<suffix name="RetainDetached" />
<suffix name="RetainDetached" default="10" />
<suffix name="Accept" />
<suffix name="Reject" />
</class>

<section name="Ice">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no default for the ThreadPool properties above?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are, I just haven't gotten to them yet. IIRC they don't read them "regularly". Will look closer at the ones that are currently unset in a follow-up PR.

@@ -842,7 +842,7 @@ Glacier2::SessionFactoryHelper::createInitData()
// plug-in has already been setup we don't want to override the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems I forgot to remove this, when moving SSL transport into the core.

@externl externl merged commit b983a02 into zeroc-ice:main May 10, 2024
15 of 16 checks passed
@externl externl deleted the use-getIceProperty branch May 10, 2024 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants