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

ISPN-7911 Functional commands do not invalidate L1 cache #5197

Closed
wants to merge 1 commit into from

Conversation

rvansa
Copy link
Member

@rvansa rvansa commented Jun 13, 2017

  • includes minor refactoring of L1-related interceptors to remove synchronous waiting

https://issues.jboss.org/browse/ISPN-7911

Copy link
Contributor

@karesti karesti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor comments, otherwise LGTM

Object KEY = getKeyForCache(primary, backup);
primary.put(KEY, "value");

assertEquals(null, reader.getAdvancedCache().getDataContainer().get(KEY));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use assertNull

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would, but regrettably AssertJUnit then says only 'value was expected to be null' and does not specify that; It's more useful for debugging to use assertEquals(null, ...)

assertEquals(null, reader.getAdvancedCache().getDataContainer().get(KEY));
assertEquals("value", reader.get(KEY));

assertEntry(primary.getAdvancedCache().getDataContainer().get(KEY), "value", false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this getAdvancedCache().getDataContainer().get(KEY) be done inside assertEntry method ?

assertEntry(primary.getAdvancedCache().getDataContainer().get(KEY), "value", false);
assertEntry(backup.getAdvancedCache().getDataContainer().get(KEY), "value", false);
assertEntry(reader.getAdvancedCache().getDataContainer().get(KEY), "value", true);
assertEquals(null, nonOwner.getAdvancedCache().getDataContainer().get(KEY));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assertNull


assertEntry(primary.getAdvancedCache().getDataContainer().get(KEY), "value2", false);
assertEntry(backup.getAdvancedCache().getDataContainer().get(KEY), "value2", false);
assertEquals(null, reader.getAdvancedCache().getDataContainer().get(KEY));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assertNull

@rvansa
Copy link
Member Author

rvansa commented Jun 13, 2017

Cleaned up.
Apropos, the follow up PR will be https://github.com/rvansa/infinispan/tree/ISPN-7910

@galderz
Copy link
Member

galderz commented Jun 15, 2017

Looks good. CI didn't complete last time for other reasons, let's wait for it.

@karesti
Copy link
Contributor

karesti commented Jun 19, 2017

@rvansa I took the commit to continue my tests on the multimap and I realized the FunctionalL1Test does not compile due to the PR where you moved the API from commons to core

@rvansa
Copy link
Member Author

rvansa commented Jun 19, 2017

@karesti Thanks, updated.

Copy link
Member

@danberindei danberindei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big thanks for making all the L1 interceptors async!

I only have one simplification request.

return asyncValue(f.handle((nil, throwable) -> {
// Ignore SuspectExceptions - if the node has gone away then there is nothing to invalidate anyway.
if (throwable != null && !(throwable.getCause() instanceof SuspectException)) {
getLog().failedInvalidatingRemoteCache(throwable);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flushCache always uses SYNC_IGNORE_LEAVERS, so this isn't necessary. SYNC would return too early anyway, if we wanted to log invalidations that failed because nodes left we'd have to use a ResponseFilter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I was merely refactoring the code. I'll remove this.

@rvansa
Copy link
Member Author

rvansa commented Jun 20, 2017

The interceptors are not really async; L1NonTxnterceptor.performL1Lookup still blocks on L1WriteSynchronizer, it was out of scope of this PR to fix that. But IIUC I made the RPCs non-blocking.

@rvansa
Copy link
Member Author

rvansa commented Jun 20, 2017

Rebased, removed the two checks for SuspectException

@danberindei
Copy link
Member

@rvansa I see, L1WriteSynchronizer still needs a little CompletableFuture love... but I'm still thankful for the async RPC :)

return rv;
}
return asyncValue(f.handle((nil, throwable) -> {
// Ignore SuspectExceptions - if the node has gone away then there is nothing to invalidate anyway.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment still mentions SuspectException`.

TBH I didn't read the code close enough, I just assumed exceptions other than SuspectException fail the write because one node now sees a stale value, and that you'd be able to remove asyncReturnValue altogether. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code just logged the exception and continued. I can propagate the failure, but the method can't be ridden of because we need to swap the return value to rv.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping for an opinion on whether to continue or to propagate the failure :)

However, in the meantime I found that L1NonTxInterceptor already propagates the exception, so I propose doing the same in L1TxInterceptor and in L1LastChanceInterceptor.

@rvansa
Copy link
Member Author

rvansa commented Jun 21, 2017

OK, rethrowing exceptions.

@karesti
Copy link
Contributor

karesti commented Jun 21, 2017

@rvansa the FunctionalL1Test does not compile anymore 😢

* includes minor refactoring of L1-related interceptors to remove synchronous waiting
@rvansa
Copy link
Member Author

rvansa commented Jun 21, 2017

😡 fixed

@danberindei
Copy link
Member

Integrated, thanks Radim!

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