FuYouJ commented on code in PR #7666:
URL: https://github.com/apache/seatunnel/pull/7666#discussion_r1767121146


##########
seatunnel-connectors-v2/connector-redis/src/main/java/org/apache/seatunnel/connectors/seatunnel/redis/client/RedisClient.java:
##########
@@ -40,14 +44,42 @@ protected RedisClient(RedisParameters redisParameters, 
Jedis jedis) {
         this.redisParameters = redisParameters;
         this.batchSize = redisParameters.getBatchSize();
         this.jedis = jedis;
+        this.redisVersion = redisParameters.getRedisVersion();

Review Comment:
   ok,good idea. We can get the redis information through jedis.info(), so we 
can remove the configuration option for redis_version.
   
   ```java
   private int extractRedisVersion(Jedis jedis) {
           log.info("Try to get redis version information from the jedis.info() 
method");
           // # Server
           // redis_version:5.0.14
           // redis_git_sha1:00000000
           // redis_git_dirty:0
           String info = jedis.info();
           try {
               for (String line : info.split("\n")) {
                   if (line.startsWith("redis_version:")) {
                       // 5.0.14
                       String versionInfo = line.split(":")[1].trim();
                       log.info("The version of Redis is :{}", versionInfo);
                       String[] parts = versionInfo.split("\\.");
                       return Integer.parseInt(parts[0]);
                   }
               }
           } catch (Exception e) {
               throw new RedisConnectorException(
                       GET_REDIS_VERSION_INFO_FAILED,
                       GET_REDIS_VERSION_INFO_FAILED.getErrorMessage(),
                       e);
           }
           throw new RedisConnectorException(
                   GET_REDIS_VERSION_INFO_FAILED,
                   "Did not get the expected redis_version from the 
jedis.info() 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to