Carade v0.2.0 #1
No reviewers
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
rust
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
codetease/carade!1
Loading…
Reference in a new issue
No description provided.
Delete branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In this commit:
ZSETsupport withZADD,ZRANGE(withWITHSCORES), andZRANK.MSETandMGET.CaradeZSetusingConcurrentHashMapandConcurrentSkipListSet.ZSET.ZADDwith multiple arguments andMSET.In this commit:
MULTI,EXEC,DISCARDfor atomic transactions.SISMEMBER,SCARD,HINCRBY.HSET,LPUSH,RPUSHto support variadic arguments.executeCommandhelper.globalLockto ensure atomicity for transactions and safe execution.In this commit:
ReentrantLockwithReentrantReadWriteLockto allow concurrent execution of normal commands while maintaining atomicity for transactions (EXEC).ValueEntrymemory usage by storing values asbyte[]instead ofString, reducing heap overhead and GC pressure.In this commit:
Updated
Carade.javato support these commands in both client handler and AOF replay logic.Ensured AOF replay logic (
executeInternal) does not perform client I/O.In this commit:
ClientHandler.runto acquire the global Write Lock forRENAME,MSET,FLUSHALL, andBGREWRITEAOF.RENAMEremoving a key that is then read by another thread before being re-inserted).ConcurrentHashMapfor concurrency.In this commit:
Implemented the
WATCHandUNWATCHcommands to support optimistic locking in transactions. This ensures that if a watched key is modified by another client, the transaction will be aborted. ModifiedCarade.javato track watched keys and notify clients upon modification. UpdatedClientHandlerto manage the watch state and transaction dirty flag. Instrumented all write commands (SET, DEL, HSET, etc.) to trigger notifications. Addressed code review feedback regarding thread safety by makingtransactionDirtyvolatile and ensuring atomic cleanup inunwatchAll.In this commit:
Refactored Resp.java and ValueEntry (in Carade.java) to use byte[] instead of String to ensure binary safety. Updated AofHandler to support binary data persistence. Verified with a test script sending non-UTF8 bytes.
gtg, good night.
In this commit:
scanRegistryto store stateful iterators for SCAN commands.handleScanhelper method to supportMATCHandCOUNT.ZCARD(O(1)),ZCOUNT(O(N) for range), andZINCRBY.ZINCRBY.AtomicLongfor cursor ID generation.In this commit:
ZNode,CaradeZSet,ValueEntry,DataTypetocore.structsandcore.db.core.db.CaradeDatabaseto managestore, eviction, and atomic operations.ClientHandlertocore.network, decoupled fromCarademain class.core.commands.Commandinterface andCommandRegistry.SetCommand: MigratedSETcommand to the new pattern.Carade.javato serve as bootstrap and AOF replayer.ClientHandlerto useCommandRegistrywith fallback to legacy switch-case.carade.dumpfiles.In this commit:
PersistCommand: Removes expiration from a key.ClientSetNameCommand: Sets the name of the current connection.ClientGetNameCommand: Retrieves the name of the current connection.In this commit:
GeoUtils.javato handle Geohash encoding/decoding and distance calculations (matching Redis logic).GEOADD: Adds geospatial items to a ZSet.GEODIST: Calculates distance between two members.GEORADIUS: Finds members within a given radius (implemented via naive iteration for simplicity/speed in prototype).Resp.javaandClientHandler.javato support sending mixed-type nested arrays, required byGEORADIUSoutput options.CommandRegistry.In this commit:
RdbParsercapable of reading standard Redis RDB files, including support for:RdbEncoderto save snapshots in RDB format (Version 9).Carade.javato detect "REDIS" magic header and useRdbParser, falling back to legacy loaders if needed.saveDatato use RDB format.In this commit:
CaradeDatabaseto support 16 databases using an array ofConcurrentHashMap.ClientHandlerto maintaindbIndexand route commands to the correct database.SELECTcommand to switch databases.LTRIMcommand for list truncation.RPOPLPUSHcommand for atomic list moves.SELECTopcodes.SELECTandFLUSHDBto maintain consistency during replay.BGREWRITEAOFto persist all non-empty databases.This change decouples command execution, introduces a Global Write Sequencer,
and implements a Replication Backlog to ensure strict ordering of data mutations.
Key changes:
core.server.WriteSequencerto coordinate DB updates, Backlog writes, and AOF logging atomically.core.replication.ReplicationBacklog(Ring Buffer) for future PSYNC support.AofHandlertoCommandLogger, integrating it with the Sequencer.ClientHandlerto route all write commands (e.g., SET, INCR, HSET, ZADD) through the Sequencer.ClientHandler.In this commit:
REPLICAOF,PSYNC,ReplicationManager) using RDB snapshots and Backlog catch-up.__keyspace__events) inCaradeDatabase.maxmemory-policy) including LRU.ValueEntry(lazy compression of small collections).ClientHandlerandRdbEncoderto useValueEntry.getValue()for safe access.In this commit:
HMGETcommand incore.commands.hash.HmgetCommandand registered it.keyspaceHitsandkeyspaceMissesAtomicLong counters tocore.Carade.core.db.CaradeDatabase.get()to update keyspace stats.INFOcommand incore.network.ClientHandlerto display real keyspace stats.core.protocol.Resp.bulkString()when handling null byte arrays.In this commit:
GeoAddCommandandExpireAtCommandto useexecuteWritefor proper AOF/Replication.Carade.executeInternalto handleGEOADD,EXPIREAT, andPEXPIREATduring AOF replay.GET,DEL,LPOP,RPOP,HSET,HGETfromClientHandlerswitch-case to standalone Command classes.Carade.java.