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

Read-Through can't be rolled back #85

Open
ghost opened this issue Jul 18, 2014 · 0 comments
Open

Read-Through can't be rolled back #85

ghost opened this issue Jul 18, 2014 · 0 comments

Comments

@ghost
Copy link

ghost commented Jul 18, 2014

I'm running gridgain 6.1.9, I need to load some data from RDBMS to several caches in a transaction via read-through, I wrote a unit test, it doesn't work.

From http://atlassian.gridgain.com/wiki/display/GG619/Pluggable+Persistent+Storage , I found "All read-through and write-through operations will participate in overall cache transaction and will be committed or rolled back as a whole."

To my understanding, following scenario should work, steps:

  1. one record in DB, no any data in cache
  2. start a transaction
  3. cache.get(key), load data to cache via read-through
  4. rollback transaction
  5. no any data in cache again

Part of the testing code:

JotmJtaTxMgrLookup.beginTransaction();
logger.info("cache.get({}) before rollback, it should be loaded from DB", id);
gotEmployee = cache.get(id);
assertEquals(name, gotEmployee.getName());
Employee employee = new Employee(2L, "test2");
cache.put(2L, employee);
JotmJtaTxMgrLookup.rollbackTransaction();
assertNull(cache.get(2L)); // it's rolled back
logger.info("cache.get({}) after rollback, it should be loaded again from DB", id); // but it doesn't
gotEmployee = cache.get(id);
assertEquals(name, gotEmployee.getName());

I'll push the whole testing project to GitHub if it's necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants