danielealbano / cachegrand

cachegrand - a modern data ingestion, processing and serving platform built for today's hardware
BSD 3-Clause "New" or "Revised" License
975 stars 34 forks source link

Implement INCR, INCRBY, INCRBYFLOAT, DECR and DECRBY commands #216

Closed danielealbano closed 2 years ago

danielealbano commented 2 years ago

This PR implements a number of commands to increment and decrement integers and floats, namely the INCR, INCRBY, INCRBYFLOAT, DECR and DECRBY commands.

The PR includes also the require tests to ensure that they are working fine and their behaviour matches Redis behaviour.

In the PR there is also a change included to handle massive stack requests from the sprintf command, to handle very large long double numbers sprintf gets past the current stack of 32kb therefore it has been extended to 40kb.

codecov[bot] commented 2 years ago

Codecov Report

Base: 80.35% // Head: 80.56% // Increases project coverage by +0.20% :tada:

Coverage data is based on head (96ffc4e) compared to base (00b8b28). Patch coverage: 82.04% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #216 +/- ## ========================================== + Coverage 80.35% 80.56% +0.20% ========================================== Files 135 145 +10 Lines 8062 8435 +373 ========================================== + Hits 6478 6795 +317 - Misses 1584 1640 +56 ``` | [Impacted Files](https://codecov.io/gh/danielealbano/cachegrand/pull/216?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano) | Coverage Δ | | |---|---|---| | [src/utils\_string\_avx2.c](https://codecov.io/gh/danielealbano/cachegrand/pull/216/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL3V0aWxzX3N0cmluZ19hdngyLmM=) | `95.92% <ø> (ø)` | | | [src/utils\_string\_sw.c](https://codecov.io/gh/danielealbano/cachegrand/pull/216/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL3V0aWxzX3N0cmluZ19zdy5j) | `100.00% <ø> (ø)` | | | [src/utils\_string.c](https://codecov.io/gh/danielealbano/cachegrand/pull/216/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL3V0aWxzX3N0cmluZy5j) | `63.64% <77.08%> (+4.94%)` | :arrow_up: | | [...nd/helpers/module\_redis\_command\_helper\_incr\_decr.c](https://codecov.io/gh/danielealbano/cachegrand/pull/216/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL21vZHVsZS9yZWRpcy9jb21tYW5kL2hlbHBlcnMvbW9kdWxlX3JlZGlzX2NvbW1hbmRfaGVscGVyX2luY3JfZGVjci5j) | `81.69% <81.69%> (ø)` | | | [...c/module/redis/command/module\_redis\_command\_decr.c](https://codecov.io/gh/danielealbano/cachegrand/pull/216/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL21vZHVsZS9yZWRpcy9jb21tYW5kL21vZHVsZV9yZWRpc19jb21tYW5kX2RlY3IuYw==) | `100.00% <100.00%> (ø)` | | | [...module/redis/command/module\_redis\_command\_decrby.c](https://codecov.io/gh/danielealbano/cachegrand/pull/216/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL21vZHVsZS9yZWRpcy9jb21tYW5kL21vZHVsZV9yZWRpc19jb21tYW5kX2RlY3JieS5j) | `100.00% <100.00%> (ø)` | | | [...c/module/redis/command/module\_redis\_command\_incr.c](https://codecov.io/gh/danielealbano/cachegrand/pull/216/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL21vZHVsZS9yZWRpcy9jb21tYW5kL21vZHVsZV9yZWRpc19jb21tYW5kX2luY3IuYw==) | `100.00% <100.00%> (ø)` | | | [...module/redis/command/module\_redis\_command\_incrby.c](https://codecov.io/gh/danielealbano/cachegrand/pull/216/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL21vZHVsZS9yZWRpcy9jb21tYW5kL21vZHVsZV9yZWRpc19jb21tYW5kX2luY3JieS5j) | `100.00% <100.00%> (ø)` | | | [...e/redis/command/module\_redis\_command\_incrbyfloat.c](https://codecov.io/gh/danielealbano/cachegrand/pull/216/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL21vZHVsZS9yZWRpcy9jb21tYW5kL21vZHVsZV9yZWRpc19jb21tYW5kX2luY3JieWZsb2F0LmM=) | `100.00% <100.00%> (ø)` | | | [...module/redis/command/module\_redis\_command\_strlen.c](https://codecov.io/gh/danielealbano/cachegrand/pull/216/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL21vZHVsZS9yZWRpcy9jb21tYW5kL21vZHVsZV9yZWRpc19jb21tYW5kX3N0cmxlbi5j) | `100.00% <0.00%> (ø)` | | | ... and [7 more](https://codecov.io/gh/danielealbano/cachegrand/pull/216/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano) | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.