You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Alexander Kozlov (JIRA)" <ji...@apache.org> on 2014/10/22 13:28:34 UTC

[jira] [Created] (DIRSERVER-2014) Synchronization is stopped if remote server was not restored during refresh interval

Alexander Kozlov created DIRSERVER-2014:
-------------------------------------------

             Summary: Synchronization is stopped if remote server was not restored during refresh interval
                 Key: DIRSERVER-2014
                 URL: https://issues.apache.org/jira/browse/DIRSERVER-2014
             Project: Directory ApacheDS
          Issue Type: Bug
          Components: ldap
    Affects Versions: 2.0.0-M16
            Reporter: Alexander Kozlov
             Fix For: 2.0.0-M18


*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: {code}
    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;
    }
{code}

After _Thread.sleep( config.getRefreshInterval() );_ we exit _while_ loop, and method return _ReplicationStatusEnum.STOPPED_ instead of _DISCONNECTED_.

LdapServer:{code}
    public void startReplicationConsumers() throws Exception
    {
...............
                                    do
                                    {
                                        status = consumer.startSync();
                                    }
                                    while ( status == ReplicationStatusEnum.REFRESH_REQUIRED );

                                    if ( status == ReplicationStatusEnum.STOPPED )
                                    {
                                        // Exit the loop
                                        break;
                                    }
...............
{code}

In that we exit from thread, and our server never try to get updated data from S2..



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)