V0.3.3 #4
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!4
Loading…
Reference in a new issue
No description provided.
Delete branch "0.3.3"
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:
ReplicationTestcovering command propagation and Partial Resync logic.JsonCommandTestforJSON.SETandJSON.GETwith nested paths.TDigestCommandTestforTD.ADD,TD.QUANTILE,TD.CDF.PersistenceCorruptionTestfor truncated RDB/AOF.ExpirationTestfor passive and active expiration.ClientBufferTestfor client stability under load.LuaConcurrencyTestfor script atomicity and isolation.MockClientHandlerfor consistency.In this commit:
Added the following benchmark scenarios:
Updated
main.rsto support--scenarioargument.In this commit:
Introduced
resetSingleton()methods inCaradeDatabaseandWriteSequencerto allow tests to clear static state.Updated
AofPersistenceTestto properly reset these singletons insetup(), ensuring thatCommandLoggerupdates are propagated correctly andCaradeDatabasestate (like eviction counters) is fresh. This prevents test pollution and the reported NullPointerException.And some other changes.
In this commit:
Validated the destination host in MigrateCommand to prevent connections to private/internal IP addresses.
Added a new test class MigrateCommandTest to verify the fix.
@ -0,0 +51,4 @@assertNotNull(client.lastResponse);// lastResponse is "[500.5]" because sendArray was usedString valStr = client.lastResponse.replace("[", "").replace("]", "");double median = Double.parseDouble(valStr);Missing catch of NumberFormatException
Potential uncaught 'java.lang.NumberFormatException'.
In general, to fix missing
NumberFormatExceptionhandling, you wrap the numeric parsing operation in atryblock and catchNumberFormatException, then handle it appropriately (e.g., log, convert to a test assertion failure, or propagate as a checked exception). For tests, the natural behavior is to fail the test with a clear message instead of letting an unchecked exception bubble up unannotated.Here, the best minimal fix is to wrap each
Double.parseDouble(valStr)in atry/catch (NumberFormatException e)and, in the catch block, callfail(...)from JUnit with a descriptive error message that includes the offending string and the exception. This preserves existing functionality when input is correct and provides clearer diagnostics when it is not, while satisfying the static analysis requirement thatNumberFormatExceptionbe handled. We only need to editsrc/test/java/core/commands/tdigest/TDigestCommandTest.javaaround lines 53–55 intestTDigestAccuracyand around lines 83–85 intestTDigestCDF. No extra imports are needed becausefailis already available viaimport static org.junit.jupiter.api.Assertions.*;.@ -0,0 +81,4 @@cdfCmd.execute(client, argsC);String valStr = client.lastResponse.replace("[", "").replace("]", "");double cdf = Double.parseDouble(valStr);Missing catch of NumberFormatException
Potential uncaught 'java.lang.NumberFormatException'.
In general, to fix this kind of issue, you should either (a) validate the string before parsing and fail with a clear message if the format is invalid, or (b) wrap the parse call in a
try/catchforNumberFormatExceptionand handle the error appropriately (e.g., fail the test with an informative assertion message). The goal is to avoid an uncaught runtime exception and to make failures explicit and meaningful.For this specific test file, the best targeted fix without changing intended functionality is to wrap
Double.parseDouble(valStr)in atry/catchthat catchesNumberFormatExceptionand callsfail(...)from JUnit with a descriptive message. That way, ifvalStrever stops being a valid double, the test will fail with a clear cause instead of throwing an unhandled exception. The normal case (valid double) will behave exactly as before. This change is localized totestTDigestCDFinsrc/test/java/core/commands/tdigest/TDigestCommandTest.java. No new imports are needed becausefailis already available viaimport static org.junit.jupiter.api.Assertions.*;.@ -0,0 +23,4 @@int chunkSize = 1024 * 1024; // 1MBbyte[] chunk = new byte[chunkSize];List<byte[]> largeData = new ArrayList<>();Container contents are never accessed
The contents of this container are never accessed.
To fix the problem, remove the unused container so that no list is created whose contents are never accessed. This keeps the test’s behavior identical while eliminating dead code.
Concretely, in
src/test/java/core/network/ClientBufferTest.java, insidetestSlowClientSimulation, remove the declaration and initialization oflargeDataand the line that addschunkto it:List<byte[]> largeData = new ArrayList<>();largeData.add(chunk);No additional imports, methods, or definitions are needed. The rest of the test continues to use
chunkdirectly as before.@ -0,0 +26,4 @@List<byte[]> largeData = new ArrayList<>();largeData.add(chunk);long start = System.currentTimeMillis();Unread local variable
Variable 'long start' is never read.
To fix the problem in general, remove local variables that are never read, or start using them meaningfully (e.g., for logging, assertions, or calculations). This keeps the code clean, reduces confusion, and avoids misleading indicators of functionality (such as performance measurement) that is not actually present.
In this specific case, the single best fix that does not change existing functionality is to delete the unused
long start = System.currentTimeMillis();line fromtestSlowClientSimulationinsrc/test/java/core/network/ClientBufferTest.java. The test currently does not assert on timing, and adding such behavior would alter its semantics. Removing the line keeps the test’s behavior exactly the same while eliminating the redundant variable. No new methods, imports, or definitions are required.@ -0,0 +30,4 @@run: |cd toolsruff format . --checkWorkflow does not contain permissions
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{contents: read}}
Show more details
@ -0,0 +48,4 @@- name: Run Benchmark (Test Only)run: |cd tools/rust-benchmarkscargo run --release -- --clients 20 --requests 2000 || exit 0Workflow does not contain permissions
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{contents: read}}
Show more details
In this commit:
Added detailed README.md files for:
src/main/java/core/structs/: Explaining algorithms (SkipList, HLL, BloomFilter).src/main/java/core/replication/: Explaining Master/Slave flow, Backlog, and PSYNC.src/main/java/core/server/: Explaining the Hybrid I/O + Single Writer threading model.tools/rust-benchmarks/: Explaining Rust setup and usage for benchmarking.These docs follow the standard "Carade Module Template".
Fixed a concurrency bug in
CaradeDatabase.get()where multiple threads accessing the same expired key could both trigger 'expired' notifications. The fix conditionalizes the notification on the successful removal of the key, ensuring the event is emitted exactly once per expiration.Added a suite of Python scripts in
tools/chaosto perform chaos engineering tests against the Carade server.Includes:
utils.pyfor shared RESP handling.README.mdwith usage instructions.@ -0,0 +68,4 @@run: |if [ -f server.pid ]; thenkill $(cat server.pid) || truefiWorkflow does not contain permissions
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{contents: read}}
Show more details
Seems fine