You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "JeremyXin (via GitHub)" <gi...@apache.org> on 2025/09/16 15:47:34 UTC
[PR] [Feature][Connector-redis] fix redis cluster bug and add cluster e2e [seatunnel]
JeremyXin opened a new pull request, #9869:
URL: https://github.com/apache/seatunnel/pull/9869
<!--
Thank you for contributing to SeaTunnel! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
## Contribution Checklist
- Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/seatunnel/issues).
- Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
- Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
-->
### Purpose of this pull request
<!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
fix: #9865
The main job of pr:
1. Fixed the bug of `ReidsClusterClient`, where `RedisDataType.SET.set` passes in the created jedis object instead of `this` to fix #9865
2. 'RedisSourceReader' supports cluster mode, and the 'ReidsClusterClient' class implements the 'scanKeyResult' method in cluster mode
3. Support the format of TEXT
4. Add redis cluster e2e testing
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released SeaTunnel versions or within the unreleased branches such as dev.
If no, write 'No'.
If you are adding/modifying connector documents, please follow our new specifications: https://github.com/apache/seatunnel/issues/4544.
-->
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
If you are adding E2E test cases, maybe refer to https://github.com/apache/seatunnel/blob/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-mysql-e2e/src/test/resources/mysqlcdc_to_mysql.conf, here is a good example.
-->
### Check list
* [ ] If any new Jar binary package adding in your PR, please add License Notice according
[New License Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/contribution/new-license.md)
* [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs
* [ ] If you are contributing the connector code, please check that the following files are updated:
1. Update [plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
2. Update the pom file of [seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
3. Add ci label in [label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
4. Add e2e testcase in [seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
5. Update connector [plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Connector-redis] fix redis cluster bug and add cluster e2e [seatunnel]
Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #9869:
URL: https://github.com/apache/seatunnel/pull/9869#discussion_r2357432393
##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/JedisWrapper.java:
##########
@@ -82,6 +89,48 @@ public List<String> zrange(final String key, final long start, final long stop)
return jedisCluster.zrange(key, start, stop);
}
+ @Override
+ public String info() {
+ Map<String, ConnectionPool> nodes = jedisCluster.getClusterNodes();
+ if (nodes.isEmpty()) {
+ throw new RedisConnectorException(
+ GET_REDIS_INFO_ERROR, "No available nodes in cluster");
+ }
+
+ // Traverse all nodes and try to obtain the info
+ Exception lastException = null;
+ for (Map.Entry<String, ConnectionPool> entry : nodes.entrySet()) {
+ ConnectionPool pool = entry.getValue();
+ try {
+ try (Jedis jedis = new Jedis(pool.getResource())) {
Review Comment:
ditto
##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/sink/RedisSinkWriter.java:
##########
@@ -101,28 +108,28 @@ private static String getNormalKey(SeaTunnelRow element, List<String> fields, St
}
}
- private String getCustomKey(SeaTunnelRow element, List<String> fields, String keyField) {
- String[] keyFieldSegments = keyField.split(REDIS_GROUP_DELIMITER);
- StringBuilder key = new StringBuilder();
- for (int i = 0; i < keyFieldSegments.length; i++) {
- String keyFieldSegment = keyFieldSegments[i];
- if (keyFieldSegment.startsWith(LEFT_PLACEHOLDER_MARKER)
- && keyFieldSegment.endsWith(RIGHT_PLACEHOLDER_MARKER)) {
- String realKeyField = keyFieldSegment.substring(1, keyFieldSegment.length() - 1);
- if (fields.contains(realKeyField)) {
- Object realFieldValue = element.getField(fields.indexOf(realKeyField));
- key.append(realFieldValue == null ? "" : realFieldValue.toString());
- } else {
- key.append(keyFieldSegment);
- }
- } else {
- key.append(keyFieldSegment);
- }
- if (i != keyFieldSegments.length - 1) {
- key.append(REDIS_GROUP_DELIMITER);
- }
+ protected String getCustomKey(SeaTunnelRow element, List<String> fields, String keyField) {
+ Matcher matcher = PLACEHOLDER_PATTERN.matcher(keyField);
+ StringBuffer result = new StringBuffer();
Review Comment:
Let's reuse `PlaceholderUtils`
##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/client/RedisClusterClient.java:
##########
@@ -155,10 +162,66 @@ public void batchWriteZset(
int size = keys.size();
for (int i = 0; i < size; i++) {
if (rowKinds.get(i) == RowKind.DELETE || rowKinds.get(i) == RowKind.UPDATE_BEFORE) {
- RedisDataType.ZSET.del(this, keys.get(i), values.get(i));
+ RedisDataType.ZSET.del(jedis, keys.get(i), values.get(i));
+ } else {
+ RedisDataType.ZSET.set(jedis, keys.get(i), values.get(i), expireSeconds);
+ }
+ }
+ }
+
+ /** In cluster mode, traverse and scan each node key */
+ @Override
+ public ScanResult<String> scanKeyResult(
+ final String cursor, final ScanParams params, final RedisDataType type) {
+ // Create a composite cursor to traverse the cluster nodes: the format is "Node Index: Node
+ // cursor"
+ int nodeIndex = 0;
+ String nodeCursor = cursor;
+ boolean isFirstScan = !cursor.contains(":");
+
+ if (!ScanParams.SCAN_POINTER_START.equals(cursor) && cursor.contains(":")) {
+ String[] parts = cursor.split(":", 2);
+ nodeIndex = Integer.parseInt(parts[0]);
+ nodeCursor = parts[1];
+ }
+
+ // All nodes have been scanned
+ if (nodeIndex >= nodes.size()) {
+ return new ScanResult<>(ScanParams.SCAN_POINTER_START, new ArrayList<>());
+ }
+
+ ConnectionPool pool = nodes.get(nodeIndex).getValue();
+ List<String> resultKeys;
+ String nextCursor;
+
+ try (Jedis jedis = new Jedis(pool.getResource())) {
Review Comment:
Can we cache Jedis client to save CPU cost?
##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/JedisWrapper.java:
##########
@@ -82,6 +89,48 @@ public List<String> zrange(final String key, final long start, final long stop)
return jedisCluster.zrange(key, start, stop);
}
+ @Override
+ public String info() {
Review Comment:
Could you explain why this method can fix https://github.com/apache/seatunnel/issues/9865 ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Connector-redis] fix redis cluster bug and add cluster e2e [seatunnel]
Posted by "zhangshenghang (via GitHub)" <gi...@apache.org>.
zhangshenghang commented on code in PR #9869:
URL: https://github.com/apache/seatunnel/pull/9869#discussion_r2355766881
##########
docs/en/connector-v2/source/Redis.md:
##########
@@ -252,21 +253,44 @@ connector will generate data as the following:
| ---- | ----------- | ------- |
| 200 | get success | true |
-when you assign format is `text`, connector will do nothing for upstream data, for example:
+when you assign format is `text`, you can choose to specify the schema information or not.
-upstream data is the following:
-
-```json
-{"code": 200, "data": "get success", "success": true}
+For example, upstream data is the following:
+```text
+200#get success#true
```
+If you do not assign data schema connector will treat the upstream data as the following:
+
+| content |
+| -------------------------------------------------------- |
+| 200#get success#true |
+
+If you assign data schema, you should also assign the option `schema` and `field_delimiter` as following:
+
+```hocon
+field_delimiter = "#"
+schema {
+ fields {
+ code = int
+ data = string
+ success = boolean
+ }
+}
+
+```
Review Comment:
I have a question. Text format has been applied to Redis here. However, it is still not supported in HTTP. Do we need to modify the HTTP connector separately in the future?
https://github.com/apache/seatunnel/blob/02c7eb3177989bcd50ba6c1059862c1586d3fa39/docs/en/connector-v2/source/Http.md?plain=1#L176C1-L177C1
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Connector-redis] fix redis cluster bug and add cluster e2e [seatunnel]
Posted by "JeremyXin (via GitHub)" <gi...@apache.org>.
JeremyXin commented on code in PR #9869:
URL: https://github.com/apache/seatunnel/pull/9869#discussion_r2418815831
##########
docs/zh/connector-v2/sink/Redis.md:
##########
@@ -210,7 +223,7 @@ Redis {
Redis {
host = localhost
port = 6379
- key = "name:{name}"
+ key = "name:${name}"
Review Comment:
done. In the `getCustomKey` method, placeholders in the old version format are compatible
##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/JedisWrapper.java:
##########
@@ -17,19 +17,30 @@
package org.apache.seatunnel.connectors.seatunnel.redis.config;
+import org.apache.seatunnel.connectors.seatunnel.redis.exception.RedisConnectorException;
+import org.apache.seatunnel.connectors.seatunnel.redis.exception.RedisErrorCode;
+
import lombok.NonNull;
+import lombok.extern.slf4j.Slf4j;
+import redis.clients.jedis.ConnectionPool;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisCluster;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import static org.apache.seatunnel.connectors.seatunnel.redis.exception.RedisErrorCode.GET_REDIS_INFO_ERROR;
+
+@Slf4j
public class JedisWrapper extends Jedis {
private final JedisCluster jedisCluster;
+ private final Map<String, Jedis> jedisPoolMap = new HashMap<>();
public JedisWrapper(@NonNull JedisCluster jedisCluster) {
this.jedisCluster = jedisCluster;
+ initJedisConnectionCache();
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Connector-redis] fix redis cluster bug and add cluster e2e [seatunnel]
Posted by "zhangshenghang (via GitHub)" <gi...@apache.org>.
zhangshenghang merged PR #9869:
URL: https://github.com/apache/seatunnel/pull/9869
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Connector-redis] fix redis cluster bug and add cluster e2e [seatunnel]
Posted by "JeremyXin (via GitHub)" <gi...@apache.org>.
JeremyXin commented on code in PR #9869:
URL: https://github.com/apache/seatunnel/pull/9869#discussion_r2358904347
##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/sink/RedisSinkWriter.java:
##########
@@ -101,28 +108,28 @@ private static String getNormalKey(SeaTunnelRow element, List<String> fields, St
}
}
- private String getCustomKey(SeaTunnelRow element, List<String> fields, String keyField) {
- String[] keyFieldSegments = keyField.split(REDIS_GROUP_DELIMITER);
- StringBuilder key = new StringBuilder();
- for (int i = 0; i < keyFieldSegments.length; i++) {
- String keyFieldSegment = keyFieldSegments[i];
- if (keyFieldSegment.startsWith(LEFT_PLACEHOLDER_MARKER)
- && keyFieldSegment.endsWith(RIGHT_PLACEHOLDER_MARKER)) {
- String realKeyField = keyFieldSegment.substring(1, keyFieldSegment.length() - 1);
- if (fields.contains(realKeyField)) {
- Object realFieldValue = element.getField(fields.indexOf(realKeyField));
- key.append(realFieldValue == null ? "" : realFieldValue.toString());
- } else {
- key.append(keyFieldSegment);
- }
- } else {
- key.append(keyFieldSegment);
- }
- if (i != keyFieldSegments.length - 1) {
- key.append(REDIS_GROUP_DELIMITER);
- }
+ protected String getCustomKey(SeaTunnelRow element, List<String> fields, String keyField) {
+ Matcher matcher = PLACEHOLDER_PATTERN.matcher(keyField);
+ StringBuffer result = new StringBuffer();
Review Comment:
done, also the placeholder representation in the original configuration needs to be changed, from :{placeholder} to :${placeholder}
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Connector-redis] fix redis cluster bug and add cluster e2e [seatunnel]
Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #9869:
URL: https://github.com/apache/seatunnel/pull/9869#discussion_r2357405295
##########
docs/en/connector-v2/source/Redis.md:
##########
@@ -252,21 +253,44 @@ connector will generate data as the following:
| ---- | ----------- | ------- |
| 200 | get success | true |
-when you assign format is `text`, connector will do nothing for upstream data, for example:
+when you assign format is `text`, you can choose to specify the schema information or not.
-upstream data is the following:
-
-```json
-{"code": 200, "data": "get success", "success": true}
+For example, upstream data is the following:
+```text
+200#get success#true
```
+If you do not assign data schema connector will treat the upstream data as the following:
+
+| content |
+| -------------------------------------------------------- |
+| 200#get success#true |
+
+If you assign data schema, you should also assign the option `schema` and `field_delimiter` as following:
+
+```hocon
+field_delimiter = "#"
+schema {
+ fields {
+ code = int
+ data = string
+ success = boolean
+ }
+}
+
+```
Review Comment:
Yes, we can do the same thing in HTTP. LocalFile already did this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Connector-redis] fix redis cluster bug and add cluster e2e [seatunnel]
Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #9869:
URL: https://github.com/apache/seatunnel/pull/9869#discussion_r2382545397
##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/JedisWrapper.java:
##########
@@ -82,8 +93,65 @@ public List<String> zrange(final String key, final long start, final long stop)
return jedisCluster.zrange(key, start, stop);
}
+ @Override
+ public String info() {
+ Map<String, ConnectionPool> nodes = jedisCluster.getClusterNodes();
+ if (nodes.isEmpty()) {
+ throw new RedisConnectorException(
+ GET_REDIS_INFO_ERROR, "No available nodes in cluster");
+ }
+
+ // Traverse all nodes and try to obtain the info
+ for (Map.Entry<String, Jedis> entry : jedisPoolMap.entrySet()) {
+ try {
+ Jedis jedis = entry.getValue();
+ return jedis.info();
+ } catch (Exception e) {
+ log.warn("Failed to get info from node: {}", entry.getKey(), e);
+ }
+ }
+
+ throw new RedisConnectorException(
+ GET_REDIS_INFO_ERROR, "Failed to get redis info from all node in cluster");
+ }
+
+ @Override
+ public String type(String key) {
+ return jedisCluster.type(key);
+ }
+
+ public Map<String, ConnectionPool> getClusterNodes() {
+ return jedisCluster.getClusterNodes();
+ }
+
+ @Override
+ public long expire(final String key, final long seconds) {
+ return jedisCluster.expire(key, seconds);
+ }
+
@Override
public void close() {
jedisCluster.close();
Review Comment:
we should close `JedisConnectionCache` too?
##########
docs/zh/connector-v2/sink/Redis.md:
##########
@@ -210,7 +223,7 @@ Redis {
Redis {
host = localhost
port = 6379
- key = "name:{name}"
+ key = "name:${name}"
Review Comment:
I think we should do some special case for redis to make sure legacy behavior work fine too.
##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/JedisWrapper.java:
##########
@@ -17,19 +17,30 @@
package org.apache.seatunnel.connectors.seatunnel.redis.config;
+import org.apache.seatunnel.connectors.seatunnel.redis.exception.RedisConnectorException;
+import org.apache.seatunnel.connectors.seatunnel.redis.exception.RedisErrorCode;
+
import lombok.NonNull;
+import lombok.extern.slf4j.Slf4j;
+import redis.clients.jedis.ConnectionPool;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisCluster;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import static org.apache.seatunnel.connectors.seatunnel.redis.exception.RedisErrorCode.GET_REDIS_INFO_ERROR;
+
+@Slf4j
public class JedisWrapper extends Jedis {
private final JedisCluster jedisCluster;
+ private final Map<String, Jedis> jedisPoolMap = new HashMap<>();
public JedisWrapper(@NonNull JedisCluster jedisCluster) {
this.jedisCluster = jedisCluster;
+ initJedisConnectionCache();
Review Comment:
let's create connection with lazy mode. I think most time we should not use it.
##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/JedisWrapper.java:
##########
@@ -82,6 +89,48 @@ public List<String> zrange(final String key, final long start, final long stop)
return jedisCluster.zrange(key, start, stop);
}
+ @Override
+ public String info() {
Review Comment:
I got it. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Connector-redis] fix redis cluster bug and add cluster e2e [seatunnel]
Posted by "JeremyXin (via GitHub)" <gi...@apache.org>.
JeremyXin commented on code in PR #9869:
URL: https://github.com/apache/seatunnel/pull/9869#discussion_r2358892598
##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/client/RedisClusterClient.java:
##########
@@ -155,10 +162,66 @@ public void batchWriteZset(
int size = keys.size();
for (int i = 0; i < size; i++) {
if (rowKinds.get(i) == RowKind.DELETE || rowKinds.get(i) == RowKind.UPDATE_BEFORE) {
- RedisDataType.ZSET.del(this, keys.get(i), values.get(i));
+ RedisDataType.ZSET.del(jedis, keys.get(i), values.get(i));
+ } else {
+ RedisDataType.ZSET.set(jedis, keys.get(i), values.get(i), expireSeconds);
+ }
+ }
+ }
+
+ /** In cluster mode, traverse and scan each node key */
+ @Override
+ public ScanResult<String> scanKeyResult(
+ final String cursor, final ScanParams params, final RedisDataType type) {
+ // Create a composite cursor to traverse the cluster nodes: the format is "Node Index: Node
+ // cursor"
+ int nodeIndex = 0;
+ String nodeCursor = cursor;
+ boolean isFirstScan = !cursor.contains(":");
+
+ if (!ScanParams.SCAN_POINTER_START.equals(cursor) && cursor.contains(":")) {
+ String[] parts = cursor.split(":", 2);
+ nodeIndex = Integer.parseInt(parts[0]);
+ nodeCursor = parts[1];
+ }
+
+ // All nodes have been scanned
+ if (nodeIndex >= nodes.size()) {
+ return new ScanResult<>(ScanParams.SCAN_POINTER_START, new ArrayList<>());
+ }
+
+ ConnectionPool pool = nodes.get(nodeIndex).getValue();
+ List<String> resultKeys;
+ String nextCursor;
+
+ try (Jedis jedis = new Jedis(pool.getResource())) {
Review Comment:
done, replace the `scanKeyResult` method in the cluster mode with directly using the `jedisCluster.scan` method
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Connector-redis] fix redis cluster bug and add cluster e2e [seatunnel]
Posted by "JeremyXin (via GitHub)" <gi...@apache.org>.
JeremyXin commented on code in PR #9869:
URL: https://github.com/apache/seatunnel/pull/9869#discussion_r2358095879
##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/JedisWrapper.java:
##########
@@ -82,6 +89,48 @@ public List<String> zrange(final String key, final long start, final long stop)
return jedisCluster.zrange(key, start, stop);
}
+ @Override
+ public String info() {
Review Comment:
It turns out that when writing to set type data, the `batchWriteSet` method of `RedisClusterClient` class:`RedisDataType'.SET.set(this,...) `. The passed jedis object is `this`, but this jedis object actually did not initialize the `Connection` connection, which led to the error #9865. The actual jedis object that should be used is the Jedis object passed in from the constructor.
The `info` method rewritten in `JedisWrapper` is designed to support querying redis version information in cluster mode. The `edisWrapper` class inherits from the `Jedis` class, but does not initialize the `Connection` object of the parent class. Therefore, the execution of all Jedis-related methods should go through `JedisCluster`. Instead of executing the methods in the parent class Jedis (all of which will result in execution errors due to the `Connection` not being initialized).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Feature][Connector-redis] fix redis cluster bug and add cluster e2e [seatunnel]
Posted by "zhangshenghang (via GitHub)" <gi...@apache.org>.
zhangshenghang commented on code in PR #9869:
URL: https://github.com/apache/seatunnel/pull/9869#discussion_r2355766881
##########
docs/en/connector-v2/source/Redis.md:
##########
@@ -252,21 +253,44 @@ connector will generate data as the following:
| ---- | ----------- | ------- |
| 200 | get success | true |
-when you assign format is `text`, connector will do nothing for upstream data, for example:
+when you assign format is `text`, you can choose to specify the schema information or not.
-upstream data is the following:
-
-```json
-{"code": 200, "data": "get success", "success": true}
+For example, upstream data is the following:
+```text
+200#get success#true
```
+If you do not assign data schema connector will treat the upstream data as the following:
+
+| content |
+| -------------------------------------------------------- |
+| 200#get success#true |
+
+If you assign data schema, you should also assign the option `schema` and `field_delimiter` as following:
+
+```hocon
+field_delimiter = "#"
+schema {
+ fields {
+ code = int
+ data = string
+ success = boolean
+ }
+}
+
+```
Review Comment:
I have a question. Text format has been applied to Redis here. However, it is still not supported in HTTP. Do we need to modify the HTTP connector separately in the future? @Hisoka-X
https://github.com/apache/seatunnel/blob/02c7eb3177989bcd50ba6c1059862c1586d3fa39/docs/en/connector-v2/source/Http.md?plain=1#L176C1-L177C1
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org