advisedy opened a new pull request, #3564:
URL: https://github.com/apache/kvrocks/pull/3564
Fixes #2177.
### Problem
`FLUSHDB` / `FLUSHALL` is implemented via `DeleteRange` on the metadata
CF, but the replication path did not propagate it:
- `WriteBatchExtractor::DeleteRangeCF` was a no-op, so the delete was
silently dropped and never translated into a Redis command on replicas
or kvrocks2redis.
- `Database::FlushAll` merged all namespaces into a single `DeleteRange`,
which could not be mapped back to any specific namespace.
### Fix
- `FlushAll` now emits one `DeleteRange` per namespace in the same batch.
- `DeleteRangeCF` translates those ranges into a per-namespace `FLUSHDB`,
and rejects unrecognized ranges with a warning.
### Tests
- Go integration test `TestReplicationFlushDBAcrossNamespaces`:
reproduces the issue with `repl-namespace-enabled=yes`.
- C++ gtests in `batch_extractor_test.cc` for single-namespace `FLUSHDB`,
multi-namespace `FLUSHALL`, and unrecognized ranges.
### AI-assisted contribution
The tests were generated by an LLM. I reviewed all of them to make sure
they are correct and meaningful.
### Scope
Only covers plain `FLUSHDB` / `FLUSHALL`. The `MULTI`/`EXEC` case
mentioned in #2177 is not handled here — I'm not sure what kind of
approach would fit best, and would appreciate reviewer input.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]