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

PFMERGE wrong behavior #4750

Closed
Niennienzz opened this issue Mar 11, 2025 · 1 comment · Fixed by #4796
Closed

PFMERGE wrong behavior #4750

Niennienzz opened this issue Mar 11, 2025 · 1 comment · Fixed by #4796
Assignees
Labels
bug Something isn't working

Comments

@Niennienzz
Copy link
Contributor

Niennienzz commented Mar 11, 2025

Describe the Bug

  • PFMERGE accumulates the cardinality of destination.
  • If the destination HyperLogLog exists, it should be treated as one of the sources.
  • But since HyperLogLog counts unique values, the cardinality should not accumulate (see examples below).

To Reproduce

$> PFADD hll_01 1 2 3
(integer) 1
$> PFADD hll_02 4 5
(integer) 1
$> PFMERGE destination hll_01 hll_02
OK
$> PFCOUNT destination
(integer) 5

# No new unique member added.
# Repeat the previous two commands.
$> PFMERGE destination hll_01 hll_02
OK
$> PFCOUNT destination
(integer) 10                           # This is wrong.
$> PFMERGE destination hll_01 hll_02
OK
$> PFCOUNT destination
(integer) 15                           # This is wrong.

Expected Behavior

  • There's no new unique member added in hll_01, hll_02, and destination.
  • The merged destination HyperLogLog should have the same value onwards.
$> PFADD hll_01 1 2 3
(integer) 1
$> PFADD hll_02 4 5
(integer) 1
$> PFMERGE destination hll_01 hll_02
OK
$> PFCOUNT destination
(integer) 5

# No new unique member added.
# Repeat the previous two commands.
$> PFMERGE destination hll_01 hll_02
OK
$> PFCOUNT destination
(integer) 5
$> PFMERGE destination hll_01 hll_02
OK
$> PFCOUNT destination
(integer) 5

Environment

  • OS: MacOS
  • Kernel: Darwin Kernel Version 23.5.0: Wed May 1 20:14:38 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6020 arm64
  • Containerized: Docker
  • Dragonfly Version: v1.27.2
@Niennienzz Niennienzz added the bug Something isn't working label Mar 11, 2025
@kostasrim
Copy link
Contributor

Thank you @Niennienzz !

mkaruza added a commit that referenced this issue Mar 18, 2025
Skip destination key to be used with PFMERGE. Fixed bug in
hllMergeDense that writes to wrong register.

Fixes #4750

Signed-off-by: mkaruza <[email protected]>
mkaruza added a commit that referenced this issue Mar 18, 2025
Skip destination key to be used with PFMERGE. Fixed bug in
hllMergeDense that writes to wrong register.

Fixes #4750

Signed-off-by: mkaruza <[email protected]>
mkaruza added a commit that referenced this issue Mar 18, 2025
Skip destination key to be used with PFMERGE. Fixed bug in
hllMergeDense that writes to wrong register.

Fixes #4750

Signed-off-by: mkaruza <[email protected]>
mkaruza added a commit that referenced this issue Mar 20, 2025
Fixed bug in hllMergeDense that writes to wrong register.

Fixes #4750

Signed-off-by: mkaruza <[email protected]>
mkaruza added a commit that referenced this issue Mar 20, 2025
Fixed bug in hllMergeDense that writes to wrong register.

Fixes #4750

Signed-off-by: mkaruza <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants