mirror of https://github.com/redis/redis.git
				
				
				
			fix the client type in trackingInvalidateKey() (#11052)
Fix bug with scripts ignoring client tracking NOLOOP and send an invalidation message anyway.
This commit is contained in:
		
							parent
							
								
									91c3c742e7
								
							
						
					
					
						commit
						44859a41ee
					
				|  | @ -388,7 +388,7 @@ void trackingInvalidateKey(client *c, robj *keyobj, int bcast) { | |||
|         /* If the client enabled the NOLOOP mode, don't send notifications
 | ||||
|          * about keys changed by the client itself. */ | ||||
|         if (target->flags & CLIENT_TRACKING_NOLOOP && | ||||
|             target == c) | ||||
|             target == server.current_client) | ||||
|         { | ||||
|             continue; | ||||
|         } | ||||
|  |  | |||
|  | @ -208,6 +208,19 @@ start_server {tags {"tracking network"}} { | |||
|         assert {$res eq {key1}} | ||||
|     } | ||||
| 
 | ||||
|     test {Invalid keys should not be tracked for scripts in NOLOOP mode} { | ||||
|         $rd_sg CLIENT TRACKING off | ||||
|         $rd_sg CLIENT TRACKING on NOLOOP | ||||
|         $rd_sg HELLO 3 | ||||
|         $rd_sg SET key1 1 | ||||
|         assert_equal "1" [$rd_sg GET key1] | ||||
| 
 | ||||
|         # For write command in script, invalid key should not be tracked with NOLOOP flag | ||||
|         $rd_sg eval "return redis.call('set', 'key1', '2')" 1 key1 | ||||
|         assert_equal "2" [$rd_sg GET key1] | ||||
|         $rd_sg CLIENT TRACKING off | ||||
|     } | ||||
| 
 | ||||
|     test {Tracking only occurs for scripts when a command calls a read-only command} { | ||||
|         r CLIENT TRACKING off | ||||
|         r CLIENT TRACKING on | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue