taken out this code as it was causing isssue for OZAN when re starting an exisign code that had gone down in the cluser, as the old logic was preventing the data that originted from it flowing back in.

This commit is contained in:
Rob Austin
2016-01-21 14:33:11 +00:00
parent bd543e863b
commit c7a171da05
2 changed files with 55 additions and 5 deletions
@@ -742,11 +742,6 @@ final class ReplicatedChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? supe
throw new IllegalStateException("identifier can't be 0");
}
if (remoteIdentifier == ReplicatedChronicleMap.this.identifier()) {
// this may occur when working with UDP, as we may receive our own data
return;
}
setLastModificationTime(remoteIdentifier, bootstrapTime);
final long keyPosition = source.position();
@@ -1905,6 +1900,7 @@ final class ReplicatedChronicleMap<K, KI, MKI extends MetaBytesInterop<K, ? supe
long offset = segment.offsetFromPos(segmentPos);
final Bytes entry = segment.reuse2(tmpBytes, offset);
// it may not be successful if the buffer can not be re-sized so we will
// process it later, by NOT clearing the changes.clear(position)
final boolean success = entryCallback.onEntry(entry,
@@ -132,6 +132,60 @@ public class TCPSocketReplicationBootStrapTest {
}
@Test
public void test2() throws IOException, InterruptedException {
final ChronicleMap<java.lang.String, Integer> map1 = ChronicleMapBuilder.of(java.lang.String
.class, Integer.class)
.entries(Short.MAX_VALUE)
.instance()
.replicated(SingleChronicleHashReplication.builder()
.tcpTransportAndNetwork(TcpTransportAndNetworkConfig.of(5035))
.createWithId((byte) 1))
.create();
for (int i = 0; i < 500; i++) {
map1.put("1st map " + Integer.toString(i), i);
}
final ChronicleMap<java.lang.String, Integer> map2 = ChronicleMapBuilder.of(java.lang.String
.class, Integer.class)
.entries(Short.MAX_VALUE)
.instance()
.replicated(SingleChronicleHashReplication.builder()
.tcpTransportAndNetwork(TcpTransportAndNetworkConfig.of(5036, new
InetSocketAddress[]{new InetSocketAddress("localhost", 5035)}))
.createWithId((byte) 2))
.create();
while (map2.size() != 500 || map1.size() != 500 || !map1.equals(map2)) {
Thread.yield();
}
map1.close();
final ChronicleMap<java.lang.String, Integer> map1a = ChronicleMapBuilder.of(java.lang
.String
.class, Integer.class)
.entries(Short.MAX_VALUE)
.instance()
.replicated(SingleChronicleHashReplication.builder()
.tcpTransportAndNetwork(TcpTransportAndNetworkConfig.of(5039, new
InetSocketAddress[]{new InetSocketAddress("localhost", 5036)}))
.createWithId((byte) 1))
.create();
while (map2.size() != 500 || map1a.size() != 500 || !map1a.equals(map2)) {
Thread.yield();
}
Assert.assertEquals(map1a, map2);
}
@Test
public void testReplicationWhileModifying() throws IOException, InterruptedException {