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

migrate experimental-memory-mlock flag to memory-mlock #19282

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

jmao-dd
Copy link
Contributor

@jmao-dd jmao-dd commented Jan 27, 2025

@k8s-ci-robot
Copy link

Hi @jmao-dd. Thanks for your PR.

I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link

codecov bot commented Jan 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.87%. Comparing base (dd60559) to head (0795f6b).
Report is 37 commits behind head on main.

Additional details and impacted files
Files with missing lines Coverage Δ
server/config/config.go 80.23% <ø> (ø)
server/embed/config.go 79.72% <100.00%> (+0.06%) ⬆️
server/embed/etcd.go 76.79% <100.00%> (+0.30%) ⬆️
server/etcdmain/config.go 73.49% <100.00%> (+0.32%) ⬆️
server/storage/backend.go 80.00% <100.00%> (+7.27%) ⬆️

... and 24 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #19282      +/-   ##
==========================================
+ Coverage   68.84%   68.87%   +0.03%     
==========================================
  Files         420      420              
  Lines       35693    35705      +12     
==========================================
+ Hits        24573    24592      +19     
+ Misses       9698     9693       -5     
+ Partials     1422     1420       -2     

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd60559...0795f6b. Read the comment docs.

@ahrtr
Copy link
Member

ahrtr commented Jan 27, 2025

/ok-to-test

@@ -75,6 +75,8 @@ Member:
Maximum number of snapshot files to retain (0 is unlimited). Deprecated in v3.6 and will be decommissioned in v3.7.
--max-wals '` + strconv.Itoa(embed.DefaultMaxWALs) + `'
Maximum number of wal files to retain (0 is unlimited).
--memory-mlock
Enable to enforce etcd pages (in particular bbolt) to stay in RAM.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure if Member is the right category to add --memory-mlock. Please let me know if it isn't.

@jmao-dd jmao-dd force-pushed the jmao/19061-migrate-mlock3 branch from 544b275 to e658c89 Compare January 29, 2025 02:20
@jmao-dd
Copy link
Contributor Author

jmao-dd commented Jan 29, 2025

/retest

Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks

@ahrtr
Copy link
Member

ahrtr commented Jan 31, 2025

fs.BoolVar(&cfg.ExperimentalMemoryMlock, "experimental-memory-mlock", cfg.ExperimentalMemoryMlock, "Enable to enforce etcd pages (in particular bbolt) to stay in RAM.")
fs.BoolVar(&cfg.MemoryMlock, "memory-mlock", cfg.MemoryMlock, "Enable to enforce etcd pages (in particular bbolt) to stay in RAM.")
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add the new flag to experimentalNonBoolFlagMigrationMap and rename the map to experimentalFlagMigrationMap?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is actually a boolean flag. Based on the name I think experimentalNonBoolFlagMigrationMap is supposed to track non-boolean flags and alert users that they specified contradicting values. For boolean flags if either flag is set it is treated as set, otherwise as unset?

Copy link
Contributor

Choose a reason for hiding this comment

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

the user might specify conflicting values like --experimental-memory-mlock=true --memory-mlock=false, which could be rare but should still be disallowed.
experimentalNonBoolFlagMigrationMap just makes sure the two flags are not both explicitly set. You can rename it to experimentalFlagMigrationMap

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. I can change to forbid both being set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you!


cfgFromCmdLine, errFromCmdLine, cfgFromFile, errFromFile := generateCfgsFromFileAndCmdLine(t, yc, cmdLineArgs)

if errFromCmdLine != nil || errFromFile != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a test case to show you can not set both flags at the same time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Similar as above, I think we want to allow both boolean flags to be set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

Signed-off-by: Jiayin Mao <jiayin.mao@datadoghq.com>
@jmao-dd jmao-dd force-pushed the jmao/19061-migrate-mlock3 branch from f541d78 to 0795f6b Compare February 1, 2025 22:58
@jmao-dd
Copy link
Contributor Author

jmao-dd commented Feb 2, 2025

/retest

Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM

fs.BoolVar(&cfg.ExperimentalMemoryMlock, "experimental-memory-mlock", cfg.ExperimentalMemoryMlock, "Enable to enforce etcd pages (in particular bbolt) to stay in RAM.")
fs.BoolVar(&cfg.MemoryMlock, "memory-mlock", cfg.MemoryMlock, "Enable to enforce etcd pages (in particular bbolt) to stay in RAM.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you!

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahrtr, fuweid, jmao-dd, siyuanfoundation

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@siyuanfoundation
Copy link
Contributor

/lgtm

Thank you @jmao-dd !

@ahrtr ahrtr merged commit 3cc3daf into etcd-io:main Feb 3, 2025
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

migrate experimental-memory-mlock flag to feature gate
5 participants