Skip to content

lease-read: wrap remaining adapter read handlers in LeaseRead (deferred from #549) #557

@bootjp

Description

@bootjp

Background

PR #549 wraps three high-traffic read paths in LeaseRead:

  • adapter/redis_lua_context.go newLuaScriptContext
  • adapter/redis.go get
  • adapter/dynamodb.go getItem

The remaining read handlers were left to a follow-up to keep PR #549 reviewable.

Scope

  • adapter/redis.go: keys, exists-family, ZSet readers (zrange, zcard, zscore, zrangebyscore, ...), Hash readers (hget, hgetall, hmget, hexists, hlen, ...), List readers (lindex, llen, lrange, ...), Set readers (smembers, sismember, scard, ...), Stream readers (xread, xrange, xlen, ...).
  • adapter/dynamodb.go: query, scan, transactGetItems, batchGetItem.

Why low priority

Under sustained load the per-shard lease is kept warm by:

  • Coordinate.Dispatch / leaseRefreshingTxn (writes refresh on commit).
  • Lua scripts that call LeaseRead at script entry.

Not wrapping these handlers means: they read local LastCommitTS with no quorum check, the same trade-off they had before PR #549. The PR has not regressed safety; it has just not finished tightening it.

Acceptance

  • Each handler entry calls r.coordinator.LeaseReadForKey(ctx, key) (or LeaseRead(ctx) for keyless ops) once before resolving readTS.
  • Bounded context.WithTimeout for handlers that don't have a request-scoped deadline (mirrors the pattern in redis.go get after PR feat(lease-read): leader-local lease read for coordinator and engine #549).
  • Cyclop hits → extract input parsing into helpers.

References: PR #549, follow-up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions