connect icon indicating copy to clipboard operation
connect copied to clipboard

Redis processor fails with HGETALL

Open webfrank opened this issue 1 year ago • 5 comments

Hi, I was trying to use redid processor with command HGETALL to retrieve all the fields and values inside an hashset but the processor return always nothing (it prints a blank line in the log)

This is a sample test:

input:
  generate:
    count: 1
    mapping: root = ""

pipeline:
  processors:
  - redis:
      url: redis://localhost:6379
      retries: 0
      command: hgetall
      args_mapping: root = ["demo:list:whitelist"]
  - log:
      message: ${! meta() }
  - catch:
    - log:
        message: Not Found

and output is:

INFO Running main config from specified file       @service=benthos benthos_version=4.24.0 path=whitelist.yaml
INFO Listening for HTTP requests at: http://0.0.0.0:4195  @service=benthos
INFO Launching a benthos instance, use CTRL+C to close  @service=benthos
INFO {}                                            @service=benthos label="" path=root.pipeline.processors.1

INFO Pipeline has terminated. Shutting down the service  @service=benthos

From reds cli:

HGETALL demo:list:whitelist

1) "AA123BB"
2) "Car 1"
3) "CC456DD"
4) "Car 2"
5) "MPC7772"
6) "Volkswagen"

Using HGET command with key and field works as expected.

webfrank avatar Dec 07 '23 15:12 webfrank

I am also facing the same issue with hgetall. The output is empty.

1998sachin avatar Apr 28 '24 10:04 1998sachin

Is there any update on this issue? My current workaround is to use multiple GET commands but that is pretty ugly and doesn't scale very well.

Statkern15 avatar May 07 '24 04:05 Statkern15

@Statkern15 You can use lua script to execute hgetall command.

1998sachin avatar May 11 '24 07:05 1998sachin

@Statkern15 You can use lua script to execute hgetall command.

that's and excellent workaround thank you.

Statkern15 avatar May 13 '24 05:05 Statkern15

I tracked down the issue to type limitations in https://github.com/benthosdev/benthos/blob/279e25b03b2207b19804213c851ec386076f43a6/public/service/message.go#L262 PR coming up in the next few days.

mkysel avatar May 16 '24 19:05 mkysel