Package org.nasutekds.server.replication.common

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


        break;
      default:
        fail("Unknown replication server id.");
    }

    return new RSInfo(rsId, serverUrl, TEST_DN_WITH_ROOT_ENTRY_GENID, (byte)groupId, 1);
  }
View Full Code Here


        debugInfo("Received start session assured parameters are ok.");

        // Send topo view
        List<RSInfo> rsList = new ArrayList<RSInfo>();
        RSInfo rsInfo = new RSInfo(serverId, "localhost:" + port, generationId, groupId, 1);
        rsList.add(rsInfo);
        TopologyMsg topologyMsg = new TopologyMsg(new ArrayList<DSInfo>(),
          rsList);
        session.publish(topologyMsg);
View Full Code Here

    dsList4.add(dsInfo4);
    dsList4.add(dsInfo3);
    dsList4.add(dsInfo2);
    dsList4.add(dsInfo1);

    RSInfo rsInfo1 = new RSInfo(4527, null, (long)45316, (byte)103, 1);

    RSInfo rsInfo2 = new RSInfo(4527, null, (long)0, (byte)0, 1);

    RSInfo rsInfo3 = new RSInfo(0, null, (long)-21113, (byte)98, 1);

    List<RSInfo> rsList1 = new ArrayList<RSInfo>();
    rsList1.add(rsInfo1);

    List<RSInfo> rsList2 = new ArrayList<RSInfo>();
View Full Code Here

    Object[][] testData = new Object[24][];

    HashMap<Integer, ReplicationServerInfo> rsInfos = null;
      new HashMap<Integer, ReplicationServerInfo>();
    RSInfo rsInfo = null;
    List<Integer> connectedDSs = null;
    Object[] params = null;

    /************************
     * First connection tests
     ************************/

    /**
     * 1 RS, no connected DSs
     * Expected winner: the RS
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "AwinnerHost:123", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = -1; // current RS id
    params[2] = -1; // local DS id
    params[3] = "AwinnerHost:123"; // winner url
    testData[0] = params;

    /**
     * 2 RSs with TL=0.5, no connected DSs
     * Excepted winner: first in the list
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "BwinnerHost:123", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "looserHost:456", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = -1; // current RS id
    params[2] = -1; // local DS id
    params[3] = rsInfos.values().iterator().next().getServerURL(); // winner url
    testData[1] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=0.5 - CL=1.0 - DS=1 ; RS2: TL=0.5 - CL=0 - DS=0
     * Excepted winner: R2 (still no connected DS)
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "looserHost:123", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "CwinnerHost:456", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = -1; // current RS id
    params[2] = -1; // local DS id
    params[3] = "CwinnerHost:456"; // winner url
    testData[2] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=0.5 - CL=0.5 - DS=1 ; RS2: TL=0.5 - CL=0.5 - DS=1
     * Excepted winner: first in the list as both RSs reached TL
     * and have same weight
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "DwinnerHost:123", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "looserHost:456", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(101);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = -1; // current RS id
    params[2] = -1; // local DS id
    params[3] = rsInfos.values().iterator().next().getServerURL(); // winner url
    testData[3] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=0.5 - CL=2/3 - DS=2 ; RS2: TL=0.5 - CL=1/3 - DS=1
     * Excepted winner: RS2 -> 2 DSs on each RS
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "looserHost:123", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    connectedDSs.add(2);
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "EwinnerHost:456", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(101);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = -1; // current RS id
    params[2] = -1; // local DS id
    params[3] = "EwinnerHost:456"; // winner url
    testData[4] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=1/3 - CL=0.5 - DS=1 ; RS2: TL=2/3 - CL=0.5 - DS=1
     * Excepted winner: RS2 -> go to perfect load balance
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "looserHost:123", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "FwinnerHost:456", 0L, (byte)1, 2);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(101);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = -1; // current RS id
    params[2] = -1; // local DS id
    params[3] = "FwinnerHost:456"; // winner url
    testData[5] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=1/3 - CL=1/3 - DS=1 ; RS2: TL=2/3 - CL=2/3 - DS=2
     * Excepted winner: RS2 -> already load balanced so choose server with the
     * highest weight
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "looserHost:123", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "GwinnerHost:456", 0L, (byte)1, 2);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(101);
    connectedDSs.add(102);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = -1; // current RS id
    params[2] = -1; // local DS id
    params[3] = "GwinnerHost:456"; // winner url
    testData[6] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=1/3 - CL=1/3 - DS=2 ; RS2: TL=2/3 - CL=2/3 - DS=4
     * Excepted winner: RS2 -> already load balanced so choose server with the
     * highest weight
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "looserHost:123", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    connectedDSs.add(2);
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "HwinnerHost:456", 0L, (byte)1, 2);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(101);
    connectedDSs.add(102);
    connectedDSs.add(103);
    connectedDSs.add(104);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = -1; // current RS id
    params[2] = -1; // local DS id
    params[3] = "HwinnerHost:456"; // winner url
    testData[7] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=1/6 - CL=1/6 - DS=1 ; RS2: TL=2/6 - CL=2/6 - DS=2 ; RS3: TL=3/6 - CL=3/6 - DS=3
     * Excepted winner: RS3 -> already load balanced so choose server with the
     * highest weight
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "looserHost:123", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "looserHost:456", 0L, (byte)1, 2);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(101);
    connectedDSs.add(102);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(13, "IwinnerHost:789", 0L, (byte)1, 3);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(201);
    connectedDSs.add(202);
    connectedDSs.add(203);
    rsInfos.put(13, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = -1; // current RS id
    params[2] = -1; // local DS id
    params[3] = "IwinnerHost:789"; // winner url
    testData[8] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=5/10 - CL=3/9 - DS=3 ; RS2: TL=3/10 - CL=5/9 - DS=5 ; RS3: TL=2/10 - CL=1/9 - DS=1
     * Excepted winner: RS1 -> misses more DSs than RS3
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "JwinnerHost:123", 0L, (byte)1, 5);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    connectedDSs.add(2);
    connectedDSs.add(3);
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "looserHost:456", 0L, (byte)1, 3);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(101);
    connectedDSs.add(102);
    connectedDSs.add(103);
    connectedDSs.add(104);
    connectedDSs.add(105);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(13, "looserHost:789", 0L, (byte)1, 2);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(201);
    rsInfos.put(13, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = -1; // current RS id
    params[2] = -1; // local DS id
    params[3] = "JwinnerHost:123"; // winner url
    testData[9] = params;

    /*************************
     * Already connected tests
     *************************/

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=0.5 - CL=0.5 - DS=1 ; RS2: TL=0.5 - CL=0.5 - DS=1
     * Excepted winner: RS2 (stay connected to it as load correctly spread)
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "looserHost:123", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "KwinnerHost:456", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(101);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = 12; // current RS id
    params[2] = 101; // local DS id
    params[3] = "KwinnerHost:456"; // winner url
    testData[10] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=0.5 - CL=1.0 - DS=2 ; RS2: TL=0.5 - CL=0.0 - DS=0
     * Excepted winner: RS2 (one must disconnect from RS1)
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "looserHost:123", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    connectedDSs.add(2);
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "LwinnerHost:456", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = 11; // current RS id
    params[2] = 1; // local DS id
    params[3] = null; // winner url
    testData[11] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=0.5 - CL=1.0 - DS=2 ; RS2: TL=0.5 - CL=0.0 - DS=0
     * Excepted winner: RS1 (one server must disconnect from RS1 but it is the
     * one with the lowest id so not DS with server id 2)
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "MwinnerHost:123", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    connectedDSs.add(2);
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "looserHost:456", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = 11; // current RS id
    params[2] = 2; // local DS id
    params[3] = "MwinnerHost:123"; // winner url
    testData[12] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=0.3 - CL=0.3 - DS=6 ; RS2: TL=0.4 - CL=0.4 - DS=8 ;
     * RS3: TL=0.1 - CL=0.1 - DS=2 ; RS4: TL=0.2 - CL=0.2 - DS=4
     * Excepted winner: RS2 no change as load correctly spread
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "looserHost:123", 0L, (byte)1, 3);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    connectedDSs.add(2);
    connectedDSs.add(3);
    connectedDSs.add(4);
    connectedDSs.add(5);
    connectedDSs.add(6);

    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "NwinnerHost:456", 0L, (byte)1, 4);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(101);
    connectedDSs.add(102);
    connectedDSs.add(103);
    connectedDSs.add(104);
    connectedDSs.add(105);
    connectedDSs.add(106);
    connectedDSs.add(107);
    connectedDSs.add(108);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(13, "looserHost:789", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(201);
    connectedDSs.add(202);
    rsInfos.put(13, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(14, "looserHost:1011", 0L, (byte)1, 2);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(301);
    connectedDSs.add(302);
    connectedDSs.add(303);
    connectedDSs.add(304);
    rsInfos.put(14, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = 12; // current RS id
    params[2] = 101; // local DS id
    params[3] = "NwinnerHost:456"; // winner url
    testData[13] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=0.3 - CL=0.2 - DS=4 ; RS2: TL=0.4 - CL=0.4 - DS=8 ;
     * RS3: TL=0.1 - CL=0.1 - DS=2 ; RS4: TL=0.2 - CL=0.3 - DS=6
     * Excepted winner: RS2: no change load ok on current server and there is the
     * possibility to arrange load for other servers with disconnection from
     * 2 DSs from RS4 and reconnect them to RS1 (we moved these 2 servers from
     * previous test where the loads were ok)
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "looserHost:123", 0L, (byte)1, 3);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    connectedDSs.add(2);
    connectedDSs.add(3);
    connectedDSs.add(4);

    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "OwinnerHost:456", 0L, (byte)1, 4);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(101);
    connectedDSs.add(102);
    connectedDSs.add(103);
    connectedDSs.add(104);
    connectedDSs.add(105);
    connectedDSs.add(106);
    connectedDSs.add(107);
    connectedDSs.add(108);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(13, "looserHost:789", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(201);
    connectedDSs.add(202);
    rsInfos.put(13, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(14, "looserHost:1011", 0L, (byte)1, 2);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(301);
    connectedDSs.add(302);
    connectedDSs.add(303);
    connectedDSs.add(304);
    connectedDSs.add(305);
    connectedDSs.add(306);
    rsInfos.put(14, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = 12; // current RS id
    params[2] = 101; // local DS id
    params[3] = "OwinnerHost:456"; // winner url
    testData[14] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=0.3 - CL=0.2 - DS=4 ; RS2: TL=0.4 - CL=0.4 - DS=8 ;
     * RS3: TL=0.1 - CL=0.1 - DS=2 ; RS4: TL=0.2 - CL=0.3 - DS=6
     * Excepted winner: RS4 : 2 DSs should go away from RS4 and server id 302
     * is one of the two lowest ids connected to RS4
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "PwinnerHost:123", 0L, (byte)1, 3);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    connectedDSs.add(2);
    connectedDSs.add(3);
    connectedDSs.add(4);

    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "looserHost:456", 0L, (byte)1, 4);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(101);
    connectedDSs.add(102);
    connectedDSs.add(103);
    connectedDSs.add(104);
    connectedDSs.add(105);
    connectedDSs.add(106);
    connectedDSs.add(107);
    connectedDSs.add(108);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(13, "looserHost:789", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(201);
    connectedDSs.add(202);
    rsInfos.put(13, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(14, "looserHost:1011", 0L, (byte)1, 2);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(306);
    connectedDSs.add(305);
    connectedDSs.add(304);
    connectedDSs.add(303);
    connectedDSs.add(302);
    connectedDSs.add(301);

    rsInfos.put(14, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = 14; // current RS id
    params[2] = 302; // local DS id
    params[3] = null; // winner url
    testData[15] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=0.3 - CL=0.2 - DS=4 ; RS2: TL=0.4 - CL=0.4 - DS=8 ;
     * RS3: TL=0.1 - CL=0.1 - DS=2 ; RS4: TL=0.2 - CL=0.3 - DS=6
     * Excepted winner: RS1 : 2 DSs should go away from RS4 but server id 303
     * is not one of the two lowest ids connected to RS4
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "looserHost:123", 0L, (byte)1, 3);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    connectedDSs.add(2);
    connectedDSs.add(3);
    connectedDSs.add(4);

    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "looserHost:456", 0L, (byte)1, 4);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(101);
    connectedDSs.add(102);
    connectedDSs.add(103);
    connectedDSs.add(104);
    connectedDSs.add(105);
    connectedDSs.add(106);
    connectedDSs.add(107);
    connectedDSs.add(108);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(13, "looserHost:789", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(201);
    connectedDSs.add(202);
    rsInfos.put(13, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(14, "QwinnerHost:1011", 0L, (byte)1, 2);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(306);
    connectedDSs.add(305);
    connectedDSs.add(304);
    connectedDSs.add(303);
    connectedDSs.add(302);
    connectedDSs.add(301);

    rsInfos.put(14, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = 14; // current RS id
    params[2] = 303; // local DS id
    params[3] = "QwinnerHost:1011"; // winner url
    testData[16] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=0.3 - CL=0.2 - DS=4 ; RS2: TL=0.4 - CL=0.65 - DS=13 ;
     * RS3: TL=0.1 - CL=0.1 - DS=2 ; RS4: TL=0.2 - CL=0.05 - DS=1
     * Excepted winner: RS2: no change load ok on current server and there is the
     * possibility to arrange load for other servers with disconnection from
     * 2 DSs from RS4 and reconnect them to RS1 (we moved these 2 servers from
     * previous test where the loads were ok)
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "looserHost:123", 0L, (byte)1, 3);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    connectedDSs.add(2);
    connectedDSs.add(3);
    connectedDSs.add(4);

    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "looserHost:456", 0L, (byte)1, 4);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(113);
    connectedDSs.add(112);
    connectedDSs.add(111);
    connectedDSs.add(110);
    connectedDSs.add(109);
    connectedDSs.add(108);
    connectedDSs.add(107);
    connectedDSs.add(106);
    connectedDSs.add(105);
    connectedDSs.add(104);
    connectedDSs.add(103);
    connectedDSs.add(102);
    connectedDSs.add(101);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(13, "looserHost:789", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(201);
    connectedDSs.add(202);
    rsInfos.put(13, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(14, "looserHost:1011", 0L, (byte)1, 2);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(301);

    rsInfos.put(14, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = 12; // current RS id
    params[2] = 105; // local DS id
    params[3] = null; // winner url
    testData[17] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=0.5 - CL=2/3 - DS=2 ; RS2: TL=0.5 - CL=1/3 - DS=1
     * Excepted winner: RS1. Local server should stay connected to current one
     * as the balance cannot be done. We already have the nearest possible
     * balance to the load goals: disconnection would cause a yoyo effect and
     * the local server would not stop going and coming back to/from the other
     * RS.
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "RwinnerHost:123", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    connectedDSs.add(2);
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "looserHost:456", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(3);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = 11; // current RS id
    params[2] = 1; // local DS id
    params[3] = "RwinnerHost:123"; // winner url
    testData[18] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=0.5 - CL=2/3 - DS=2 ; RS2: TL=0.5 - CL=1/3 - DS=1
     * Excepted winner: RS1. Local server should stay connected to current one
     * as the balance cannot be done. We already have the nearest possible
     * balance to the load goals: disconnection would cause a yoyo effect and
     * the local server would not stop going and coming back to/from the other
     * RS.
     * Note: Same test as before, but not with the lowest local DS server id
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "SwinnerHost:123", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    connectedDSs.add(2);
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "looserHost:456", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(3);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = 11; // current RS id
    params[2] = 2; // local DS id
    params[3] = "SwinnerHost:123"; // winner url
    testData[19] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=1/3 - CL=2/4 - DS=2 ; RS2: TL=1/3 - CL=1/4 - DS=1 ; RS3: TL=1/3 - CL=1/4 - DS=1
     * Excepted winner: RS1. Local server should stay connected to current one
     * as the balance cannot be done. We already have the nearest possible
     * balance to the load goals: disconnection would cause a yoyo effect and
     * the local server would not stop going and coming back between RSs.
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "TwinnerHost:123", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    connectedDSs.add(2);
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "looserHost:456", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(3);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(13, "looserHost:789", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(4);
    rsInfos.put(13, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = 11; // current RS id
    params[2] = 1; // local DS id
    params[3] = "TwinnerHost:123"; // winner url
    testData[20] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=1/3 - CL=3/7 - DS=3 ; RS2: TL=1/3 - CL=2/7 - DS=2 ; RS3: TL=1/3 - CL=2/7 - DS=2
     * Excepted winner: RS1. Local server should stay connected to current one
     * as the balance cannot be done. We already have the nearest possible
     * balance to the load goals: disconnection would cause a yoyo effect and
     * the local server would not stop going and coming back between RSs.
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "UwinnerHost:123", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    connectedDSs.add(2);
    connectedDSs.add(3);
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "looserHost:456", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(4);
    connectedDSs.add(5);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(13, "looserHost:789", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(6);
    connectedDSs.add(7);
    rsInfos.put(13, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = 11; // current RS id
    params[2] = 1; // local DS id
    params[3] = "UwinnerHost:123"; // winner url
    testData[21] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=1/3 - CL=2/3 - DS=2 ; RS2: TL=1/3 - CL=1/3 - DS=1 ; RS3: TL=1/3 - CL=0 - DS=0
     * Excepted winner: RS3. Local server should disconnect for reconnection to
     * RS3
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "looserHost:123", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    connectedDSs.add(2);
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "looserHost:456", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(3);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(13, "VwinnerHost:789", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    rsInfos.put(13, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
    params[1] = 11; // current RS id
    params[2] = 1; // local DS id
    params[3] = null; // winner url
    testData[22] = params;

    /**
     * TL = target load
     * CL = current load
     * DS = connected DSs number
     * RS1: TL=1/3 - CL=2/3 - DS=2 ; RS2: TL=1/3 - CL=1/3 - DS=1 ; RS3: TL=1/3 - CL=0 - DS=0
     * Excepted winner: RS3. Local server (2) should stay connected while
     * DS server id 1 should disconnect for reconnection to RS3
     */

    rsInfos = new HashMap<Integer, ReplicationServerInfo>();

    rsInfo = new RSInfo(11, "WwinnerHost:123", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(1);
    connectedDSs.add(2);
    rsInfos.put(11, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(12, "looserHost:456", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    connectedDSs.add(3);
    rsInfos.put(12, new ReplicationServerInfo(rsInfo, connectedDSs));

    rsInfo = new RSInfo(13, "looserHost:789", 0L, (byte)1, 1);
    connectedDSs = new ArrayList<Integer>();
    rsInfos.put(13, new ReplicationServerInfo(rsInfo, connectedDSs));

    params = new Object[4];
    params[0] = rsInfos;
View Full Code Here

        {
          session.stopEncryption();
        }

        // Send our topo mesg
        RSInfo rsInfo = new RSInfo(serverId, fakeUrl, generationId, groupId, 1);
        List<RSInfo> rsInfos = new ArrayList<RSInfo>();
        rsInfos.add(rsInfo);
        TopologyMsg topoMsg = new TopologyMsg(null, rsInfos);
        session.publish(topoMsg);
View Full Code Here

    dsList4.add(dsInfo4);
    dsList4.add(dsInfo3);
    dsList4.add(dsInfo2);
    dsList4.add(dsInfo1);

    RSInfo rsInfo1 = new RSInfo(4527, "rsHost1:123", (long)45316, (byte)103, 1);

    RSInfo rsInfo2 = new RSInfo(4527, "rsHost2:456", (long)0, (byte)0, 1);

    RSInfo rsInfo3 = new RSInfo(0, "rsHost3:789", (long)-21113, (byte)98, 1);

    RSInfo rsInfo4 = new RSInfo(45678, "rsHost4:1011", (long)-21113, (byte)98, 1);

    List<RSInfo> rsList1 = new ArrayList<RSInfo>();
    rsList1.add(rsInfo1);

    List<RSInfo> rsList2 = new ArrayList<RSInfo>();
View Full Code Here

      dsInfos.add(serverHandler.toDSInfo());
    }

    // Create info for the local RS
    List<RSInfo> rsInfos = new ArrayList<RSInfo>();
    RSInfo localRSInfo = new RSInfo(replicationServer.getServerId(),
      replicationServer.getServerURL(), generationId,
      replicationServer.getGroupId(), replicationServer.getWeight());
    rsInfos.add(localRSInfo);

    return new TopologyMsg(dsInfos, rsInfos);
View Full Code Here

        continue;
      dsInfos.add(serverHandler.toDSInfo());
    }

    // Add our own info (local RS)
    RSInfo localRSInfo = new RSInfo(replicationServer.getServerId(),
      replicationServer.getServerURL(), generationId,
      replicationServer.getGroupId(), replicationServer.getWeight());
    rsInfos.add(localRSInfo);

    // Go through every peer RSs (and get their connected DSs), also add info
View Full Code Here

    // Store remore RS weight if it has one
    if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V4)
    {
      // List should only contain RS info for sender
      RSInfo rsInfo = inTopoMsg.getRsList().get(0);
      weight = rsInfo.getWeight();
    }
    else
    {
      // Remote RS uses protocol version prior to 4 : use default value for
      // weight: 1
View Full Code Here

  public void processTopoInfoFromRS(TopologyMsg topoMsg)
  {
    // Store info for remote RS
    List<RSInfo> rsInfos = topoMsg.getRsList();
    // List should only contain RS info for sender
    RSInfo rsInfo = rsInfos.get(0);
    generationId = rsInfo.getGenerationId();
    groupId = rsInfo.getGroupId();
    weight = rsInfo.getWeight();

    /**
     * Store info for DSs connected to the peer RS
     */
    List<DSInfo> dsInfos = topoMsg.getDsList();
View Full Code Here

TOP

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

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.