Program: 30985
Project: 30985
Buggy source:
@Test public void testServerRestart() throws Exception {
  final int size=10000;
  try (JournalWriter<Quote> remote=getWriterFactory().writer(Quote.class,"String_Node_Str",2 * size)){
    JournalServer server=newServer();
    server.publish(remote);
    server.start();
    final CountDownLatch connectedLatch=new CountDownLatch(1);
    JournalClient client=new JournalClient(new ClientConfig("String_Node_Str"){
{
        getReconnectPolicy().setLoginRetryCount(3);
        getReconnectPolicy().setRetryCount(5);
        getReconnectPolicy().setSleepBetweenRetriesMillis(TimeUnit.SECONDS.toMillis(1));
      }
    }
,getWriterFactory(),null,new JournalClient.Callback(){
      @Override public void onEvent(      int evt){
        if (evt == JournalClientEvents.EVT_CONNECTED) {
          connectedLatch.countDown();
        }
      }
    }
);
    final CountDownLatch latch=new CountDownLatch(1);
    getWriterFactory().writer(Quote.class,"String_Node_Str").close();
    try (final Journal<Quote> local=factoryContainer.getFactory().reader(Quote.class,"String_Node_Str")){
      client.subscribe(Quote.class,"String_Node_Str","String_Node_Str",2 * size,new JournalListener(){
        @Override public void onCommit(){
          try {
            if (local.refresh() && local.size() == 2 * size) {
              latch.countDown();
            }
          }
 catch (          JournalException e) {
            throw new JournalRuntimeException(e);
          }
        }
        @Override public void onEvent(        int event){
        }
      }
);
      client.start();
      Assert.assertTrue(connectedLatch.await(5,TimeUnit.SECONDS));
      TestUtils.generateQuoteData(remote,size,System.currentTimeMillis(),1);
      remote.commit();
      server.halt();
      server=newServer();
      server.publish(remote);
      server.start();
      TestUtils.generateQuoteData(remote,size,System.currentTimeMillis() + 2 * size,1);
      remote.commit();
      latch.await();
      client.halt();
      server.halt();
      TestUtils.assertDataEquals(remote,local);
    }
   }
 }

Fixed version (ground truth):
@Test @Ignore public void testServerRestart() throws Exception {
  final int size=10000;
  try (JournalWriter<Quote> remote=getWriterFactory().writer(Quote.class,"String_Node_Str",2 * size)){
    JournalServer server=newServer();
    server.publish(remote);
    server.start();
    final CountDownLatch connectedLatch=new CountDownLatch(1);
    JournalClient client=new JournalClient(new ClientConfig("String_Node_Str"){
{
        getReconnectPolicy().setLoginRetryCount(3);
        getReconnectPolicy().setRetryCount(5);
        getReconnectPolicy().setSleepBetweenRetriesMillis(TimeUnit.SECONDS.toMillis(1));
      }
    }
,getWriterFactory(),null,new JournalClient.Callback(){
      @Override public void onEvent(      int evt){
        if (evt == JournalClientEvents.EVT_CONNECTED) {
          connectedLatch.countDown();
        }
      }
    }
);
    final CountDownLatch latch=new CountDownLatch(1);
    getWriterFactory().writer(Quote.class,"String_Node_Str").close();
    try (final Journal<Quote> local=factoryContainer.getFactory().reader(Quote.class,"String_Node_Str")){
      client.subscribe(Quote.class,"String_Node_Str","String_Node_Str",2 * size,new JournalListener(){
        @Override public void onCommit(){
          try {
            if (local.refresh() && local.size() == 2 * size) {
              latch.countDown();
            }
          }
 catch (          JournalException e) {
            throw new JournalRuntimeException(e);
          }
        }
        @Override public void onEvent(        int event){
        }
      }
);
      client.start();
      Assert.assertTrue(connectedLatch.await(5,TimeUnit.SECONDS));
      TestUtils.generateQuoteData(remote,size,System.currentTimeMillis(),1);
      remote.commit();
      server.halt();
      server=newServer();
      server.publish(remote);
      server.start();
      TestUtils.generateQuoteData(remote,size,System.currentTimeMillis() + 2 * size,1);
      remote.commit();
      latch.await();
      client.halt();
      server.halt();
      TestUtils.assertDataEquals(remote,local);
    }
   }
 }