@@ -1419,69 +1419,25 @@ start_server {tags {"hashexpire"}} {
14191419
14201420 test {COPY Preserves TTLs} {
14211421 r flushall
1422- r DEBUG SET-ACTIVE-EXPIRE 0
1423-
14241422 # Create hash with fields
14251423 r HSET myhash{t} f1 v1 f3 v3 f4 v4
14261424
14271425 # Set TTL on f1 only
1428- r HEXPIRE myhash{t} 200 FIELDS 1 f1
1429- r HEXPIRE myhash{t} 2 FIELDS 1 f3
1430-
1431- # Verify initial TTL state
1432- set mem_before [r MEMORY USAGE myhash{t}]
1433- assert_equal " v1 v3 v4" [r HMGET myhash{t} f1 f3 f4]
1434- assert_morethan [r HTTL myhash{t} FIELDS 1 f1] 100
1435- assert_morethan [r HTTL myhash{t} FIELDS 1 f3] 0
1436- assert_equal -1 [r HTTL myhash{t} FIELDS 1 f4]
1437- assert_equal 3 [r HLEN myhash{t}]
1438- assert_equal 1 [get_keys r]
1439- assert_equal 1 [get_keys_with_volatile_items r]
1426+ r HEXPIRE myhash{t} 2000 FIELDS 1 f1
1427+ r HEXPIRE myhash{t} 5000 FIELDS 1 f3
14401428
14411429 # Copy hash to new key
1442- r copy myhash{t} newhash1 {t}
1430+ r copy myhash{t} nwhash {t}
14431431
1444- # Verify myhash{t} is the same
1445- assert_equal " v1 v3 v4" [r HMGET myhash{t} f1 f3 f4]
1446- assert_morethan [r HTTL myhash{t} FIELDS 1 f1] 100
1447- assert_morethan [r HTTL myhash{t} FIELDS 1 f3] 0
1448- assert_equal -1 [r HTTL myhash{t} FIELDS 1 f4]
1449- assert_equal 3 [r HLEN myhash{t}]
1450-
1451- # Verify new hash got same values
1452- set mem_after [r MEMORY USAGE myhash{t}]
1432+ # Verify initial TTL state
1433+ assert_equal [r MEMORY USAGE myhash{t}] [r MEMORY USAGE nwhash{t}]
14531434 assert_equal " v1 v3 v4" [r HMGET myhash{t} f1 f3 f4]
1454- assert_morethan [r HTTL newhash1{t} FIELDS 1 f1] 100
1455- assert_morethan [r HTTL newhash1{t} FIELDS 1 f3] 0
1456- assert_equal -1 [r HTTL newhash1{t} FIELDS 1 f4]
1457- assert_equal 3 [r HLEN newhash1{t}]
1458- assert_equal 2 [get_keys r]
1459- assert_equal 2 [get_keys_with_volatile_items r]
1460-
1461- assert_equal $mem_before $mem_after
1462-
1463- # Modify TTL in original hash
1464- r HEXPIRE myhash{t} 5 FIELDS 1 f3
1465-
1466- # Wait for original TTL to expire in copy
1467- after 2000
1468- assert_equal " v1 {}" [r HMGET newhash1{t} f1 f3]
1469- assert_equal " v1 v3" [r HMGET myhash{t} f1 f3]
1470-
1471- r HSETEX myhash{t} EX 2 FIELDS 1 f3 v3
1472- # Create second copy
1473- r copy myhash{t} newhash2{t}
1474-
1475- # Modify TTL in second copy
1476- r HEXPIRE newhash2{t} 500 FIELDS 1 f3
1477-
1478- # Wait for original hash TTL to expire
1479- after 2000
1480- assert_equal " v1 {}" [r HMGET myhash{t} f1 f3]
1481- assert_equal " v1 v3" [r HMGET newhash2{t} f1 f3]
1482- # Re-enable active expiry
1483- r DEBUG SET-ACTIVE-EXPIRE 1
1484- } {OK} {needs:debug}
1435+ assert_equal " v1 v3 v4" [r HMGET nwhash{t} f1 f3 f4]
1436+ assert_equal [r HEXPIRETIME myhash{t} FIELDS 1 f1] [r HEXPIRETIME nwhash{t} FIELDS 1 f1]
1437+ assert_equal [r HEXPIRETIME myhash{t} FIELDS 1 f2] [r HEXPIRETIME nwhash{t} FIELDS 1 f2]
1438+ assert_equal [r HEXPIRETIME myhash{t} FIELDS 1 f3] [r HEXPIRETIME nwhash{t} FIELDS 1 f3]
1439+ assert_equal [r HEXPIRETIME myhash{t} FIELDS 1 f4] [r HEXPIRETIME nwhash{t} FIELDS 1 f4]
1440+ }
14851441
14861442 test {Hash Encoding Transitions with TTL - Add TTL to Existing Fields} {
14871443 r flushall
0 commit comments