Describe the bug

expire command triggers an invalidate push when tracking on

To reproduce

  1. Enable tracking on one connection client tracking on redirect 473 bcast
  2. call expire command on another connection expire a2 5
  3. The connection mentioned in step one will receive an invalidate push

Expected behavior

expire command doesn't trigger an invalidate push when tracking on

Additional information

redis version: 7.2.5, 7.4.1

Comment From: ShooterIT

@qingdaoheze could you show the info of client 473? You can use client list id 473

the redirected client should use RESP3 or it is a subscribe client.

REDIRECT : send invalidation messages to the connection with the specified ID. The connection must exist. You can get the ID of a connection using CLIENT ID. If the connection we are redirecting to is terminated, when in RESP3 mode the connection with tracking enabled will receive tracking-redir-broken push messages in order to signal the condition.

Comment From: qingdaoheze

Redis [BUG] expire command triggers an invalidate push when tracking on

@ShooterIT

Comment From: qingdaoheze

After I run the following commands in another connection: Redis [BUG] expire command triggers an invalidate push when tracking on There are three push messages received by the client 473: Redis [BUG] expire command triggers an invalidate push when tracking on

I think the client 473 should only receive two push messages instead of three. This is because the expire command does not change the value of the key until it has actually expired.

Comment From: ShooterIT

I think the expiration time is also part of the key, client side may record the expiration time WDYT @sundb

Comment From: sundb

I think the expiration time is also part of the key, client side may record the expiration time WDYT @sundb

yes, it's documented in https://redis.io/docs/latest/develop/reference/client-side-caching/

Handling TTLs: make sure you also request the key TTL and set the TTL in the local cache if you want to support caching keys with a TTL.

Comment From: qingdaoheze

Got it. Thank you very much!