Skip to content
Closed
Show file tree
Hide file tree
Changes from 127 commits
Commits
Show all changes
144 commits
Select commit Hold shift + click to select a range
2d5c653
Squash all content to a single commit
ranshid Jun 19, 2025
554af84
drop diplicated assertion
ranshid Jun 19, 2025
7094899
address some PR comments
ranshid Jun 19, 2025
49a1dc2
pr comments
ranshid Jun 19, 2025
cc59a7e
address pr comments.
ranshid Jun 22, 2025
26a7bb8
Fix HSETEX/HGETEX/HEXPIRE propagation.
ranshid Jun 22, 2025
f8c7356
remove hashTypeNumVolatileElements and dependancy of AOF rewrite
ranshid Jun 23, 2025
ea79101
address Jim early PR comments
ranshid Jun 25, 2025
9962f33
Entry unit test
ranshid Jun 25, 2025
94a7a9d
1. fix crash in rewriteHashObject
ranshid Jun 25, 2025
871253c
add documentation in entry.h
ranshid Jun 25, 2025
8531d7b
make test_entry use the header file
ranshid Jun 25, 2025
1aa83cc
better make UNUSED macro provided by util.h
ranshid Jun 25, 2025
bfeb751
Fix test_entry and a bug in entryUpdate
ranshid Jun 25, 2025
eecceec
fix minor formatting issue
ranshid Jun 25, 2025
de77fbb
introduce volatile_set implementation
ranshid Jun 26, 2025
6be1bd0
fix comparison
ranshid Jun 26, 2025
6df722f
fix typos
ranshid Jun 26, 2025
52d8a25
fix 32bit compilation and forgoten test file
ranshid Jun 26, 2025
344d487
add volatile set test condition
ranshid Jun 27, 2025
9d900dc
fix a bug in handling a removal from vecotr of size 1
ranshid Jun 27, 2025
603bbe1
fix pop expired
ranshid Jun 27, 2025
680a36a
change volatile_set to vset
ranshid Jun 28, 2025
e1ace27
1. change to vset
ranshid Jun 29, 2025
1f03adc
fix vset unittest name run
ranshid Jun 29, 2025
05a731c
replace vset "virtual table" with explicit function parameters to get…
ranshid Jun 29, 2025
d464f4f
explicit include stdlib for abs
ranshid Jun 29, 2025
69491e4
make vset a simple bucket pointer
ranshid Jun 29, 2025
2cdca33
fix some format issues
ranshid Jun 29, 2025
6c527c8
fix a bug in HINCRBY/(FLOAT).
ranshid Jun 29, 2025
7d55e79
address PR comments
ranshid Jun 30, 2025
54e52bf
More fixes following the pr review:
ranshid Jun 30, 2025
46eacf6
fix vset comment arrow use in documentation
ranshid Jun 30, 2025
688f208
add public API documentation
ranshid Jun 30, 2025
597f0d4
polish comments and documentation
ranshid Jun 30, 2025
9c260e3
change sv to pv in multiple places
ranshid Jun 30, 2025
c4dd877
Use unsorted vector for most caeses.
ranshid Jun 30, 2025
b01ec8d
fix compilation warning
ranshid Jun 30, 2025
b11b143
Introduce a multi pop method for expiration entries
ranshid Jul 1, 2025
5058953
fix format and spelcheck
ranshid Jul 1, 2025
0c3fb77
revert changes to object.c (they belong in a separate PR)
ranshid Jul 1, 2025
ceb0a27
fix HPERSIST bug in accounting different flows new argv
ranshid Jul 1, 2025
f8e5bc1
fix new function names and documentation
ranshid Jul 1, 2025
7a4eb30
Merge remote-tracking branch 'origin/unstable' into ttl-poc-new
ranshid Jul 1, 2025
3e55e3f
Merge remote-tracking branch 'valkey-fork/ttl-poc-new' into introduce…
ranshid Jul 1, 2025
fa8a499
fix memory leak in t_hash.
ranshid Jul 1, 2025
af1c360
format fix
ranshid Jul 1, 2025
9734290
add vset memory usage
ranshid Jul 1, 2025
e1c78f2
fix some pr comments
ranshid Jul 1, 2025
962e03b
change the OBJ_* prefix to ARGS_*
ranshid Jul 1, 2025
5038145
Change timestamptIsExpired to return bool
ranshid Jul 1, 2025
c4b4042
fix format issue
ranshid Jul 1, 2025
140cf7c
Merge remote-tracking branch 'origin/unstable' into ttl-poc-new
ranshid Jul 1, 2025
f66e785
Merge remote-tracking branch 'valkey-fork/ttl-poc-new' into introduce…
ranshid Jul 1, 2025
c628720
fix HEXPIRE/HGETEX/HSETEX handling of 0 expiraiton time
ranshid Jul 2, 2025
536f949
fix 2 bugs:
ranshid Jul 2, 2025
e7aaf8b
move hset keyspace notification first in case of hsetex
ranshid Jul 2, 2025
8deb3e9
add some new commands documentation
ranshid Jul 2, 2025
15f7ab8
update tacked entry when the entry is defragged
ranshid Jul 2, 2025
17bea7f
Merge remote-tracking branch 'valkey-fork/ttl-poc-new' into introduce…
ranshid Jul 2, 2025
abef051
also pass object to entryDefrag on scanLaterHash
ranshid Jul 3, 2025
390015e
extend the test suite
ranshid Jul 3, 2025
f4869a7
address pr comments
ranshid Jul 3, 2025
195c5a5
fix typo
ranshid Jul 3, 2025
2c4ea38
add replication tests
ranshid Jul 3, 2025
0e1305c
fix typo
ranshid Jul 3, 2025
8d1cbeb
Merge remote-tracking branch 'valkey-fork/ttl-poc-new' into introduce…
ranshid Jul 3, 2025
6c7e841
optimize vsetUpdateEntry to avoid unnecessary mutations
ranshid Jul 3, 2025
01eed46
handle case of unsorted vector after update
ranshid Jul 3, 2025
2e75a88
Add some AOF test case
ranshid Jul 3, 2025
80439ec
add external:skip flag for cluster tests
ranshid Jul 3, 2025
c513852
also add external:skip for AOF tests
ranshid Jul 3, 2025
ba7f7c6
Update src/commands/hgetex.json
ranshid Jul 3, 2025
8d53993
Update src/commands/hpersist.json
ranshid Jul 3, 2025
3383656
Update src/commands/hexpire.json
ranshid Jul 3, 2025
38e3237
ddress some more PR comments
ranshid Jul 3, 2025
413f3a1
Merge remote-tracking branch 'valkey-fork/ttl-poc-new' into introduce…
ranshid Jul 3, 2025
90f33e9
also optimize the defrag path when vector encoding is used
ranshid Jul 4, 2025
bed539e
Merge remote-tracking branch 'origin/unstable' into ttl-poc-new
ranshid Jul 4, 2025
d271cca
Merge remote-tracking branch 'valkey-fork/ttl-poc-new' into introduce…
ranshid Jul 4, 2025
02e65dd
fix hgetex reply schema
ranshid Jul 4, 2025
adf7c85
Merge remote-tracking branch 'valkey-fork/ttl-poc-new' into introduce…
ranshid Jul 4, 2025
4bbdbf1
introduce vset defrag
ranshid Jul 5, 2025
00a80d9
address PR comments
ranshid Jul 6, 2025
af52024
fix split function documentation
ranshid Jul 6, 2025
e2909d7
Merge remote-tracking branch 'valkey-fork/ttl-poc-new' into introduce…
ranshid Jul 6, 2025
ee9e856
Fix bad parameter passes to signalModifiedKey
ranshid Jul 7, 2025
2a476f1
Handle hrandfield when volatile fields
ranshid Jul 7, 2025
2dc1933
apply pr comments
ranshid Jul 7, 2025
168ed73
Apply suggestions from code review
ranshid Jul 8, 2025
8caf1d5
remove NX/XX options for HSETEX :(
ranshid Jul 8, 2025
ccc724d
Merge remote-tracking branch 'valkey-fork/ttl-poc-new' into introduce…
ranshid Jul 8, 2025
c9fc597
Change hrandfield to return expired field if no other field was found
ranshid Jul 8, 2025
0d1c48e
Update src/t_hash.c
ranshid Jul 8, 2025
03ff1c5
Update src/t_hash.c
ranshid Jul 8, 2025
340991f
address pr comments
ranshid Jul 10, 2025
56ddc5f
still skip external server run for command stats test
ranshid Jul 10, 2025
381f5f1
document aligned expiry access debugassert
ranshid Jul 10, 2025
341bb9c
separate tests which require disable active-expiry
ranshid Jul 10, 2025
98f7e1a
fix tests return validation
ranshid Jul 10, 2025
6b955fa
change back the hrandfield to return an empty response in case not found
ranshid Jul 10, 2025
9196746
Merge remote-tracking branch 'valkey-fork/ttl-poc-new' into introduce…
ranshid Jul 10, 2025
5314b19
Add new tests and disable SET-ACTIVE-EXPIRE for some tests (#6)
stav-bentov Jul 13, 2025
2b5d8b2
address PR comments
ranshid Jul 13, 2025
145e4b8
Merge remote-tracking branch 'origin/unstable' into ttl-poc-new
ranshid Jul 13, 2025
a3850ce
remove unneeded enum
ranshid Jul 13, 2025
a664ca5
Merge remote-tracking branch 'valkey-fork/ttl-poc-new' into introduce…
ranshid Jul 13, 2025
36dd81e
address PR comments
ranshid Jul 15, 2025
93b8023
Merge remote-tracking branch 'origin/unstable' into ttl-poc-new
ranshid Jul 15, 2025
d1c5468
fix bugs in volatile_set implementation
ranshid Jul 15, 2025
d8c4054
Reduce duplication in hashexpire.tcl (#7)
stav-bentov Jul 15, 2025
993682b
Merge remote-tracking branch 'valkey-fork/ttl-poc-new' into introduce…
ranshid Jul 15, 2025
e4d1792
fix handling of unmoved defrag allocation
ranshid Jul 15, 2025
0609a90
Fix the hashtable update entry.
ranshid Jul 16, 2025
b01769a
use hashtableReplaceReallocatedEntry in vsetBucketUpdateEntry_HASHTABLE
ranshid Jul 17, 2025
4cc13d4
Revert "use hashtableReplaceReallocatedEntry in vsetBucketUpdateEntry…
ranshid Jul 17, 2025
4f27725
comment TODO on how we operate bucket split
ranshid Jul 17, 2025
aafbb8d
typo fix
ranshid Jul 18, 2025
8d8118b
fix comment
ranshid Jul 24, 2025
e168e5c
Merge remote-tracking branch 'origin/unstable' into ttl-poc-new
ranshid Jul 28, 2025
d311b3d
Merge remote-tracking branch 'valkey-fork/ttl-poc-new' into introduce…
ranshid Jul 28, 2025
aecc59e
address PR comments
ranshid Jul 30, 2025
43fe643
Merge remote-tracking branch 'origin/unstable' into ttl-poc-new
ranshid Jul 30, 2025
1277cb9
Merge remote-tracking branch 'valkey-fork/ttl-poc-new' into introduce…
ranshid Jul 30, 2025
aa3dfe3
Update src/vset.c
ranshid Jul 31, 2025
ccda2c6
Update src/vset.c
ranshid Jul 31, 2025
63b38e5
Update src/vset.c
ranshid Jul 31, 2025
293ad74
address PR comments
ranshid Aug 3, 2025
332332e
Merge remote-tracking branch 'valkey-fork/introduce-volatile-set' int…
ranshid Aug 3, 2025
710150a
fix compilation following bit definitions
ranshid Aug 3, 2025
c6dc3a8
fix format and 32bit compilation
ranshid Aug 3, 2025
be4064d
fix small foprmat issue
ranshid Aug 3, 2025
41fa36d
Revert back to use vsetRemoveExpired.
ranshid Aug 3, 2025
450fe95
address more PR comments
ranshid Aug 4, 2025
93e21cc
document entryUpdate value ownership move
ranshid Aug 4, 2025
a996c4d
Merge remote-tracking branch 'origin/unstable' into ttl-poc-new
ranshid Aug 4, 2025
953e544
Merge remote-tracking branch 'valkey-fork/ttl-poc-new' into introduce…
ranshid Aug 4, 2025
dc88e0d
distinguish between null set and empty set
ranshid Aug 4, 2025
47b3cb5
fix objectComputeSize
ranshid Aug 4, 2025
debe06d
return NULL when volatile set is not initialized
ranshid Aug 4, 2025
9d9f63b
bump the RDB version
ranshid Aug 4, 2025
bf97486
Revert "bump the RDB version"
ranshid Aug 4, 2025
8f3f619
fix some tests which are flaky
ranshid Aug 5, 2025
cf1c54c
Merge remote-tracking branch 'valkey-fork/ttl-poc-new' into introduce…
ranshid Aug 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion cmake/Modules/SourceFiles.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ set(VALKEY_SERVER_SRCS
${CMAKE_SOURCE_DIR}/src/connection.c
${CMAKE_SOURCE_DIR}/src/unix.c
${CMAKE_SOURCE_DIR}/src/server.c
${CMAKE_SOURCE_DIR}/src/logreqres.c)
${CMAKE_SOURCE_DIR}/src/logreqres.c
${CMAKE_SOURCE_DIR}/src/entry.c
${CMAKE_SOURCE_DIR}/src/vset.c)


# valkey-cli
set(VALKEY_CLI_SRCS
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ ENGINE_NAME=valkey
SERVER_NAME=$(ENGINE_NAME)-server$(PROG_SUFFIX)
ENGINE_SENTINEL_NAME=$(ENGINE_NAME)-sentinel$(PROG_SUFFIX)
ENGINE_TRACE_OBJ=trace/trace.o trace/trace_commands.o trace/trace_db.o trace/trace_bgsave.o trace/trace_cluster.o trace/trace_server.o trace/trace_aof.o
ENGINE_SERVER_OBJ=threads_mngr.o adlist.o vector.o quicklist.o ae.o anet.o dict.o hashtable.o kvstore.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o memory_prefetch.o io_threads.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o cluster_legacy.o cluster_slot_stats.o crc16.o endianconv.o commandlog.o eval.o bio.o rio.o rand.o memtest.o syscheck.o crcspeed.o crccombine.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o valkey-check-rdb.o valkey-check-aof.o geo.o lazyfree.o module.o evict.o expire.o geohash.o geohash_helper.o childinfo.o allocator_defrag.o defrag.o siphash.o rax.o t_stream.o listpack.o localtime.o lolwut.o lolwut5.o lolwut6.o acl.o tracking.o socket.o tls.o sha256.o timeout.o setcpuaffinity.o monotonic.o mt19937-64.o resp_parser.o call_reply.o script.o functions.o commands.o strl.o connection.o unix.o logreqres.o rdma.o scripting_engine.o lua/script_lua.o lua/function_lua.o lua/engine_lua.o lua/debug_lua.o
ENGINE_SERVER_OBJ=threads_mngr.o adlist.o vector.o quicklist.o ae.o anet.o dict.o hashtable.o kvstore.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o memory_prefetch.o io_threads.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o cluster_legacy.o cluster_slot_stats.o crc16.o endianconv.o commandlog.o eval.o bio.o rio.o rand.o memtest.o syscheck.o crcspeed.o crccombine.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o valkey-check-rdb.o valkey-check-aof.o geo.o lazyfree.o module.o evict.o expire.o geohash.o geohash_helper.o childinfo.o allocator_defrag.o defrag.o siphash.o rax.o t_stream.o listpack.o localtime.o lolwut.o lolwut5.o lolwut6.o acl.o tracking.o socket.o tls.o sha256.o timeout.o setcpuaffinity.o monotonic.o mt19937-64.o resp_parser.o call_reply.o script.o functions.o commands.o strl.o connection.o unix.o logreqres.o rdma.o scripting_engine.o entry.o vset.o lua/script_lua.o lua/function_lua.o lua/engine_lua.o lua/debug_lua.o
ENGINE_SERVER_OBJ+=$(ENGINE_TRACE_OBJ)
ENGINE_CLI_NAME=$(ENGINE_NAME)-cli$(PROG_SUFFIX)
ENGINE_CLI_OBJ=anet.o adlist.o dict.o valkey-cli.o zmalloc.o release.o ae.o serverassert.o crcspeed.o crccombine.o crc64.o siphash.o crc16.o monotonic.o cli_common.o mt19937-64.o strl.o cli_commands.o sds.o util.o sha256.o
Expand Down
2 changes: 0 additions & 2 deletions src/anet.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
#include "util.h"
#include "serverassert.h"

#define UNUSED(x) (void)(x)

static void anetSetError(char *err, const char *fmt, ...) {
va_list ap;

Expand Down
32 changes: 27 additions & 5 deletions src/aof.c
Original file line number Diff line number Diff line change
Expand Up @@ -1955,12 +1955,32 @@ static int rioWriteHashIteratorCursor(rio *r, hashTypeIterator *hi, int what) {
* The function returns 0 on error, 1 on success. */
int rewriteHashObject(rio *r, robj *key, robj *o) {
hashTypeIterator hi;
long long count = 0, items = hashTypeLength(o);

long long count = 0, volatile_items = 0, non_volatile_items;
/* First serialize volatile items if exist */
if (hashTypeHasVolatileElements(o)) {
hashTypeInitVolatileIterator(o, &hi);
while (hashTypeNext(&hi) != C_ERR) {
long long expiry = entryGetExpiry(hi.next);
sds field = entryGetField(hi.next);
sds value = entryGetValue(hi.next);
if (rioWriteBulkCount(r, '*', 8) == 0) return 0;
if (rioWriteBulkString(r, "HSETEX", 6) == 0) return 0;
if (rioWriteBulkObject(r, key) == 0) return 0;
if (rioWriteBulkString(r, "PXAT", 4) == 0) return 0;
if (rioWriteBulkLongLong(r, expiry) == 0) return 0;
if (rioWriteBulkString(r, "FIELDS", 6) == 0) return 0;
if (rioWriteBulkLongLong(r, 1) == 0) return 0;
if (rioWriteBulkString(r, field, sdslen(field)) == 0) return 0;
if (rioWriteBulkString(r, value, sdslen(value)) == 0) return 0;
volatile_items++;
}
hashTypeResetIterator(&hi);
}
non_volatile_items = hashTypeLength(o) - volatile_items;
hashTypeInitIterator(o, &hi);
while (hashTypeNext(&hi) != C_ERR) {
if (count == 0) {
int cmd_items = (items > AOF_REWRITE_ITEMS_PER_CMD) ? AOF_REWRITE_ITEMS_PER_CMD : items;
int cmd_items = (non_volatile_items > AOF_REWRITE_ITEMS_PER_CMD) ? AOF_REWRITE_ITEMS_PER_CMD : non_volatile_items;

if (!rioWriteBulkCount(r, '*', 2 + cmd_items * 2) || !rioWriteBulkString(r, "HMSET", 5) ||
!rioWriteBulkObject(r, key)) {
Expand All @@ -1969,16 +1989,18 @@ int rewriteHashObject(rio *r, robj *key, robj *o) {
}
}

if (volatile_items > 0 && entryHasExpiry(hi.next))
continue;

if (!rioWriteHashIteratorCursor(r, &hi, OBJ_HASH_FIELD) || !rioWriteHashIteratorCursor(r, &hi, OBJ_HASH_VALUE)) {
hashTypeResetIterator(&hi);
return 0;
}
if (++count == AOF_REWRITE_ITEMS_PER_CMD) count = 0;
items--;
non_volatile_items--;
}

hashTypeResetIterator(&hi);

return 1;
}

Expand Down
Loading
Loading