-
Notifications
You must be signed in to change notification settings - Fork 123
Conversation
Can you mark the placements you found to be best nevertheless and write why they are not ideal? The foreach and init placements are also missing. |
@@ -447,6 +447,8 @@ int kdbClose (KDB * handle, Key * errorKey) | |||
*/ | |||
static int elektraGetCheckUpdateNeeded (Split * split, Key * parentKey) | |||
{ | |||
// GLOBAL: getresolver [init] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
init could be even earlier directly in kdbGet?
There are some improvements! Maybe its better to directly work on the implementation now (instead of only having comments for placements) because you need to split some loops and some control flow needs changes because of deinit. It would be good if you have a helper function/macro for executing the hooks so that the hooks are better visible/readable. |
@markus2330 thanks for the feedback. Yes indeed, I think it's better to switch to concrete code now. Did you find anything that was completely misplaced in general? I was unsure about what semantics was wanted, but it will be unambiguous with concrete code anyway. I was already planning on having a function or macro to keep the verbosity/boilerplate code about the same as the current comments (one-liners). It would introduce a lot of duplicate code otherwise. |
if (handle->globalPlugins[PRECOMMIT]) | ||
{ | ||
handle->globalPlugins[PRECOMMIT]->kdbSet (handle->globalPlugins[PRECOMMIT], ks, parentKey); | ||
} | ||
|
||
elektraSetCommit (split, parentKey); | ||
// GLOBAL: commit [init] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be before elektraSetCommit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or is even alias for precommit?
I already commented about some issues, but they are minor and it would also be trivial to fix the issues with code. Maybe @tom-wa, @Namoshek, @waht or @KurtMi can find further problems, they already used (or even implemented) hooks. Another approach would be to pinpoint problems within the test cases, maybe you can write some of them upfront? The desired sequence of called hooks in certain situations should be easy to check. |
|
||
// GLOBAL: postgetstorage [init] | ||
// GLOBAL: postgetstorage [max once] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just for your information: elektraGetDoUpdatewithGlobalHooks gets called twice (thats why there's the run
parameter)
you've used if statements for the set placements but not here, so i'm not sure if you've thought of that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I did think of that since we discussed it in a meeting.
All of these are just rough markers where I thought the hooks could be placed.
Then I don't think that it would make sense for anyone to review it yet, so don't waste your time. |
a6e4fa6
to
9eb7235
Compare
f4a9715
to
b7aa731
Compare
b7aa731
to
180b432
Compare
48739f2
to
c007bf0
Compare
This does not yet comply with the proposal for global plugins, but it adds some more positions which would be useful for #1072. (postgetstorage/deinit in particular) @markus2330 would you consider merging the available part of the implementation already? Then I could continue working in another PR while @Namoshek could start using it already. |
cfe12c1
to
c3922a0
Compare
Not much success so far. I used I had to change the last function in cmake/Modules/LibAddMacros.cmake by the way, it did not accept slashes for |
@Namoshek, you have to either:
Yes, |
Ok, that info is (obviously) very important, thanks for pointing it out. Now I also understand why you want to inform the plugin in what stage it is executed (would definitely make sense to limit the cachefilter plugin here to one state, as it could potentially increase execution time enormously, although it shouldn't matter if it is executed 20 times (from a functional perspective)).
That is what I did and I also confirmed it by listing the elektra keys with Thank you so far! |
If it doesn't seem to work don't waste too much time. I'll look into it on saturday. Can't do any sooner. It's possible that the placement is not executed. |
@mpranj Can you make this ready to merge? We now have two month to get rid of all issues. |
@markus2330 I'm pretty busy but it's already on my asap list. I'd expect it to be ready within a week. |
Simplify and revamp mount.c to be able to mount the newly defined global positions. Use a macro to generate positions and subpositions. This makes the system more flexible to add/remove positions later. Use a function to execute global plugins and keep boilerplate code minimal. Add very simple and basic shell recorder test to test if mounting and executing the global plugins still works.
Calls the correct kdb operation on plugins (Get,Set,Error), was previously only kdbGet.
Add the elektraGlobal{Get,Set,Error} functions. This seemed more practical than using macros everywhere.
thank to @Namoshek
@@ -42,7 +42,7 @@ int elektraCachefilterGet (Plugin * handle, KeySet * returned, Key * parentKey) | |||
void * cache = elektraPluginGetData (handle); | |||
if (cache == NULL) | |||
{ | |||
toBeCached = ksNew (ksGetSize (returned), KS_END); | |||
toBeCached = ksNew (0, KS_END); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you benchmark this? It might waste some space but should avoid many reallocations (for larger keysets).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I didn't but this change is also not crucial.
The code of ksAppend
, which is used later here, does suggest that it uses only one resize in advance.
I wanted to let the core decide about the allocation but if you're saying this is bad I don't mind undoing this. The objective was to get rid of the memleaks and move forward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I didn't but this change is also not crucial.
Thus I wondered why you changed it. Comments help in such situations.
But you are right, lets move forward for now. Before you start changing ksNew
(to be suitable for mmap), it would be great to have benchmarks for such reallocations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep you're right. I undid the change because it was unfounded.
@markus2330 I'll close this PR today (I just kept it for the buildbots and some remaining infos). Do you want me to do a PR on cachefilter or do you want to merge cachefilter to master if the memleaks are fixed now? |
Perfect, it is overdue!
I am okay with both: You can create a single PR with all changes (and close #1078); or update #1078 and create a separate PRs for different modules. In any case, please keep changes of separate modules in separate commits. |
Introducing only a few of the proposed global plugin placements.