Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calls of JSONOperations run outside of watch, multi, exec transaction #377

Open
gbereczkiotpm opened this issue Jan 8, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@gbereczkiotpm
Copy link

If I create a call chain of watch, multi, json set and exec to be sure the key is not changed before I overwrite it, the json set call is outside of the transaction:

stringRedisTemplate.execute(new SessionCallback<Object>() {
      @Override
      public <K, V> Object execute(RedisOperations<K, V> operations) throws DataAccessException {
        redisModulesOperations.getTemplate().watch("testkey");
        redisModulesOperations.getTemplate().multi();
        redisModulesOperations.opsForJSON().set("testkey", testObject);
        redisModulesOperations.getTemplate().exec();
        return null;
      }
    });

the monitor shows the following calls in Redis:

1704720449.710937 [0 172.17.0.1:40306] "AUTH" "(redacted)"
1704720449.712575 [0 172.17.0.1:40306] "CLIENT" "SETINFO" "LIB-NAME" "jedis"
1704720449.712590 [0 172.17.0.1:40306] "CLIENT" "SETINFO" "LIB-VER" "4.4.6"
1704720449.777548 [0 172.17.0.1:40306] "WATCH" "testkey"
1704720449.789129 [0 172.17.0.1:40294] "JSON.SET" "testkey" "." "{\"name\":\"somename\",\"version\":1}"
1704720449.840494 [0 172.17.0.1:40306] "MULTI"
1704720449.841950 [0 172.17.0.1:40306] "EXEC"
1704720449.843131 [0 172.17.0.1:40306] "UNWATCH"
@bsbodden bsbodden self-assigned this Jan 9, 2024
@bsbodden bsbodden added the bug Something isn't working label Jan 9, 2024
@bsbodden
Copy link
Contributor

Currently the underlying client class JedisUnified won't allow it, but I have a branch to refactor this once it is supported.

@bsbodden
Copy link
Contributor

@sazzad16 is this something that's available in Jedis 5.2.x?

@sazzad16
Copy link
Contributor

@bsbodden We have merged this PR to address this issue/request targeting Jedis 5.2.0. Does it work for you?

@bsbodden
Copy link
Contributor

@maorohana-redis this feature in Jedis 5.2.0 will like be needed to handle "transactions"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants