dice icon indicating copy to clipboard operation
dice copied to clipboard

Add support for `HGETALL.WATCH` command

Open JyotinderSingh opened this issue 1 year ago • 14 comments

Add support for reactive queries on the existing HGETALL command by introducing HGETALL.WATCH.

This command should send push-responses to subscribed clients whenever the data inside the respective hash set changes.

As a part of this feature, you are also required to add support for the same to the dicedb-go SDK inside the watch_command.go file.

Reference

  1. You may refer to #1047 to understand the changes required to support this command.
  2. #924 provides more background on the feature's underlying implementation (but may not be directly relevant to this issue)

Testing

  1. Ensure integration tests are added, you can refer to existing .WATCH integration tests.
  2. Integration tests should include both resp tests and SDK tests.

JyotinderSingh avatar Oct 17 '24 14:10 JyotinderSingh

Hi! Can I please work on this issue? Thank you : )

src1026 avatar Oct 17 '24 15:10 src1026

Hi! Can I please work on this issue? Thank you : )

Assigned.

JyotinderSingh avatar Oct 17 '24 15:10 JyotinderSingh

Hi, could you please allow me to work on this issue?

abhishekgupta1906 avatar Oct 18 '24 22:10 abhishekgupta1906

Hey @JyotinderSingh let me know the issue is still open, can take a quick look.

arpit1912 avatar Oct 22 '24 20:10 arpit1912

Hey @arpit1912 ! I was working on it but I kinda got stuck on how to test my changes. I'm new so it took me longer than expected. Would you mind allowing me more time to look into this issue? Thank you.

src1026 avatar Oct 22 '24 20:10 src1026

Hey @arpit1912 ! I was working on it but I kinda got stuck on how to test my changes. I'm new so it took me longer than expected.

Would you mind allowing me more time to look into this issue? Thank you.

Take your time. Feel free to ask on discord.

JyotinderSingh avatar Oct 23 '24 00:10 JyotinderSingh

Hey @arpit1912 ! I was working on it but I kinda got stuck on how to test my changes. I'm new so it took me longer than expected. Would you mind allowing me more time to look into this issue? Thank you.

Please do, I'm also new here and was just checking for an issue to work upon. Let me know if there is anything you want to discuss . Thanks!

arpit1912 avatar Oct 23 '24 11:10 arpit1912

are you still working on this issue @src1026?

tarun-29 avatar Nov 08 '24 15:11 tarun-29

are you still working on this issue @src1026? If not I can take this up @JyotinderSingh .

kaushal-003 avatar Dec 02 '24 06:12 kaushal-003

@asaurabh12 and I working on this issue and we have understood few parts of the solution

  1. We need to modify the https://github.com/DiceDB/dice/blob/master/internal/iothread/cmd_meta.go by configuring the HGETALL WATCH AND UNWATCH
  2. In this file https://github.com/DiceDB/dice/blob/master/internal/watchmanager/watch_manager.go#L45, should we add dstore.HSET: {dstore.HGETALL: struct{}{}} This signifies that for any HSET operation we have to call HGETALL.

Please let me know if our understand is correct @JyotinderSingh @arpit1912 .

Nachiket18 avatar Jan 02 '25 03:01 Nachiket18

@asaurabh12 and I working on this issue and we have understood few parts of the solution

  1. We need to modify the https://github.com/DiceDB/dice/blob/master/internal/iothread/cmd_meta.go by configuring the HGETALL WATCH AND UNWATCH

  2. In this file https://github.com/DiceDB/dice/blob/master/internal/watchmanager/watch_manager.go#L45, should we add `dstore.HSET: {dstore.HGETALL: struct{}{}}

` This signifies that for any HSET operation we have to call HGETALL.

Please let me know if our understand is correct @JyotinderSingh @arpit1912 .

Correct

JyotinderSingh avatar Jan 02 '25 04:01 JyotinderSingh

@asaurabh12 and I working on this issue and we have understood few parts of the solution

  1. We need to modify the https://github.com/DiceDB/dice/blob/master/internal/iothread/cmd_meta.go by configuring the HGETALL WATCH AND UNWATCH
  2. In this file https://github.com/DiceDB/dice/blob/master/internal/watchmanager/watch_manager.go#L45, should we add `dstore.HSET: {dstore.HGETALL: struct{}{}}

` This signifies that for any HSET operation we have to call HGETALL. Please let me know if our understand is correct @JyotinderSingh @arpit1912 .

Correct

@JyotinderSingh: Thanks for getting back, @Nachiket18 and I have implemented the following:

  1. Contants.go, watch_manager.go and cmd_meta.go files were changed on the fork
  2. Checked further in ZRange implementation, and found different code structures for eval.go, there is already implementation of HGETALL in eval.go, we need further clarification on how to proceed with this file.

asaurabh12 avatar Jan 06 '25 01:01 asaurabh12

@asaurabh12 and I working on this issue and we have understood few parts of the solution

  1. We need to modify the https://github.com/DiceDB/dice/blob/master/internal/iothread/cmd_meta.go by configuring the HGETALL WATCH AND UNWATCH
  1. In this file https://github.com/DiceDB/dice/blob/master/internal/watchmanager/watch_manager.go#L45, should we add `dstore.HSET: {dstore.HGETALL: struct{}{}}

` This signifies that for any HSET operation we have to call HGETALL.

Please let me know if our understand is correct @JyotinderSingh @arpit1912 .

Correct

@JyotinderSingh: Thanks for getting back, @Nachiket18 and I have implemented the following:

  1. Contants.go, watch_manager.go and cmd_meta.go files were changed on the fork

  2. Checked further in ZRange implementation, and found different code structures for eval.go, there is already implementation of HGETALL in eval.go, we need further clarification on how to proceed with this file.

Just create a PR and we can discuss there. This shouldn't require too many changes. Feel free to take a look at the past PRs for adding watch support to other commands.

JyotinderSingh avatar Jan 06 '25 04:01 JyotinderSingh

I created a PR (https://github.com/DiceDB/dice/pull/1405) @JyotinderSingh . We are following ZRANGEWATCH PR and making the changes.

Nachiket18 avatar Jan 17 '25 01:01 Nachiket18