Uploaded image for project: 'Directory ApacheDS'
  1. Directory ApacheDS
  2. DIRSERVER-2014

Synchronization is stopped if remote server was not restored during refresh interval

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M16
    • Fix Version/s: 2.0.0-M18
    • Component/s: ldap
    • Labels:
      None

      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..

        Activity

        Hide
        akiran Kiran Ayyagari added a comment -

        This bug affects both RefreshOnly and RefreshAndPersist modes, fixed it here http://svn.apache.org/r1634295.

        Thanks for reporting and the detailed steps to reproduce.

        Show
        akiran Kiran Ayyagari added a comment - This bug affects both RefreshOnly and RefreshAndPersist modes, fixed it here http://svn.apache.org/r1634295 . Thanks for reporting and the detailed steps to reproduce.

          People

          • Assignee:
            akiran Kiran Ayyagari
            Reporter:
            alexander.kozlov.iv Alexander Kozlov
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development