Description
Steps to reproduce:
1. Set up synchronization between two servers S1 and S2
2. Stop server S2
3. Wait more than refresh interval
4. Start server S2
Observed result:
S1 never read/update data from S2
Reason:
When connection lost and we tried to reconnect at least one time, ReplicationConsumerImpl.disconnected field become equals to true.
ReplicationConsumerImpl:
private ReplicationStatusEnum doRefreshOnly() { while ( !disconnected ) { CONSUMER_LOG.debug( "==================== Refresh Only ==========" ); try { doSyncSearch( SynchronizationModeEnum.REFRESH_ONLY, reload ); CONSUMER_LOG.debug( "--------------------- Sleep for {} seconds ------------------", ( config.getRefreshInterval() / 1000 ) ); Thread.sleep( config.getRefreshInterval() ); CONSUMER_LOG.debug( "--------------------- syncing again ------------------" ); } catch ( InterruptedException ie ) { CONSUMER_LOG.warn( "refresher thread interrupted" ); return ReplicationStatusEnum.DISCONNECTED; } catch ( Exception e ) { CONSUMER_LOG.error( "Failed to sync with refresh only mode", e ); return ReplicationStatusEnum.DISCONNECTED; } } return ReplicationStatusEnum.STOPPED; }
After Thread.sleep( config.getRefreshInterval() ); we exit while loop, and method return ReplicationStatusEnum.STOPPED instead of DISCONNECTED.
LdapServer:
public void startReplicationConsumers() throws Exception { ............... do { status = consumer.startSync(); } while ( status == ReplicationStatusEnum.REFRESH_REQUIRED ); if ( status == ReplicationStatusEnum.STOPPED ) { // Exit the loop break; } ...............
In that we exit from thread, and our server never try to get updated data from S2..