Skip to content

Commit b55bb22

Browse files
Harshit12cvijaygupta18
authored andcommitted
KV/Fix/Removed-Erraneous-DeadKey-Flag-From-FindOne
1 parent 3e0c960 commit b55bb22

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ The connector here only *reads* `meshCfg.secondaryRedisEnabled`; it's set in `sh
8484
### Reads
8585
- **`findWithKVConnector`** (`Flow.hs:927`) → `findOneFromRedis` (`:1091`):
8686
- Fetches from **primary** (`getDataFromPKeysRedis meshCfg.kvRedis`, `:1105`).
87-
- Checks **secondary ONLY** when `null primaryMatching && null primaryDeadRows && meshEnabled && secondaryRedisEnabled` (`:1119`). **A matching primary row short-circuits — secondary is never read.**
87+
- Checks **secondary ONLY** when `null primaryMatching && meshEnabled && secondaryRedisEnabled` (`:1119`). **A matching primary (live) row short-circuits — secondary is never read.
8888
- Both miss → DB; recache only if `IS_CACHING_DB_FIND_ENABLED`.
8989
- **Implication:** stale primary copy is returned over a fresher secondary copy. No version compare.
9090
- **`findAllWithKVAndConditionalDBInternal`** (`Flow.hs:1529`): when `secondaryRedisEnabled`, reads **both** clouds in parallel (`createMultiCloudConfigs`, `callKVKVAsync`) and `matchAndDeduplicateKVRows`. Dedup is **by primary key only** — primary wins over secondary; KV (possibly stale) wins over fresh DB (`getUniqueDBRes` excludes DB rows whose PK is in *any* KV row, live **or dead**).

src/EulerHS/KVConnector/Flow.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,9 +1114,8 @@ findOneFromRedis meshCfg whereClause = do
11141114
let primaryMatching = findAllMatching whereClause primaryLiveRows
11151115
-- Check secondary cloud Redis if:
11161116
-- 1. No matching rows in primary (even if raw rows exist)
1117-
-- 2. No dead rows (deleted data should not trigger fallback)
1118-
-- 3. Mesh and secondary enabled
1119-
if null primaryMatching && null primaryDeadRows && meshCfg.meshEnabled && meshCfg.secondaryRedisEnabled
1117+
-- 2. Mesh and secondary enabled
1118+
if null primaryMatching && meshCfg.meshEnabled && meshCfg.secondaryRedisEnabled
11201119
then do
11211120
Metrics.withKVLatencyMetric "REDIS_FIND_ONE" modelName "secondaryCluster" $ do
11221121
secondaryRowsRes <- foldEither <$> mapM (getDataFromPKeysRedis meshCfg.kvRedisSecondary) (mkUniq keyRes)

0 commit comments

Comments
 (0)