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

Require C11 _Atomics #490

Merged
merged 8 commits into from
May 26, 2024
Merged

Conversation

adetunjii
Copy link
Contributor

@adetunjii adetunjii commented May 12, 2024

  • Replaces custom atomics logic with C11 default atomics logic.
  • Drops "atomicvar_api" field from server info

Closes #485

@madolson madolson requested a review from zuiderkwast May 12, 2024 16:29
Copy link

codecov bot commented May 13, 2024

Codecov Report

Attention: Patch coverage is 76.86567% with 31 lines in your changes are missing coverage. Please review.

Project coverage is 70.17%. Comparing base (1c55f3c) to head (6a73d02).

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable     #490      +/-   ##
============================================
- Coverage     70.19%   70.17%   -0.02%     
============================================
  Files           109      109              
  Lines         59905    59883      -22     
============================================
- Hits          42050    42024      -26     
- Misses        17855    17859       +4     
Files Coverage Δ
src/db.c 88.27% <ø> (ø)
src/evict.c 97.34% <ø> (ø)
src/functions.c 95.58% <ø> (ø)
src/rdb.c 75.83% <100.00%> (+0.38%) ⬆️
src/replication.c 87.14% <100.00%> (ø)
src/threads_mngr.c 95.65% <100.00%> (-0.10%) ⬇️
src/zmalloc.c 84.64% <100.00%> (-0.07%) ⬇️
src/module.c 9.65% <50.00%> (+<0.01%) ⬆️
src/aof.c 80.05% <80.00%> (-0.02%) ⬇️
src/networking.c 85.21% <81.81%> (+0.21%) ⬆️
... and 4 more

... and 10 files with indirect coverage changes

src/module.c Outdated Show resolved Hide resolved
Copy link
Contributor

@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

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

Looks good so far.

I think we can also wait for another changes which is in progress. It's is a change for I/O threads which will probably use atomic variables a lot.

My idea is that we replace all atomic{Get,Set,Incr} and also delete atomicvar.h in one PR just before Valkey 8 release candidate 1, when no new features will be added. Then, if some users have a problem when testing the release candidate, we can revert it before we release 8.0.

@madolson What do you think?

@madolson
Copy link
Member

@zuiderkwast I guess i would prefer we do the C11 migration now. Then anyone who is building from unstable will be able to start relying on the new improvements. I would rather find out sooner that someone might still have build issues.

Copy link
Member

@aiven-sal aiven-sal left a comment

Choose a reason for hiding this comment

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

You need to remove

#include "atomicvar.h"

and replace
"atomicvar_api:%s\r\n", REDIS_ATOMIC_API,
with something meaningful (I'm not sure what that would be).
And then you can remove atomicvar.h completely.

src/bio.c Show resolved Hide resolved
@zuiderkwast
Copy link
Contributor

zuiderkwast commented May 14, 2024

and replace

"atomicvar_api:%s\r\n", REDIS_ATOMIC_API,

with something meaningful (I'm not sure what that would be).

"c11-builtin" is what's used today when C11 atomics are used.

We can also consider dropping this info field.

@adetunjii
Copy link
Contributor Author

and replace

"atomicvar_api:%s\r\n", REDIS_ATOMIC_API,

with something meaningful (I'm not sure what that would be).

"c11-builtin" is what's used today when C11 atomics are used.

We can also consider dropping this info field.

@zuiderkwast I think we should just drop it since we're making C11 the standard.

@zuiderkwast
Copy link
Contributor

Ok, please mention it in the PR description that we're dropping the INFO field "atomicvar_api". It's a user-facing change.

@zuiderkwast zuiderkwast added the release-notes This issue should get a line item in the release notes label May 14, 2024
@adetunjii adetunjii requested a review from aiven-sal May 15, 2024 00:16
@adetunjii adetunjii force-pushed the fix/c11-atomics branch 5 times, most recently from 7e8380c to 8b7cfa0 Compare May 15, 2024 01:08
Copy link
Member

@aiven-sal aiven-sal left a comment

Choose a reason for hiding this comment

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

I think you can now rm src/atomicvar.h .
Thanks for taking the time to work on my comments!

src/server.c Outdated Show resolved Hide resolved
Signed-off-by: Samuel Adetunji <[email protected]>
@adetunjii adetunjii requested a review from aiven-sal May 15, 2024 23:45
Copy link
Member

@aiven-sal aiven-sal left a comment

Choose a reason for hiding this comment

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

LGTM
Thank you!

@zuiderkwast
Copy link
Contributor

We need to remove all CI jobs for CentOS 7. They fail because it doesn't support C11. Shall we change these jobs to CentOS 8? I think the point is to have one of the oldest OSes that's still supported. (CentOS 7 is EOL in June this year.)

@adetunjii
Copy link
Contributor Author

We need to remove all CI jobs for CentOS 7. They fail because it doesn't support C11. Shall we change these jobs to CentOS 8? I think the point is to have one of the oldest OSes that's still supported. (CentOS 7 is EOL in June this year.)

Yeah. I think it's best to remove old CI jobs for CentoS 7. Let's fix that in another PR

@zuiderkwast
Copy link
Contributor

I think it's best to remove old CI jobs for CentoS 7. Let's fix that in another PR

I don't like to merge a PR which breaks the CI. It affects the daily CI too. We can do it in a separate PR, but then we should merge that CI PR before we merge this PR.

@adetunjii
Copy link
Contributor Author

adetunjii commented May 17, 2024 via email

@madolson
Copy link
Member

madolson commented May 19, 2024

Shall we change these jobs to CentOS 8?

CentOS 8 is already EoL, it never got long term support from RHEL from the looks of it. CentOS also doesn't exist anymore, it was evolved into CentOS stream. We could try AlmaLinux 9 or CentOS stream 9 as a replacement. I pinged some folks, but my initial guess is to move to CentOS stream.

EDIT: Ideally we should have a matrix and do CentOS stream 9 and AlmaLinux 8. AlmaLinux 8 will be maintained until 2029, so it seems like a great replacement for our CentOS 7 test.

Copy link
Contributor

@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

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

I've looked though this diff now. Looks good, but I think I spotted two typos.

src/networking.c Show resolved Hide resolved
src/networking.c Show resolved Hide resolved
Copy link
Contributor

@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

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

LGTM.

Don't merge until we have replaced CentOS 7 in CI jobs.

@madolson
Copy link
Member

I documented what we should do about centos 7 here: #527, in case someone else has time to pick it up.

Signed-off-by: Samuel Adetunji <[email protected]>
@zuiderkwast
Copy link
Contributor

Centos7 is still in the CI in this branch. I don't know how it happened. Did you merge latest unstable?

You can use merge commits. No need to rebase and force-push. We'll squash-merge it anyway.

Signed-off-by: Samuel Adetunji <[email protected]>
@adetunjii
Copy link
Contributor Author

Centos7 is still in the CI in this branch. I don't know how it happened. Did you merge latest unstable?

You can use merge commits. No need to rebase and force-push. We'll squash-merge it anyway.

It should be fine now

@adetunjii
Copy link
Contributor Author

@zuiderkwast when can this be merged?

@zuiderkwast
Copy link
Contributor

@zuiderkwast when can this be merged?

Probably tomorrow. People are not working today.

@zuiderkwast zuiderkwast merged commit 5d0f4bc into valkey-io:unstable May 26, 2024
17 checks passed
@zuiderkwast
Copy link
Contributor

Actually we discussed it now and it seems fine to merge. 🚀

@zuiderkwast zuiderkwast changed the title Introduce C11 _Atomics Require C11 _Atomics May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes This issue should get a line item in the release notes
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Move to C11 and adopt _Atomic, static_asserts, and thread_local
4 participants