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: could use some refactoring #6570

Open
chu11 opened this issue Jan 22, 2025 · 3 comments
Open

kvs: could use some refactoring #6570

chu11 opened this issue Jan 22, 2025 · 3 comments

Comments

@chu11
Copy link
Member

chu11 commented Jan 22, 2025

I think the main kvs.c in the kvs module could use some refactoring, it's just getting big (north of 3.3K lines).

It's not super obvious to me what could be improved at the moment, as we've parsed out most transactions, lookups, etc. into individual mini-APIs already.

One thought that comes to mind is perhaps a "kvs_config" that can deal with config stuff as that expands and grows (#6125, #6112) as a nice chunk of that is concentrated in the main kvs.c rather than the sub-APIs.

It's worth noting that care was made in the past to avoid "circular struct dependencies" in the KVS code, as it did lead to problems. In some cases just having "back pointers" to other structs could improve things, but it would lead to those circular dependencies. Thus why refactoring would be good.

@garlick
Copy link
Member

garlick commented Jan 22, 2025

I'd like to see more abstraction. Having classes with public structs containing references to other public structs creates a large mental burden for someone trying to follow things. I'm thinking of kvstxn.h and kvsroot.h mainly I guess.

It's hard to come up useful abstractions though.

@chu11
Copy link
Member Author

chu11 commented Jan 22, 2025

Yeah, perhaps might be a good idea to look at all the kvs code and see if it could be abstracted in some (possibly poor choice of words) "holistic" way. Much of the current code was refactored sort of based on the original design, then namespace (and thus roots) were added on top, etc. etc. So there may be a smarter way to abstract it nowadays.

@chu11
Copy link
Member Author

chu11 commented Feb 5, 2025

I had what I thought was a mini-epiphiny today that actually went nowhere, but wanted to document so I don't forget later.

Now that the KVS fence support is removed, I thought it would be possible to refactor / re-architect the reporting of errors to transactions. Since all transactions are now defined to come from a single commit request vs multiple requests in a fence, perhaps we do not have to report errors via "events" anymore.

However, due to the fact transactions can be merged, the errors via events is still needed. i.e. KVS stuffs can still happen to multiple transactions "at the same time" even though fencing isn't supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants