You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "xiaofan2022 (via GitHub)" <gi...@apache.org> on 2023/09/27 05:07:03 UTC

[GitHub] [seatunnel] xiaofan2022 opened a new pull request, #5570: Redis select db

xiaofan2022 opened a new pull request, #5570:
URL: https://github.com/apache/seatunnel/pull/5570

   
   ### Purpose of this pull request
   redis select_db index
   ### Does this PR introduce _any_ user-facing change?
   no
   ### 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
   * [x] If you are contributing the connector code, please check that the following files are updated:
     1. Update change log that in connector document. For more details you can refer to [connector-v2](https://github.com/apache/seatunnel/tree/dev/docs/en/connector-v2)
     2. Update [plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
     3. Update the pom file of [seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
   * [ ] Update the [`release-note`](https://github.com/apache/seatunnel/blob/dev/release-note.md).


-- 
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] [Improve][Connector-v2] Redis support select db [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on PR #5570:
URL: https://github.com/apache/seatunnel/pull/5570#issuecomment-1765804241

   Thanks @xiaofan2022 and @hailin0 @TyrantLucifer for review.


-- 
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] [Improve][Connector-v2] Redis select db [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #5570:
URL: https://github.com/apache/seatunnel/pull/5570#discussion_r1354381164


##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/RedisConfig.java:
##########
@@ -48,6 +48,13 @@ public enum HashKeyParseMode {
                     .withDescription(
                             "redis authentication password, you need it when you connect to an encrypted cluster");
 
+    public static final Option<Integer> DB_NUM =
+            Options.key("db_num")
+                    .intType()
+                    .defaultValue(0)
+                    .withDescription(
+                            "redis  database index id, It is connected to db 0 by default");

Review Comment:
   ```suggestion
                               "Redis database index id, it is connected to db 0 by default");
   ```



-- 
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] [Improve][Connector-v2] Redis support select db [seatunnel]

Posted by "xiaofan2022 (via GitHub)" <gi...@apache.org>.
xiaofan2022 commented on code in PR #5570:
URL: https://github.com/apache/seatunnel/pull/5570#discussion_r1357750246


##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/RedisConfig.java:
##########
@@ -48,6 +48,13 @@ public enum HashKeyParseMode {
                     .withDescription(
                             "redis authentication password, you need it when you connect to an encrypted cluster");
 
+    public static final Option<Integer> DB_NUM =
+            Options.key("db_num")
+                    .intType()
+                    .defaultValue(0)
+                    .withDescription(
+                            "redis  database index id, It is connected to db 0 by default");

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


[GitHub] [seatunnel] xiaofan2022 closed pull request #5570: Redis select db

Posted by "xiaofan2022 (via GitHub)" <gi...@apache.org>.
xiaofan2022 closed pull request #5570: Redis select db
URL: https://github.com/apache/seatunnel/pull/5570


-- 
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] Redis select db [seatunnel]

Posted by "TyrantLucifer (via GitHub)" <gi...@apache.org>.
TyrantLucifer commented on code in PR #5570:
URL: https://github.com/apache/seatunnel/pull/5570#discussion_r1345262624


##########
docs/en/connector-v2/sink/Redis.md:
##########
@@ -20,6 +20,7 @@ Used to write data to Redis.
 | data_type      | string | yes                   | -             |
 | user           | string | no                    | -             |
 | auth           | string | no                    | -             |
+| db_num         | int    | no                    | -             |

Review Comment:
   ```suggestion
   | db_num         | int    | no                    | 0            |
   ```



##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/RedisParameters.java:
##########
@@ -40,6 +40,7 @@ public class RedisParameters implements Serializable {
     private String host;
     private int port;
     private String auth = "";
+    private Integer dbNum;

Review Comment:
   ```suggestion
       private int dbNum;
   ```



##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/RedisParameters.java:
##########
@@ -148,7 +156,11 @@ public Jedis buildJedis() {
                 } else {
                     jedisCluster = new JedisCluster(nodes);
                 }
-                return new JedisWrapper(jedisCluster);
+                JedisWrapper jedisWrapper = new JedisWrapper(jedisCluster);
+                if (dbNum != null && dbNum > 0) {
+                    jedisWrapper.select(dbNum);

Review Comment:
   The same as above.



##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/RedisParameters.java:
##########
@@ -115,6 +120,9 @@ public Jedis buildJedis() {
                 if (StringUtils.isNotBlank(user)) {
                     jedis.aclSetUser(user);
                 }
+                if (dbNum != null && dbNum > 0) {
+                    jedis.select(dbNum);
+                }

Review Comment:
   ```suggestion
                       jedis.select(dbNum);
   ```



-- 
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] Redis select db [seatunnel]

Posted by "xiaofan2022 (via GitHub)" <gi...@apache.org>.
xiaofan2022 commented on code in PR #5570:
URL: https://github.com/apache/seatunnel/pull/5570#discussion_r1349481224


##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/RedisParameters.java:
##########
@@ -40,6 +40,7 @@ public class RedisParameters implements Serializable {
     private String host;
     private int port;
     private String auth = "";
+    private Integer dbNum;

Review Comment:
   done



##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/config/RedisParameters.java:
##########
@@ -115,6 +120,9 @@ public Jedis buildJedis() {
                 if (StringUtils.isNotBlank(user)) {
                     jedis.aclSetUser(user);
                 }
+                if (dbNum != null && dbNum > 0) {
+                    jedis.select(dbNum);
+                }

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] Redis select db [seatunnel]

Posted by "hailin0 (via GitHub)" <gi...@apache.org>.
hailin0 commented on PR #5570:
URL: https://github.com/apache/seatunnel/pull/5570#issuecomment-1751662735

   update PR title ?


-- 
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] [Improve][Connector-v2] Redis support select db [seatunnel]

Posted by "xiaofan2022 (via GitHub)" <gi...@apache.org>.
xiaofan2022 commented on PR #5570:
URL: https://github.com/apache/seatunnel/pull/5570#issuecomment-1765778543

   > Thank you for your contribution, overall LGTM, but you need offer e2e test cases for this change to verify it worked.
   
   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] [Improve][Connector-v2] Redis support select db [seatunnel]

Posted by "TyrantLucifer (via GitHub)" <gi...@apache.org>.
TyrantLucifer merged PR #5570:
URL: https://github.com/apache/seatunnel/pull/5570


-- 
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