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

kvs: misc cleanups #6615

Merged
merged 6 commits into from
Feb 8, 2025
Merged

kvs: misc cleanups #6615

merged 6 commits into from
Feb 8, 2025

Conversation

chu11
Copy link
Member

@chu11 chu11 commented Feb 7, 2025

Built on top of #6604, just some misc cleanups.

@chu11
Copy link
Member Author

chu11 commented Feb 7, 2025

rebased now that #6604 is in

Copy link
Member

@garlick garlick left a comment

Choose a reason for hiding this comment

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

LGTM! Nice cleanup

chu11 added 6 commits February 7, 2025 17:15
Problem: A comment about wait_create_msg_handler() says it will
make a message copy from a passed in flux_msg_t.  This is not true.

Update the comment to indicate a message reference is taken.
Problem: Several functions that have been refactored in the past
should be cleaned up as their use has clearly changed.  For example,
some "goto error" type paths don't actually do anything anymore.

Solution: Cleanup the functions content_store_request_send() and
error_event_send_to_name().
Problem: Some code in the KVS uses flux_msg_copy().  This code
was written before flux_msg_incref() existed.

Use flux_msg_incref() over flux_msg_copy().
Problem: The functions wait_msg_aux_set() and wait_msg_aux_get()
were added to add aux data to an internally stored message copy
in a wait_t.  This is back when the wait structure contained
a message copy created with flux_msg_copy().  However, internally
flux_msg_incref() and flux_msg_decref() are now used, so these
functions are a bit excessive now.

Remove wait_msg_aux_set() and wait_msg_aux_get().  Instead just
set aux data via flux_msg_aux_set() before passing the message
to wait_create_msg_handler().
Problem: A lookup handle is passed to getroot() only because it
has to be passed to getroot_request_send() in case the getroot()
call will stall.  This is legacy behavior from when flux_msg_copy()
had to be used instead of flux_msg_incref().

Solution: Set the lookup handle as aux data in the message if
we are stalling in lookup_common().  Remove the need to pass the
handle as a parameter to getroot().
Problem: Throughout the KVS code errnos are preserved in cleanup
paths in a manner that is not common to the rest of the flux-core
codebase.

Cleanup these paths by either:

A) Preserve errno within appropriate "destroy" functions.

B) Use ERRNO_SAFE_WRAP
@mergify mergify bot merged commit c205af7 into flux-framework:master Feb 8, 2025
33 checks passed
Copy link

codecov bot commented Feb 8, 2025

Codecov Report

Attention: Patch coverage is 73.46939% with 26 lines in your changes missing coverage. Please review.

Project coverage is 83.82%. Comparing base (ef29673) to head (a1b2c06).
Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
src/modules/kvs/kvs.c 73.17% 11 Missing ⚠️
src/modules/kvs/lookup.c 72.22% 5 Missing ⚠️
src/modules/kvs/kvstxn.c 84.61% 4 Missing ⚠️
src/modules/kvs/kvs_wait_version.c 60.00% 2 Missing ⚠️
src/modules/kvs/kvsroot.c 60.00% 2 Missing ⚠️
src/modules/kvs/waitqueue.c 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6615      +/-   ##
==========================================
+ Coverage   83.78%   83.82%   +0.04%     
==========================================
  Files         530      530              
  Lines       88313    88237      -76     
==========================================
- Hits        73990    73968      -22     
+ Misses      14323    14269      -54     
Files with missing lines Coverage Δ
src/modules/kvs/kvs_wait_version.c 89.39% <60.00%> (-0.47%) ⬇️
src/modules/kvs/kvsroot.c 73.64% <60.00%> (+1.16%) ⬆️
src/modules/kvs/waitqueue.c 91.66% <33.33%> (+0.17%) ⬆️
src/modules/kvs/kvstxn.c 80.35% <84.61%> (+0.89%) ⬆️
src/modules/kvs/lookup.c 80.59% <72.22%> (+1.60%) ⬆️
src/modules/kvs/kvs.c 74.19% <73.17%> (+1.01%) ⬆️

... and 10 files with indirect coverage changes

@chu11 chu11 deleted the kvs_cleanup3 branch February 8, 2025 02:14
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.

2 participants