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

Always invoke on passive then track result #2945

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ public int getConcurrencyKey() {
}
};
}
messageHandler.invoke(realContext, message, this::invokePassiveInternal);
EhcacheEntityResponse resp = invokePassiveInternal(realContext, message);
messageHandler.invoke(realContext, message, (c, m) -> resp);
}

@SuppressWarnings("try")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,36 +142,6 @@ public void testInvalidMessageThrowsError() throws Exception {
}
}

@Test
public void testPassiveTracksMessageDuplication() throws Exception {
ClusterTierPassiveEntity passiveEntity = new ClusterTierPassiveEntity(defaultRegistry, defaultConfiguration, DEFAULT_MAPPER);
passiveEntity.createNew();

Chain chain = sequencedChainOf(createPayload(1L));
TestClientDescriptor client = TestClientDescriptor.newClient();

long clientId = 3;

PassiveReplicationMessage message1 = new PassiveReplicationMessage.ChainReplicationMessage(2, chain, 2L, 1L, clientId);
passiveEntity.invokePassive(client.invokeContext(), message1);

// Should be added
assertThat(passiveEntity.getStateService().getStore(passiveEntity.getStoreIdentifier()).get(2).isEmpty(), is(false));

Chain emptyChain = sequencedChainOf();
PassiveReplicationMessage message2 = new PassiveReplicationMessage.ChainReplicationMessage(2, emptyChain, 2L, 1L, clientId);
passiveEntity.invokePassive(client.invokeContext(), message2);

// Should not be cleared, message is a duplicate
assertThat(passiveEntity.getStateService().getStore(passiveEntity.getStoreIdentifier()).get(2).isEmpty(), is(false));

PassiveReplicationMessage message3 = new PassiveReplicationMessage.ChainReplicationMessage(2, chain, 3L, 1L, clientId);
passiveEntity.invokePassive(client.invokeContext(), message3);

// Should be added as well, different message id
assertThat(passiveEntity.getStateService().getStore(passiveEntity.getStoreIdentifier()).get(2).isEmpty(), is(false));
}

@Test
public void testOversizeReplaceAtHeadMessage() throws Exception {
ClusterTierPassiveEntity passiveEntity = new ClusterTierPassiveEntity(defaultRegistry, defaultConfiguration, DEFAULT_MAPPER);
Expand Down