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 randomkey command #202

Closed danielealbano closed 2 years ago

danielealbano commented 2 years ago

This PR implements the RANDOMKEY command.

It refactors the hashtable op get key function to return a copy of the key from the hashtable and to ensure that the copy is actually valid implementing a 2-phase verification.

The PR also includes the tests for the new command and a minor improvement to the DBSIZE command

codecov[bot] commented 2 years ago

Codecov Report

Base: 80.84% // Head: 80.87% // Increases project coverage by +0.04% :tada:

Coverage data is based on head (66778f3) compared to base (93246b1). Patch coverage: 86.36% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #202 +/- ## ========================================== + Coverage 80.84% 80.87% +0.04% ========================================== Files 129 131 +2 Lines 7760 7801 +41 ========================================== + Hits 6273 6309 +36 - Misses 1487 1492 +5 ``` | [Impacted Files](https://codecov.io/gh/danielealbano/cachegrand/pull/202?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano) | Coverage Δ | | |---|---|---| | [...ta\_structures/hashtable/mcmp/hashtable\_op\_delete.c](https://codecov.io/gh/danielealbano/cachegrand/pull/202/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL2RhdGFfc3RydWN0dXJlcy9oYXNodGFibGUvbWNtcC9oYXNodGFibGVfb3BfZGVsZXRlLmM=) | `100.00% <ø> (ø)` | | | [...uctures/hashtable/mcmp/hashtable\_support\_op\_arch.c](https://codecov.io/gh/danielealbano/cachegrand/pull/202/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL2RhdGFfc3RydWN0dXJlcy9oYXNodGFibGUvbWNtcC9oYXNodGFibGVfc3VwcG9ydF9vcF9hcmNoLmM=) | `93.87% <ø> (ø)` | | | [...a\_structures/hashtable/mcmp/hashtable\_op\_get\_key.c](https://codecov.io/gh/danielealbano/cachegrand/pull/202/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL2RhdGFfc3RydWN0dXJlcy9oYXNodGFibGUvbWNtcC9oYXNodGFibGVfb3BfZ2V0X2tleS5j) | `82.35% <76.92%> (-8.56%)` | :arrow_down: | | [...tures/hashtable/mcmp/hashtable\_op\_get\_random\_key.c](https://codecov.io/gh/danielealbano/cachegrand/pull/202/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL2RhdGFfc3RydWN0dXJlcy9oYXNodGFibGUvbWNtcC9oYXNodGFibGVfb3BfZ2V0X3JhbmRvbV9rZXkuYw==) | `100.00% <100.00%> (ø)` | | | [...ule/redis/command/module\_redis\_command\_randomkey.c](https://codecov.io/gh/danielealbano/cachegrand/pull/202/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL21vZHVsZS9yZWRpcy9jb21tYW5kL21vZHVsZV9yZWRpc19jb21tYW5kX3JhbmRvbWtleS5j) | `100.00% <100.00%> (ø)` | | | [src/storage/db/storage\_db.c](https://codecov.io/gh/danielealbano/cachegrand/pull/202/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Daniele+Salvatore+Albano#diff-c3JjL3N0b3JhZ2UvZGIvc3RvcmFnZV9kYi5j) | `63.71% <100.00%> (+0.42%)` | :arrow_up: | 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.