Skip to content

NIFI-16582 Support Redis Enterprise and Cloud atomic map cache operations - #11919

Merged
pvillard31 merged 3 commits into
apache:mainfrom
alberttwong:redis-enterprise-cloud
Nov 23, 2026
Merged

pvillard31 merged 3 commits into
apache:mainfrom
alberttwong:redis-enterprise-cloud

Conversation

@alberttwong

@alberttwong alberttwong commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

NIFI-16582

RedisDistributedMapCacheClientService supports Redis Enterprise Software and Redis Cloud database proxy endpoints, including single-shard and sharded databases on one or multiple nodes. Configure the Redis connection pool in Standalone mode for these proxy endpoints; Redis handles backend shard and node routing. Standalone describes the client connection mode, not the server's shard or node count.

This change replaces WATCH/MULTI/EXEC conditional cache operations with single-key Lua scripts for get-and-insert and compare-and-set, and SET NX with expiration for conditional inserts. It preserves serialization, raw-value revisions, and TTL behavior, and removes the validation restriction against Cluster connection pools. SimpleRedisDistributedMapCacheClientService is unchanged.

Upgrade ACL requirement: existing Standalone and Sentinel users must grant EVAL, GET, SET, and access to the serialized cache keys before upgrading. WATCH/MULTI/EXEC permissions alone are insufficient for getAndPutIfAbsent and replace. Other cache methods retain their command requirements.

Connection mode and Redis topology

Standalone mode — routing by the database proxy. NiFi connects to one Redis Enterprise Software or Redis Cloud database endpoint. The Redis proxy routes each request to the appropriate backend shard, including when shards are distributed across multiple nodes. Standalone mode does not mean an unsharded or single-node server. This is the connection path covered by the live Enterprise/Cloud acceptance matrix below.

Cluster mode — topology-aware routing by the client. With Redis's optional OSS Cluster API enabled, NiFi's client discovers the hash-slot topology, connects to proxies on the relevant nodes, and handles client redirects when necessary. This can reduce internal forwarding and improve latency or throughput. It requires a cluster-aware client and network reachability to the advertised endpoints. It is an optional routing optimization, not a requirement for a sharded Enterprise/Cloud deployment.

Both modes still use Redis Enterprise proxies. The difference is whether the client discovers and selects node endpoints or delegates shard routing to a single database endpoint. Redis Software supports the OSS Cluster API when its documented prerequisites are met; on Redis Cloud it is available for Pro databases.

Official Redis documentation:

Verification

Live Enterprise Software and Cloud acceptance — November 18, 2026

Validated production source at b0e73a9, using JDK 21 and local external-endpoint test harnesses. All entries below used NiFi Standalone mode, password authentication, and TLS; Cluster API was disabled on these fixtures.

Platform Cluster nodes Primary shards Replication Integration executions passed
Redis Software 1 1 No 13
Redis Software 1 3 No 13
Redis Software 3 1 Yes 14
Redis Software 3 3 No 14
Redis Cloud Pro Service-managed, multi-AZ 1 Yes 14
Redis Cloud Pro Service-managed, multi-AZ 2 Yes 14

These six runs passed 82 integration executions, with zero failures, errors, or skips. Replica shards are excluded from the primary count. Cloud multi-zone replication was confirmed through the Cloud API; no independent physical-host census is claimed.

Software version: 8.2.6-52, database engine 8.8.0. Cloud Pro: Redis version 8.6 reported by the control plane. Software tests verified effective 4x QPF before testing: active scaling factor 4, six Search workers, mnp routing, and 32 connections. Cloud API readbacks confirmed 4x QPF.

The original 12-case atomic cache contract covered binary/empty values, absent/matching/stale revisions, positive/zero TTL, expiration on success/conflict, and competing inserts/replacements with exactly one winner. An additional probe exercised 96 distinct hash tags. The later 14-case runs also covered bulk writes, existence checks, reads, deletes, and repeated deletes. On three-node Software, per-primary key counts matched slot ownership with 30, 36, and 30 keys, a primary on each node.

Additional Software scenarios passed:

  • Restricted ACL excluding WATCH, MULTI, and EXEC: 14 cases. Test cleanup and TTL inspection permissions were also granted.
  • mTLS with that restricted ACL: 14 cases. Separate transport checks rejected missing client certificates and untrusted server certificates.
  • Missing EVAL: two NiFi cases required explicit NOPERM errors and verified no insertion or replacement occurred.
  • Planned primary failover: one case verified retained data and subsequent cache operations using the same NiFi pool.
  • Abrupt loss of the primary's node: one case verified replica promotion and subsequent operations using the same pool through a surviving proxy.
  • Live one-to-three-shard expansion: one case ran continuous atomic operations, then read back all 7,516 acknowledged cycles, without mutation retries.

Total: 115 selected integration executions passed, plus targeted topology unit tests and two transport-negative checks. The failover tests paused mutations between the before/after phases; they do not establish lossless recovery of in-flight writes or exactly-once retries. The resharding workload did run during the topology change.

The external-endpoint harnesses are local acceptance artifacts and are not yet committed to this PR. Production source remained unchanged during these runs. The NiFi services, Redis client, scripts, TLS connections, and servers were real; a test SSLContextProvider supplied a real Java SSLContext. Maven reactor verify passed; Checkstyle and PMD were skipped for these local harness runs. Both temporary Cloud databases, their Pro subscription, and the local Software fixture were deleted after validation. Credentials, endpoints, infrastructure identifiers, and raw operational artifacts remain private.

Earlier committed-fixture validation

  • JDK 21 reactor build and Redis NAR packaging passed.
  • Six unit cases and 24 integration cases passed, with no failures or skips, against authenticated Redis 8.8 standalone and one-node Cluster API fixtures. Both fixtures deny WATCH/MULTI/EXEC and disable the default user.
  • Checkstyle passed for both changed modules. The explicit-type PMD follow-up passed targeted package pmd:check and verify.
./mvnw -B -P integration-tests \
  -pl nifi-extension-bundles/nifi-redis-bundle/nifi-redis-nar -am verify \
  -Dtest=TestRedisConnectionPoolService,TestRedisDistributedMapCacheClientService \
  -Dsurefire.failIfNoSpecifiedTests=false \
  -Dit.test=ITRedisDistributedMapCacheClientService,ITRedisClusterDistributedMapCacheClientService \
  -Dfailsafe.failIfNoSpecifiedTests=false

Remaining checks and review follow-ups

  • Full ./mvnw clean install -P contrib-check
  • JDK 25 validation
  • Convert component additional details from HTML to additionalDetails.md, then visually verify them in a running NiFi instance
  • Add the ACL migration note to Jira/release-note tracking
  • Reword the TTL test comment around expected behavior
  • Document the committed one-node Cluster API fixture's lack of MOVED/ASK coverage

Multi-node OSS Cluster API redirects remain unverified by the new proxy matrix. This does not limit the verified Enterprise/Cloud proxy topology support above. Single-key atomic operations do not provide globally serialized compare-and-set across independent writable Active-Active regions. Bulk putAll retains its MSET behavior without a cross-slot transaction guarantee.

Licensing

No dependencies added or upgraded; no dependency LICENSE/NOTICE changes.

…ions

Replace transaction-based conditional operations with single-key Lua scripts, support Cluster connections, and document managed database endpoint configuration. Add authenticated standalone and Cluster API regression coverage.
@alberttwong
alberttwong force-pushed the redis-enterprise-cloud branch from 883a371 to b0e73a9 Compare November 16, 2026 19:51
@alberttwong
alberttwong marked this pull request as ready for review November 16, 2026 19:53
@alberttwong

Copy link
Copy Markdown
Contributor Author

@pvillard31 I completed live acceptance testing at b0e73a9 and updated the PR description with the matrix, connection-mode guidance, and remaining checks.

Standalone mode connects NiFi to one Enterprise Software or Redis Cloud database proxy endpoint. Redis routes requests across its backend shards and nodes, so this mode supports sharded, multi-node deployments. Cluster mode / OSS Cluster API makes the client discover the slot topology and connect to the relevant node proxies; it can reduce internal forwarding but is not required for sharded proxy access. Official references: proxy policies, Cluster API architecture, and Cloud clustering.

Software passed 1 node / 1 shard, 1 node / 3 shards, 3 nodes / 1 replicated primary, and 3 nodes / 3 primaries. Newly provisioned Cloud Pro databases with 1 and 2 primary shards also passed, both with TLS and multi-zone replication. These tests used Standalone mode. Software runs verified effective 4x QPF; Cloud readbacks confirmed 4x QPF.

115 selected integration executions passed, including restricted ACLs without WATCH/MULTI/EXEC, mTLS, missing-EVAL refusals without changing data, planned failover, abrupt primary-node loss, and continuous atomic operations during a one-to-three-shard expansion (7,516 cycles read back, no mutation retries). The external-endpoint harnesses are local artifacts and are not yet committed; the description distinguishes those runs from the committed fixtures.

The MOVED/ASK gap remains on the separate Cluster API test path. These proxy tests do not establish multi-node client redirects or global Active-Active compare-and-set. Temporary test resources were deleted.

@pvillard31

Copy link
Copy Markdown
Contributor

@alberttwong - I don't see any change on the PR. Expected? a missing push?

@alberttwong

Copy link
Copy Markdown
Contributor Author

@pvillard31 Sorry, the source changes hadn't been pushed. They're in now: the docs moved to additionalDetails.md with an upgrade note on the new EVAL permission, the cluster IT Javadoc notes the MOVED/ASK gap, and the TTL test comment is reworded. I'll add the same upgrade note to NIFI-16582.

Convert the RedisDistributedMapCacheClientService additional details to
Markdown so they appear in the NiFi 2.x UI, add an upgrade note for the
new EVAL permission requirement, document that the single-node Cluster
test does not exercise MOVED or ASK redirects, and describe expected TTL
behavior in the replacement test comment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alberttwong
alberttwong force-pushed the redis-enterprise-cloud branch from 25843c0 to 51122da Compare November 20, 2026 17:18
@alberttwong

Copy link
Copy Markdown
Contributor Author

@pvillard31 All four review threads are addressed in 51122da, and CI is green. Could you take another look when you have a chance?

@pvillard31
pvillard31 merged commit 39ed1fb into apache:main Nov 23, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants