Skip to content

Add Redis DSL connector - #807

Open
huangguasky wants to merge 1 commit into
apache:masterfrom
huangguasky:feature/issue-799-redis-connector
Open

Add Redis DSL connector#807
huangguasky wants to merge 1 commit into
apache:masterfrom
huangguasky:feature/issue-799-redis-connector

Conversation

@huangguasky

Copy link
Copy Markdown

What changes were proposed in this pull request?

This PR adds a new Redis DSL connector module, geaflow-dsl-connector-redis. For issue #799:

The Redis connector supports:

  • Writing Redis string and hash data through RedisTableSink.
  • Reading Redis string and hash data through RedisTableSource.
  • Scanning Redis keys by pattern with the Redis SCAN command.
  • Registering the connector through SPI with connector type REDIS.

This PR also adds Redis connector configuration keys, CN/EN documentation with SQL examples, and unit tests based on jedis-mock. The connector reuses the existing Jedis dependency already managed by the project.

How was this PR tested?

  • Tests have Added for the changes
  • Production environment verified

Verified with:

mvn -pl geaflow-dsl/geaflow-dsl-connector/geaflow-dsl-connector-redis -am test -Dtest=RedisTableConnectorTest -Dsurefire.failIfNoSpecifiedTests=false -DskipITs

Fixes https://github.com/apache/geaflow/issues/799

@johntomcat7408-cmyk johntomcat7408-cmyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked this against #799 and left a few inline comments on authentication, partition handling, and config logging.

The issue also asks for a Testcontainers test. The current jedis-mock tests do not cover real Redis authentication or the source partition check. The branch currently conflicts with master and needs a rebase.

Is the column-mapped hash mode intended to be sink-only? If so, the source should reject that configuration and the docs should state the limitation.

String password = conf.getString(RedisConfigKeys.GEAFLOW_DSL_REDIS_PASSWORD);
int timeout = conf.getInteger(RedisConfigKeys.GEAFLOW_DSL_REDIS_CONNECTION_TIMEOUT);
GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
return new JedisPool(poolConfig, host, port, timeout, user, password);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both options default to empty strings. With Jedis 3.3, this overload still attempts authentication because user is non-null, so a Redis instance without authentication rejects the connection. Please select the no-auth, password-only, or ACL constructor according to the configured values.

}

@Override
public void setIndex(int index, int parallel) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GeaFlowTableSourceFunction calls listPartitions(parallelism) repeatedly and compares the returned lists. RedisPartition currently uses identity equality, so an unchanged partition list is reported as modified. setIndex also replaces the bucket used by accept(), which can lead to missed or duplicate keys. Please keep the logical bucket unchanged and implement equals/hashCode from it.


@Override
public void init(Configuration tableConf, StructType schema) {
LOGGER.info("Prepare redis sink with config: {}, schema: {}", tableConf, schema);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Configuration.toString() includes the raw values. This log will expose geaflow.dsl.redis.password when it is configured. Please remove the full configuration from this message or mask the password.

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