config memory limits: handle values larger than (signed) LLONG_MAX#9313
config memory limits: handle values larger than (signed) LLONG_MAX#9313oranagra merged 29 commits intoredis:unstablefrom
Conversation
|
Do we actually think this is worth implementing? This seems like a lot of effort to solve a problem that doesn't really matter. Thoughts? |
|
i agree this is not a real problem, and if we solve it is only in order to have a cleaner code. |
|
I agree with changing the upper limit to LLONG_MAX. |
|
I think this is not meaningful in terms of the problem to be solved. But I think it’s not a bad thing to provide the ability to configure ull, maybe it’s better to modify it when really needed. |
oranagra
left a comment
There was a problem hiding this comment.
@hwware i looked at it again.
I agree it would be nice to solve the problem and have cleaner code with no unexpected truncation, but i really don't like the code duplication (code is not cleaner this way!).
I think there's a good chance you can do better.
one example is that ull2string and ll2string can probably be unified in some way, maybe by putting most logic in ull2string and have ll2string call it and to the pre/post fixups.
regarding memtoull and memtoll there's probably no need for both, memory configs are always 0 (maybe with the exception of what i'm attempting in #7911).
I also imagine that the big if-else blocks with 90% common code you added in numericConfigSet and numericConfigGet can in some way be written to share code.
|
Ok got it. Thanks for the review, I will refactor and adjust the code. |
|
looks good. (cleaner than the initial version). |
|
@oranagra , I pushed the changes addressing the negative argument. Please take a look. Thanks |
and move comment to the right place
|
@hwware please look at my edit to see what i meant. |
|
@oranagra yes this looks fine to me too. |
|
@hwware please take a look at my changes. |
|
The last change is a bit similar to this one #9308 |
|
@enjoy-binbin right, i had to do part of it because of the variable was the wrong type and there was a negative check, and then i noticed that the timeout was verified with the wrong method. |
|
@oranagra I think the changes are good. And yes you are right, in the case the use specifies 10k as timeout instead of 10000 then the timeout will be set to 10. |
This one follow redis#9313 and goes deeper (validation of config file parsing) Move the check/update logic to a new updateClientOutputBufferLimit function. So that it can be used in CONFIG SET and config file parsing.
This one follow #9313 and goes deeper (validation of config file parsing) Move the check/update logic to a new updateClientOutputBufferLimit function. So that it can be used in CONFIG SET and config file parsing.
…edis#9313) This aims to solve the issue in CONFIG SET maxmemory can only set maxmemory to up to 9223372036854775807 (2^63) while the maxmemory should be ULLONG. Added a memtoull function to convert a string representing an amount of memory into the number of bytes (similar to memtoll but for ull). Also added ull2string to convert a ULLong to string (Similar to ll2string).
This one follow redis#9313 and goes deeper (validation of config file parsing) Move the check/update logic to a new updateClientOutputBufferLimit function. So that it can be used in CONFIG SET and config file parsing.
…edis#9313) This aims to solve the issue in CONFIG SET maxmemory can only set maxmemory to up to 9223372036854775807 (2^63) while the maxmemory should be ULLONG. Added a memtoull function to convert a string representing an amount of memory into the number of bytes (similar to memtoll but for ull). Also added ull2string to convert a ULLong to string (Similar to ll2string).
…edis#9313) This aims to solve the issue in CONFIG SET maxmemory can only set maxmemory to up to 9223372036854775807 (2^63) while the maxmemory should be ULLONG. Added a memtoull function to convert a string representing an amount of memory into the number of bytes (similar to memtoll but for ull). Also added ull2string to convert a ULLong to string (Similar to ll2string).
This PR is for #9071.
This aims to solve the issue in CONFIG SET maxmemory can only set maxmemory to up to 9223372036854775807 (2^63) while the maxmemory should be ULLONG. Added a memtoull function to convert a string representing an amount of memory into the number of bytes (similar to memtoll but for ull). Also added ull2string to convert a ULLong to string (Similar to ll2string).