Repository navigation
Add spark.redis.client.name and the client.name source option - #419
Merged
Merged
Conversation
Every connection the connector opens can now carry a client name, as CLIENT LIST shows (name=...). Set spark.redis.client.name for the whole job; a DataFrame source's client.name option overrides it for that source. Without the setting, or with an empty value, connections stay unnamed as before. - RedisEndpoint gets a clientName field (default null). The SparkConf and SparkConf + parameters constructors read it, and the nodes RedisConfig discovers (cluster nodes, replicas, a replica's master) inherit it. - ConnectionPool passes it to JedisFactory, so Jedis sends CLIENT SETNAME after AUTH and SELECT on each new pooled connection. Pools are keyed by endpoint, so each name gets its own pool. - A name Redis would refuse (anything but printable ASCII without spaces) fails on the driver with an IllegalArgumentException that names the setting and option, before any connection is opened. Tests: ClientNameConfigSuite (precedence, empty, validation; no server), two ConnectionPoolTest cases, and ClientNameSuite on standalone, cluster and standalone ACL. Those run RDD and DataFrame jobs, then read CLIENT LIST on every node and check each connection the job opened. Docs: doc/configuration.md and the DataFrame options table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 23, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #398.
Problem
There's no way to name the connector's connections, so in
CLIENT LISTa Spark job's connections can't be told apart from any other client's. Jedis can sendCLIENT SETNAMEon each new connection, butConnectionPoolnever passes it a name.Change
spark.redis.client.namenames every connection the connector opens: on the driver and on the executors, and to every node of a cluster.CLIENT LISTthen shows it asname=.... Unset or empty (the default) leaves connections unnamed, as before.client.nameDataFrame option overrides it for one source. Like the other connection options, it overrides only its own setting. An empty value leaves that source's connections unnamed.RedisEndpointgets aclientNamefield (defaultnull):SparkConfconstructors read it;RedisConfigdiscovers (cluster nodes, replicas, a replica's master) inherit it.ConnectionPoolpasses it to the Jedis factory, which sendsCLIENT SETNAMEafterAUTHandSELECTon each new pooled connection. Pools are keyed by endpoint, so each name gets its own pool.CLIENT SETINFO(library name and version) is still sent.IllegalArgumentExceptionthat names the setting and the option, before any connection is opened.doc/configuration.md(the parameter, the override table, andCLIENT SETNAMEamong the commands the connector sends) and the DataFrame options table.Tests
ClientNameConfigSuiteneeds no Redis. It covers precedence between the setting and the option, empty values, and validation.ConnectionPoolTest: two cases. A pooled connection to an endpoint with a name carries it inCLIENT LIST, next to the library info. One without a name has none.ClientNameSuiteruns on standalone, cluster, and standalone with an ACL user. It runs RDD and DataFrame jobs, then readsCLIENT LISTon every node and checks the name of each connection the job opened:Locally: JDK 8. CI here runs Redis 6.0.10 on the old fixed ports, so I ran the full suite with this change on top of #417's Testcontainers harness:
redis:7.4redis:8.6That's upstream's 295 tests plus the 23 new ones, with
scalatest-maven-plugin2.2.0 from the plugin PR. This PR doesn't depend on either: CI here runs it on Redis 6.0.10, whereCLIENT SETNAMEandCLIENT IDexist, andConnectionPoolTestchecks the library info only whereCLIENT SETINFOset it (Redis 7.2+).🤖 Generated with Claude Code