Package org.nasutekds.server.replication.common

Examples of org.nasutekds.server.replication.common.DSInfo


   * Creates a DSInfo structure representing this remote DS.
   * @return The DSInfo structure representing this remote DS
   */
  public DSInfo toDSInfo()
  {
    DSInfo dsInfo = new DSInfo(serverId, replicationServerId, generationId,
      status, assuredFlag, assuredMode, safeDataLevel, groupId, refUrls,
      eclInclude, protocolVersion);

    return dsInfo;
  }
View Full Code Here


    for(String str : refUrls)
    {
      urls.add(str);
    }

    return new DSInfo(dsId, rsId, TEST_DN_WITH_ROOT_ENTRY_GENID, status, assuredFlag, assMode,
       (byte)assuredSdLevel, groupId, urls, eclIncludes, protocolVersion);
  }
View Full Code Here

     byte safeDataLevel = rd.getAssuredSdLevel();
     byte groupId = rd.getGroupId();
     List<String> refUrls = rd.getRefUrls();
     Set<String> eclInclude = rd.getEclInclude();
     short protocolVersion = 4;
     DSInfo dsInfo = new DSInfo(dsId, rsId, TEST_DN_WITH_ROOT_ENTRY_GENID, status, assuredFlag, assuredMode,
       safeDataLevel, groupId, refUrls, eclInclude, protocolVersion);
     dsList.add(dsInfo);

     TopoView dsTopoView = new TopoView(dsList, rd.getRsList());
View Full Code Here

      // wait for a status MSG status analyzer to broker 3
      ReplicationMsg lastMsg = null;
      for (int count = 0; count< 50; count++)
      {
        List<DSInfo> dsList = ds3.getDsList();
        DSInfo ds3Info = null;
        if (dsList.size() > 0)
        {
          ds3Info = dsList.get(0);
        }
        if ((ds3Info != null) && (ds3Info.getDsId() == DS2_ID) &&
            (ds3Info.getStatus()== ServerStatus.DEGRADED_STATUS) )
        {
          break;
        }
        else
        {
          if (count < 50)
            sleep(200); // Be sure status analyzer has time to test
          else
            fail("DS2 did not get degraded : " + ds3Info);
        }
      }

      /**
       * DS3 sends 10 additional changes after threshold value, DS2 should still be
       * degraded so no topo message received.
       */
      bw.followAndPause(10);
      bw.shutdown();
      sleep(1000); // Be sure status analyzer has time to test
      lastMsg = br3.getLastMsg();
      ReplicationMsg msg = br3.getLastMsg();
      debugInfo(testCase + " Step 3: last message from writer: " + msg);
      assertTrue(lastMsg == null);

      /**
       * DS2 replays every changes and should go back to normal status
       * (create a reader to emulate replay of messages (messages read from queue))
       */
      br2 = new BrokerReader(ds2, DS2_ID);
      // wait for a status MSG status analyzer to broker 3
      for (int count = 0; count< 50; count++)
      {
        List<DSInfo> dsList = ds3.getDsList();
        DSInfo ds3Info = null;
        if (dsList.size() > 0)
        {
          ds3Info = dsList.get(0);
        }
        if ((ds3Info != null) && (ds3Info.getDsId() == DS2_ID) &&
            (ds3Info.getStatus()== ServerStatus.DEGRADED_STATUS) )
        {
          break;
        }
        else
        {
View Full Code Here

    List<String> urls4 = new ArrayList<String>();
    urls4.add("ldaps://host:port/dc=foobar1??sub?(sn=Another Entry 1)");
    urls4.add("ldaps://host:port/dc=foobar2??sub?(sn=Another Entry 2)");

    DSInfo dsInfo1 = new DSInfo(13, 26, (long)154631, ServerStatus.FULL_UPDATE_STATUS,
      false, AssuredMode.SAFE_DATA_MODE, (byte)12, (byte)132, urls1, new HashSet<String>(), (short)-1);

    DSInfo dsInfo2 = new DSInfo(-436, 493, (long)-227896, ServerStatus.DEGRADED_STATUS,
      true, AssuredMode.SAFE_READ_MODE, (byte)-7, (byte)-265, urls2, new HashSet<String>(), (short)-1);

    DSInfo dsInfo3 = new DSInfo(2436, 591, (long)0, ServerStatus.NORMAL_STATUS,
      false, AssuredMode.SAFE_READ_MODE, (byte)17, (byte)0, urls3, new HashSet<String>(), (short)-1);

    DSInfo dsInfo4 = new DSInfo(415, 146, (long)0, ServerStatus.BAD_GEN_ID_STATUS,
      true, AssuredMode.SAFE_DATA_MODE, (byte)2, (byte)15, urls4, new HashSet<String>(), (short)-1);

    List<DSInfo> dsList1 = new ArrayList<DSInfo>();
    dsList1.add(dsInfo1);
View Full Code Here

      // Wait for connections to be finished
      // DS must see expected numbers of DSs/RSs
      waitForStableTopo(fakeRd1, 1, 1);
      List<DSInfo> dsInfos = fakeRd1.getReplicasList();
      DSInfo dsInfo = dsInfos.get(0);
      assertEquals(dsInfo.getDsId(), FDS2_ID);
      assertEquals(dsInfo.getStatus(), ServerStatus.NORMAL_STATUS);

      /*
       * Put DS2 in degraded status sending 4 safe read assured updates from DS1
       * - 3 for window being full
       * - 1 that is enqueued and makes the threshold value (1) reached and thus
       * DS2 go into degraded status
       */

      for (int i=1 ; i<=4 ; i++)
      {
        long startTime = System.currentTimeMillis();
        try
        {
          fakeRd1.sendNewFakeUpdate();
        } catch (TimeoutException e)
        {
          fail("No timeout is expected here");
        }
        long sendUpdateTime = System.currentTimeMillis() - startTime;
        // RS should timeout as no listener in DS2
        assertTrue((SMALL_TIMEOUT <= sendUpdateTime) && (sendUpdateTime <=
          LONG_TIMEOUT));
      }

      // Wait for DS2 being degraded
      boolean error = true;
      for (int count = 0; count < 12; count++)
      {
        dsInfos = fakeRd1.getReplicasList();
        if (dsInfos == null)
          continue;
        if (dsInfos.size() == 0)
          continue;
        dsInfo = dsInfos.get(0);
        if ( (dsInfo.getDsId() == FDS2_ID) &&
            (dsInfo.getStatus() == ServerStatus.DEGRADED_STATUS) )
        {
          error = false;
          break;
        }
        else
        {
          sleep(1000);
        }
      }
      if (error)
        fail("DS2 not in degraded status");

      sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked
      assertEquals(fakeRd1.getAssuredSrSentUpdates(), 4);
      assertEquals(fakeRd1.getAssuredSrAcknowledgedUpdates(), 0);
      assertEquals(fakeRd1.getAssuredSrNotAcknowledgedUpdates(), 4);
      assertEquals(fakeRd1.getAssuredSrTimeoutUpdates(), 4);
      assertEquals(fakeRd1.getAssuredSrWrongStatusUpdates(), 0);
      assertEquals(fakeRd1.getAssuredSrReplayErrorUpdates(), 0);
      Map<Integer, Integer> failedServer = fakeRd1.getAssuredSrServerNotAcknowledgedUpdates();
      assertEquals(failedServer.size(), 1);
      Integer nError = failedServer.get(FDS2_ID);
      assertNotNull(nError);
      assertEquals(nError.intValue(), 4);
      assertEquals(fakeRd1.getAssuredSrReceivedUpdates(), 0);
      assertEquals(fakeRd1.getAssuredSrReceivedUpdatesAcked(), 0);
      assertEquals(fakeRd1.getAssuredSrReceivedUpdatesNotAcked(), 0);

      assertEquals(fakeRd2.getAssuredSrSentUpdates(), 0);
      assertEquals(fakeRd2.getAssuredSrAcknowledgedUpdates(), 0);
      assertEquals(fakeRd2.getAssuredSrNotAcknowledgedUpdates(), 0);
      assertEquals(fakeRd2.getAssuredSrTimeoutUpdates(), 0);
      assertEquals(fakeRd2.getAssuredSrWrongStatusUpdates(), 0);
      assertEquals(fakeRd2.getAssuredSrReplayErrorUpdates(), 0);
      assertEquals(fakeRd2.getAssuredSrServerNotAcknowledgedUpdates().size(), 0);
      assertEquals(fakeRd2.getAssuredSrReceivedUpdates(), 0);
      assertEquals(fakeRd2.getAssuredSrReceivedUpdatesAcked(), 0);
      assertEquals(fakeRd2.getAssuredSrReceivedUpdatesNotAcked(), 0);

      assertEquals(fakeRd1.getReceivedUpdates(), 0);
      assertEquals(fakeRd1.getWrongReceivedUpdates(), 0);

      assertEquals(fakeRd2.getReceivedUpdates(), 0);
      assertEquals(fakeRd2.getWrongReceivedUpdates(), 0);
      assertTrue(fakeRd2.receivedUpdatesOk());

      /*
       * Send an assured update from DS 1 : should be acked as DS2 is degraded
       * and RS should not consider it as eligible for assured
       */

      long startTime = System.currentTimeMillis();
      try
      {
        fakeRd1.sendNewFakeUpdate();
      } catch (TimeoutException e)
      {
        fail("No timeout is expected here");
      }
      long sendUpdateTime = System.currentTimeMillis() - startTime;
      // RS should ack quickly as DS2 degraded and not eligible for assured
      assertTrue(sendUpdateTime < MAX_SEND_UPDATE_TIME);

      sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked
      assertEquals(fakeRd1.getAssuredSrSentUpdates(), 5);
      assertEquals(fakeRd1.getAssuredSrAcknowledgedUpdates(), 1);
      assertEquals(fakeRd1.getAssuredSrNotAcknowledgedUpdates(), 4);
      assertEquals(fakeRd1.getAssuredSrTimeoutUpdates(), 4);
      assertEquals(fakeRd1.getAssuredSrWrongStatusUpdates(), 0);
      assertEquals(fakeRd1.getAssuredSrReplayErrorUpdates(), 0);
      failedServer = fakeRd1.getAssuredSrServerNotAcknowledgedUpdates();
      assertEquals(failedServer.size(), 1);
      nError = failedServer.get(FDS2_ID);
      assertNotNull(nError);
      assertEquals(nError.intValue(), 4);
      assertEquals(fakeRd1.getAssuredSrReceivedUpdates(), 0);
      assertEquals(fakeRd1.getAssuredSrReceivedUpdatesAcked(), 0);
      assertEquals(fakeRd1.getAssuredSrReceivedUpdatesNotAcked(), 0);

      assertEquals(fakeRd2.getAssuredSrSentUpdates(), 0);
      assertEquals(fakeRd2.getAssuredSrAcknowledgedUpdates(), 0);
      assertEquals(fakeRd2.getAssuredSrNotAcknowledgedUpdates(), 0);
      assertEquals(fakeRd2.getAssuredSrTimeoutUpdates(), 0);
      assertEquals(fakeRd2.getAssuredSrWrongStatusUpdates(), 0);
      assertEquals(fakeRd2.getAssuredSrReplayErrorUpdates(), 0);
      assertEquals(fakeRd2.getAssuredSrServerNotAcknowledgedUpdates().size(), 0);
      assertEquals(fakeRd2.getAssuredSrReceivedUpdates(), 0);
      assertEquals(fakeRd2.getAssuredSrReceivedUpdatesAcked(), 0);
      assertEquals(fakeRd2.getAssuredSrReceivedUpdatesNotAcked(), 0);

      assertEquals(fakeRd1.getReceivedUpdates(), 0);
      assertEquals(fakeRd1.getWrongReceivedUpdates(), 0);

      assertEquals(fakeRd2.getReceivedUpdates(), 0);
      assertEquals(fakeRd2.getWrongReceivedUpdates(), 0);
      assertTrue(fakeRd2.receivedUpdatesOk());

      /*
       * Put DS2 in normal status again (start listen service)
       */

      fakeRd2.startListenService();

      // Wait for DS2 being back to normal
      error = true;
      for (int count = 0; count < 12; count++)
      {
        dsInfos = fakeRd1.getReplicasList();
        if (dsInfos == null)
          continue;
        if (dsInfos.size() == 0)
          continue;
        dsInfo = dsInfos.get(0);
        if ( (dsInfo.getDsId() == FDS2_ID) &&
            (dsInfo.getStatus() == ServerStatus.NORMAL_STATUS) )
        {
          error = false;
          break;
        }
        else
View Full Code Here

    Set<String> a3 = new HashSet<String>();
    a3.add("dc");
    a3.add("uid");
    Set<String> a4 = new HashSet<String>();

    DSInfo dsInfo1 = new DSInfo(13, 26, (long)154631, ServerStatus.FULL_UPDATE_STATUS,
      false, AssuredMode.SAFE_DATA_MODE, (byte)12, (byte)132, urls1, a1, (short)1);

    DSInfo dsInfo2 = new DSInfo(-436, 493, (long)-227896, ServerStatus.DEGRADED_STATUS,
      true, AssuredMode.SAFE_READ_MODE, (byte)-7, (byte)-265, urls2, a2, (short)2);

    DSInfo dsInfo3 = new DSInfo(2436, 591, (long)0, ServerStatus.NORMAL_STATUS,
      false, AssuredMode.SAFE_READ_MODE, (byte)17, (byte)0, urls3, a3, (short)3);

    DSInfo dsInfo4 = new DSInfo(415, 146, (long)0, ServerStatus.BAD_GEN_ID_STATUS,
      true, AssuredMode.SAFE_DATA_MODE, (byte)2, (byte)15, urls4, a4, (short)4);

    DSInfo dsInfo5 = new DSInfo(452436, 45591, (long)0, ServerStatus.NORMAL_STATUS,
        false, AssuredMode.SAFE_READ_MODE, (byte)17, (byte)0, urls3, a1, (short)5);

    List<DSInfo> dsList1 = new ArrayList<DSInfo>();
    dsList1.add(dsInfo1);
View Full Code Here

          // this server has already been in error during initialization
          // dont't wait for it
          continue;
        }

        DSInfo dsInfo = null;
        dsInfo = isRemoteDSConnected(serverId);
        if (dsInfo == null)
        {
          // this server is disconnected
          // may be for a long time if it crashed or had been stopped
          // may be just the time to reconnect after import : should be short
          if (++reconnectWait<reconnectMaxDelayInSec)
          {
            // let's still wait to give a chance to this server to reconnect
            done = false;
          }
          else
          {
            // we left enough time to the servers to reconnect - now it's too
            // late
          }
        }
        else
        {
          // this server is connected
          if (dsInfo.getStatus() == ServerStatus.FULL_UPDATE_STATUS)
          {
            // this one is still doing the Full Update ... retry later
            done = false;
            break;
          }
          else
          {
            // this one is done with the Full Update
            if (dsInfo.getGenerationId() == this.getGenerationID())
            {
              // and with the expected generationId
              replicasWeAreWaitingFor.remove(serverId);
            }
          }
View Full Code Here

          protocolVersion = Short.valueOf(in[pos++]);
        }

        /* Now create DSInfo and store it in list */

        DSInfo dsInfo = new DSInfo(dsId, rsId, generationId, status,
          assuredFlag, assuredMode, safeDataLevel, groupId, refUrls, attrs,
          protocolVersion);
        dsList.add(dsInfo);

        nDsInfo--;
View Full Code Here

   * Creates a DSInfo structure representing this remote DS.
   * @return The DSInfo structure representing this remote DS
   */
  public DSInfo toDSInfo()
  {
    DSInfo dsInfo = new DSInfo(serverId, replicationServerId, generationId,
      status, assuredFlag, assuredMode, safeDataLevel, groupId, refUrls,
      eclIncludes, protocolVersion);

    return dsInfo;
  }
View Full Code Here

TOP

Related Classes of org.nasutekds.server.replication.common.DSInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.