コード例 #1
0
  @SuppressWarnings("unchecked")
  protected void addReadLockedKeys(List<Struct> gfxdList) {
    int txId = (Integer) SQLDistRRTxTest.curTxId.get();
    SharedMap readLockedKeysByRRTx = SQLTxRRReadBB.getBB().getSharedMap();

    Log.getLogWriter().info("adding the RR read keys to the Map for " + "this txId: " + txId);
    for (int i = 0; i < gfxdList.size(); i++) {
      int sid = (Integer) gfxdList.get(i).get("SEC_ID");
      String key = getTableName() + "_" + sid;
      Log.getLogWriter().info("RR read key to be added is " + key);
      ((HashMap<String, Integer>) SQLDistRRTxTest.curTxRRReadKeys.get()).put(key, txId);

      ReadLockedKey readKey = (ReadLockedKey) readLockedKeysByRRTx.get(key);
      if (readKey == null) readKey = new ReadLockedKey(key);
      readKey.addKeyByCurTx(txId);
      readLockedKeysByRRTx.put(key, readKey);
    }
  }
コード例 #2
0
ファイル: CacheBB.java プロジェクト: leloulight/gemfirexd-oss
  /**
   * Initialize the bb This saves caching attributes in the blackboard that must only be read once
   * per test run.
   */
  public void initialize() {
    hydra.blackboard.SharedMap aMap = this.getSharedMap();

    // set hydra params in map which should only be read once
    String scope = TestConfig.tab().stringAt(CachePrms.scopeAttribute, null);
    String mirror = TestConfig.tab().stringAt(CachePrms.mirrorAttribute, null);
    String dataPolicy = TestConfig.tab().stringAt(CachePrms.dataPolicyAttribute, null);
    if (scope != null) {
      aMap.put(SCOPE, TestConfig.tab().stringAt(CachePrms.scopeAttribute, null));
      Log.getLogWriter().info("Scope attribute is " + aMap.get(SCOPE));
    }
    if (mirror != null) {
      aMap.put(MIRROR, TestConfig.tab().stringAt(CachePrms.mirrorAttribute, null));
      Log.getLogWriter().info("Mirroring attribute is " + aMap.get(MIRROR));
    }
    if (dataPolicy != null) {
      aMap.put(DATA_POLICY, dataPolicy);
      Log.getLogWriter().info("DataPolicy attribute is " + aMap.get(DATA_POLICY));
    }
  }
コード例 #3
0
ファイル: CacheBB.java プロジェクト: leloulight/gemfirexd-oss
 /** Return the mirroring attribute for this test run. */
 public MirrorType getMirrorAttribute() {
   hydra.blackboard.SharedMap aMap = this.getSharedMap();
   String attribute = (String) aMap.get(MIRROR);
   return TestHelper.getMirrorType(attribute);
 }
コード例 #4
0
ファイル: CacheBB.java プロジェクト: leloulight/gemfirexd-oss
 /** Return the scope attribute for this test run. */
 public Scope getScopeAttribute() {
   hydra.blackboard.SharedMap aMap = this.getSharedMap();
   String attribute = (String) aMap.get(SCOPE);
   return TestHelper.getScope(attribute);
 }
コード例 #5
0
ファイル: CacheBB.java プロジェクト: leloulight/gemfirexd-oss
 /** Return the dataPolicy attribute for this test run. */
 public DataPolicy getDataPolicyAttribute() {
   hydra.blackboard.SharedMap aMap = this.getSharedMap();
   String attribute = (String) aMap.get(DATA_POLICY);
   return TestHelper.getDataPolicy(attribute);
 }
コード例 #6
0
 /**
  * To write the poistion onto the shared map.
  *
  * @param key
  * @param position
  */
 public static void setPosition(String key, Position position) {
   hydra.blackboard.SharedMap aMap = getBB().getSharedMap();
   aMap.put(key, position);
 }
コード例 #7
0
  public void initialize(String key) {
    hydra.blackboard.SharedMap aMap = getBB().getSharedMap();

    aMap.put(key, new Position());
  }
コード例 #8
0
  /**
   * Check event counters. If numCloseIsExact is true, then the number of close events must be an
   * exact match, otherwise allow numClose events to be the minimum of the expected numClose
   * counter. This is useful in tests where the timing of shutting down the VMs/C clients may or may
   * not cause a close event.
   *
   * @param eventCountExact - True if the event counters must exactly match the expected value,
   *     false if the event counters must be no less than the expected counter.
   */
  protected void checkEventCounters(boolean eventCountExact) {

    SharedCounters counters = BridgeNotifyBB.getBB().getSharedCounters();
    long numCreate = counters.read(BridgeNotifyBB.NUM_CREATE);
    long numUpdate = counters.read(BridgeNotifyBB.NUM_UPDATE);
    long numPutAllCreate = counters.read(BridgeNotifyBB.NUM_PUTALL_CREATE);
    long numPutAllUpdate = counters.read(BridgeNotifyBB.NUM_PUTALL_UPDATE);
    long numDestroy = counters.read(BridgeNotifyBB.NUM_DESTROY);
    long numInval = counters.read(BridgeNotifyBB.NUM_INVALIDATE);
    long numRegionCreate = counters.read(BridgeNotifyBB.NUM_REGION_CREATE);
    long numRegionDestroy = counters.read(BridgeNotifyBB.NUM_REGION_DESTROY);
    long numRegionInval = counters.read(BridgeNotifyBB.NUM_REGION_INVALIDATE);
    long numLocalDestroy = counters.read(BridgeNotifyBB.NUM_LOCAL_DESTROY);
    long numLocalInval = counters.read(BridgeNotifyBB.NUM_LOCAL_INVALIDATE);
    long numLocalRegionDestroy = counters.read(BridgeNotifyBB.NUM_LOCAL_REGION_DESTROY);
    long numLocalRegionInval = counters.read(BridgeNotifyBB.NUM_LOCAL_REGION_INVALIDATE);
    long numClose = counters.read(BridgeNotifyBB.NUM_CLOSE);

    /* the ALL_KEYS client will always get events (including creates on new keys)
     * the ALL_KEYS and one of the KeyList (odd/even) clients will always get all events
     * on the original keySet
     * we'll get 3 events per operation if we happen to select the singleKey client's key
     * This is written to the BB by the VM performing the operation (it knows how many
     * clients should get the update)
     */
    // factor this out to separate lines to track down an NPE issue
    // 2006-08-29 jpenney
    BridgeNotifyBB bnbb = BridgeNotifyBB.getBB();
    SharedMap sm = bnbb.getSharedMap();
    Object nl = sm.get(BridgeNotifyBB.numListeners);
    int numVmsWithList = ((Integer) nl).intValue();
    Log.getLogWriter().info("num VMs with listener installed: " + numVmsWithList);

    // This mixedBridgeNotify test always uses notifyBySubscription/registerInterest
    // Note:  to some degree we have to know if this key was in the original keyList
    ArrayList al = new ArrayList();
    al.add(
        new ExpCounterValue(
            "numAfterCreateEvents_isNotExp",
            (numCreate * numVmsWithList + numPutAllCreate * numVmsWithList),
            eventCountExact));
    al.add(
        new ExpCounterValue(
            "numAfterDestroyEvents_isNotExp", (numDestroy * numVmsWithList), eventCountExact));
    al.add(
        new ExpCounterValue(
            "numAfterInvalidateEvents_isNotExp", (numInval * numVmsWithList), eventCountExact));
    al.add(
        new ExpCounterValue(
            "numAfterUpdateEvents_isNotExp",
            (numUpdate * numVmsWithList + numPutAllUpdate * numVmsWithList),
            eventCountExact));
    al.add(new ExpCounterValue("numAfterRegionDestroyEvents_isNotExp", 0, eventCountExact));
    al.add(new ExpCounterValue("numAfterRegionInvalidateEvents_isNotExp", 0, eventCountExact));
    al.add(new ExpCounterValue("numClose", numClose, eventCountExact));

    EventCountersBB.getBB().checkEventCounters(al);

    // This only works on a serial basis, since each operation performed has a different
    // number of listeners with registered interest, therefore, we must clean the
    // BridgeNotifyBB operation counters each time
    counters.zero(BridgeNotifyBB.NUM_CREATE);
    counters.zero(BridgeNotifyBB.NUM_UPDATE);
    counters.zero(BridgeNotifyBB.NUM_PUTALL_CREATE);
    counters.zero(BridgeNotifyBB.NUM_PUTALL_UPDATE);
    counters.zero(BridgeNotifyBB.NUM_DESTROY);
    counters.zero(BridgeNotifyBB.NUM_INVALIDATE);

    // clear EventCountersBB as well (for actual event counters recv'd)
    EventCountersBB.getBB().zeroAllCounters();
  }