Repository navigation
NIFI-16582 Support Redis Enterprise and Cloud atomic map cache operations #11919
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
5ad0fac
NIFI-16582 Support Redis Enterprise and Cloud atomic map cache operat…
alberttwong b0e73a9
NIFI-16582 Use explicit types in Redis atomic cache integration tests
alberttwong 51122da
NIFI-16582 Address review feedback for Redis atomic cache documentation
alberttwong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...rg.apache.nifi.redis.service.RedisDistributedMapCacheClientService/additionalDetails.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| <!DOCTYPE html> | ||
|
alberttwong marked this conversation as resolved.
Resolved
|
||
| <!-- | ||
| Licensed to the Apache Software Foundation (ASF) under one or more | ||
| contributor license agreements. See the NOTICE file distributed with | ||
| this work for additional information regarding copyright ownership. | ||
| The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| (the "License"); you may not use this file except in compliance with | ||
| the License. You may obtain a copy of the License at | ||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| --> | ||
| <html lang="en"> | ||
| <head><meta charset="UTF-8"><title>Redis Distributed Map Cache</title></head> | ||
| <body> | ||
| <h2>Redis Enterprise Software and Redis Cloud</h2> | ||
| <p>Configure a RedisConnectionPoolService and select it as the Redis Connection Pool for this service.</p> | ||
| <table> | ||
| <tr><th>Connection pool property</th><th>Value</th></tr> | ||
| <tr><td>Redis Mode</td><td>Standalone for a database endpoint that routes commands through the Redis proxy, including sharded databases. | ||
| Select Cluster only if the endpoint exposes the Redis Cluster API and its advertised nodes are reachable from NiFi.</td></tr> | ||
| <tr><td>Connection String</td><td>The database endpoint as hostname:port. Use the database endpoint, not a management console or REST API endpoint. | ||
| Do not include a redis:// or rediss:// scheme.</td></tr> | ||
| <tr><td>Database Index</td><td>0. Redis Enterprise Software and Redis Cloud identify databases by endpoint.</td></tr> | ||
| <tr><td>Username</td><td>The database ACL user, or default when using the default user.</td></tr> | ||
| <tr><td>Password</td><td>The database user's password, supplied through a sensitive parameter.</td></tr> | ||
| <tr><td>SSL Context Service</td><td>Configure this when the database endpoint requires TLS. | ||
| Trust the database CA, and supply a client certificate and private key when mutual TLS is required.</td></tr> | ||
| </table> | ||
| <p>Standalone describes the client connection topology. It does not require an unsharded Redis server and does not disable | ||
| the availability or sharding provided by the Redis database endpoint.</p> | ||
| <h2>Atomic operations and permissions</h2> | ||
| <p>Conditional insert and replace operations act on one key at a time. The get-and-insert and compare-and-set operations use EVAL | ||
| with a single explicitly declared key, keeping the read, conditional write, and TTL update together on the server. | ||
| WATCH, MULTI, and EXEC are not required. Scripts and values are binary safe. Existing keys, values, and raw-value revisions | ||
| retain their format.</p> | ||
| <p>The Redis user needs permission for EVAL and the commands executed by these scripts (GET and SET), as well as commands | ||
| used by the cache operations the flow calls (including EXISTS, DEL, MSET, and EXPIRE). Configure key permissions for the | ||
| serialized cache keys. A server configured to prohibit scripting cannot use this atomic cache service.</p> | ||
| <p>TTL is applied when an entry is inserted or successfully replaced. A failed comparison or an insert against an existing key | ||
| leaves the value and its expiration unchanged. A TTL of 0 secs creates entries without expiration.</p> | ||
| <h2>Deployment considerations</h2> | ||
| <p>Single-key atomicity applies at the endpoint executing the operation. Redis Active-Active replication does not provide a | ||
| globally serialized compare-and-set across regions. Flows that require global coordination, such as duplicate detection or | ||
| Wait/Notify, should use one authoritative database rather than independent writable Active-Active regions.</p> | ||
| <p>Bulk putAll retains its existing MSET behavior; it does not promise a transaction across multiple hash slots. | ||
| Follow the database's multi-key command restrictions and use a common hash tag when a deployment requires keys in one slot.</p> | ||
| </body> | ||
| </html> | ||
29 changes: 29 additions & 0 deletions
29
...st/java/org/apache/nifi/redis/service/ITRedisClusterDistributedMapCacheClientService.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.nifi.redis.service; | ||
|
|
||
| /** | ||
| * Runs the atomic cache contract against the Redis Cluster API, with all hash slots assigned to one node. | ||
| * This exercises cluster command routing without requiring fixed Docker host ports or a multi-node network. | ||
| */ | ||
| public class ITRedisClusterDistributedMapCacheClientService extends ITRedisDistributedMapCacheClientService { | ||
|
alberttwong marked this conversation as resolved.
Resolved
|
||
|
|
||
| @Override | ||
| protected String getRedisMode() { | ||
| return "Cluster"; | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.