Skip to content

Latest commit

 

History

History
170 lines (117 loc) · 6.06 KB

3to4.md

File metadata and controls

170 lines (117 loc) · 6.06 KB

Breaking Changes from Jedis 3 to Jedis 4 and Hints to Migrate

  • BinaryJedis and BinaryJedisCluster classes have been removed.

    Methods of these classes are available in Jedis and JedisCluster classes respectively.

  • Each of the following cases now throws an IllegalStateException instead of a JedisDataException.

    • Cannot use Jedis when in Multi. Please use Transaction or reset Jedis state.
    • Cannot use Jedis when in Pipeline. Please use Pipeline or reset Jedis state.
  • Transaction inside Pipeline have been removed. E.g. multi(), exec() and discard() methods have been removed from Pipeline.

  • execGetResponse() method has been removed from Transaction.

  • watch and unwatch methods of Transaction class is unsupported within MULTI (after multi() method). These can be used before MULTI.

  • JedisCluster constructors with GenericObjectPoolConfig<Jedis> now accepts GenericObjectPoolConfig<Connection>.

  • JedisCluster constructors throws JedisClusterOperationException if these could not connect to any of the provided HostAndPort(s). Previously, these would go into unusable state.

  • JedisCluster.getClusterNodes() returns Map<String, ConnectionPool> instead of Map<String, JedisPool>.

  • JedisCluster.getConnectionFromSlot(int) returns Connection instead of Jedis.

  • JedisNoReachableClusterNodeException has been removed. JedisClusterOperationException with a similar message is thrown instead.

  • JedisClusterMaxAttemptsException has been removed. JedisClusterOperationException with with a similar message is thrown instead.

  • JedisExhaustedPoolException has been removed. A JedisException with a similar message is thrown instead.

  • Many SortedSet methods return Java List instead of Set. Listed here

  • Many methods return primitive values (long/boolean/double instead of Long/Boolean/ Double). Listed here

  • scriptExists(byte[]) method now returns Boolean instead of Long.

  • scriptExists(byte[]...) method now returns List<Boolean> instead of List<Long>.

  • In xadd method with StreamEntryID parameter, sending untyped null raises conflict.

    Casting the null to StreamEntryID ((StreamEntryID) null) resolves this issue.

  • In xrange and xrevrange methods with StreamEntryID parameters, sending untyped nulls for both start and end parameters raises conflicts.

    Casting the nulls to StreamEntryID ((StreamEntryID) null) resolves this issue.

  • The return type of Jedis.shutdown() is now void. Previously, ideally, it would return null.

  • eval and evalsha methods are now non-blocking. These have been blocking in Jedis 3.x.

  • HostAndPort.localhost variable has been removed.

  • These methods have been removed from HostAndPort class:

    • extractParts
    • parseString
    • convertHost
    • setLocalhost
    • getLocalhost
    • getLocalHostQuietly
  • These classes have been moved to the redis.clients.jedis.args package.

    • BitOP
    • GeoUnit
    • ListPosition
  • These classes have been moved to the redis.clients.jedis.params package.

    • BitPosParams
    • ScanParams
    • SortingParams
    • ZParams
  • These classes have been moved to the redis.clients.jedis.resps package.

    • AccessControlLogEntry
    • AccessControlUser
    • GeoRadiusResponse
    • ScanResult
    • Slowlog
    • StreamConsumersInfo
    • StreamEntry
    • StreamGroupInfo
    • StreamInfo
    • StreamPendingEntry
    • StreamPendingSummary
    • Tuple
  • Jedis and JedisPool constructors with a String parameter, and no int parameter only support a URL or URI string.

    • Jedis(String)
    • JedisPool(String)
    • JedisPool(String, SSLSocketFactory, SSLParameters, HostnameVerifier)
    • JedisPool(GenericObjectPoolConfig, String)
  • Client and BinaryClient classes have been removed.

  • redis.clients.jedis.commands package has been reimplemented, meaning Commands interfaces have been restructured.

  • ShardedJedisPool, Sharded, ShardedJedis, BinaryShardedJedis, ShardInfo, JedisShardInfo classes have been removed.

    • Introduced JedisSharding class to replace ShardedJedisPool.

      Earlier code without the use of "name" and "weight" (in ShardInfo/JedisShardInfo) are transferable to the new class.

  • ShardedJedisPipeline class has been removed.

    • Introduced ShardedPipeline class to replace ShardedJedisPipeline.
  • The type of Protocol.CHARSET has been changed to java.nio.charset.Charset.

  • Jedis.debug(DebugParams) method has been removed.

  • DebugParams class has been removed.

  • Jedis.sync() method has been removed.

  • Jedis.pubsubNumSub(String...) method now returns Map<String, Long> instead of Map<String, String>.

  • setDataSource method in Jedis class now has protected access.

  • JedisPoolAbstract class has been removed. Use Pool.

  • Pool.initPool() method has been removed.

  • Pool.getNumActive() now returns 0 (via GenericObjectPool) when the Pool is closed.

  • Connection.getRawObjectMultiBulkReply() method has been removed. Use Connection.getUnflushedObjectMultiBulkReply() method.

  • Queable.getResponse(Builder builder) method has been renamed to Queable.enqueResponse(Builder builder).

  • All methods in Queable are now final:

    • clean()
    • generateResponse(Object data)
    • enqueResponse(Builder builder)
    • getPipelinedResponseLength()
  • These BuilderFactory implementations have been removed.

    • OBJECT (use RAW_OBJECT)
    • BYTE_ARRAY_ZSET (use BINARY_LIST or BINARY_SET)
    • BYTE_ARRAY_MAP (use BINARY_MAP)
    • STRING_ZSET (use STRING_LIST or STRING_SET)
    • EVAL_RESULT (use ENCODED_OBJECT)
    • EVAL_BINARY_RESULT (use RAW_OBJECT)
  • All String variables representing Cluster, Sentinel and PubSub subcommands in Protocol class have been removed.

  • ClientKillParams.Type has been removed. Use ClientType.

  • ClusterReset has been removed. Use ClusterResetType.

  • JedisClusterHostAndPortMap interface has been removed. Use the HostAndPortMapper interface.

  • JedisClusterHashTagUtil class has been renamed to JedisClusterHashTag.

  • KeyMergeUtil class has been removed.