Examples of PhysicalPartition


Examples of com.linkedin.databus.core.data_model.PhysicalPartition

    assertEquals(cp1.getWindowScn(), 100L, "after deser window scn mismatch");
  }

  public void validateCheckpoints() {
    for(int id : pSrcIds.keySet()) {
      PhysicalPartition pPart = new PhysicalPartition(id, "name");
      Checkpoint cp = _cpMult.getCheckpoint(pPart);
      List<Integer> l = pSrcIds.get(id);
      assertEquals(cp.getWindowOffset().longValue(), l.get(0).longValue(),
                 "window offset in Checkpoint1 doesn't match");
View Full Code Here

Examples of com.linkedin.databus.core.data_model.PhysicalPartition

    assertEquals(anotherCpMult.getNumCheckponts(), 2,
                 " wrong number of enteries in new cpMult");

    // verify
    for(Integer i : pSrcIds.keySet()) {
      PhysicalPartition pPart = new PhysicalPartition(i, "name");
      Checkpoint cp = _cpMult.getCheckpoint(pPart);
      Checkpoint aCp = anotherCpMult.getCheckpoint(pPart);

      //System.out.println("id = " + i + ";scn=" + cp.getWindowScn() + ";awscn=" + aCp.getWindowScn());
      assertEquals(cp.getWindowScn(), aCp.getWindowScn(),
View Full Code Here

Examples of com.linkedin.databus.core.data_model.PhysicalPartition

   * change.
   */
  @Test
  public void testCursorPosition() throws Exception
  {
    final PhysicalPartition ppart = new PhysicalPartition(26, "January");
    CheckpointMult cpMult = makeCpMult();
    cpMult.setCursorPartition(ppart);
    assertEquals(ppart, cpMult.getCursorPartition());
    String serialCpMult = cpMult.toString();
    CheckpointMult cpMultCopy = new CheckpointMult(serialCpMult);
    assertNull(cpMultCopy.getCursorPartition());

    // Make sure we are able to decode it, however.

    ObjectMapper mapper = new ObjectMapper();
    Map<String, String> map = mapper.readValue(
        new ByteArrayInputStream(serialCpMult.getBytes(Charset.defaultCharset())), new TypeReference<Map<String, String>>(){});
    map.put("NonJsonKey", "Some value");
    map.put("cursorPartition", ppart.toJsonString());
    ByteArrayOutputStream bs = new ByteArrayOutputStream();
    mapper.writeValue(bs, map);
    cpMultCopy = new CheckpointMult(bs.toString());

    assertEquals(cpMultCopy.getCursorPartition(), ppart);
View Full Code Here

Examples of com.linkedin.databus.core.data_model.PhysicalPartition

  @Test
  public void testAtMostOnePartialWindow() throws Exception
  {
    CheckpointMult cpMult = new CheckpointMult();
    final PhysicalPartition pp1 = new PhysicalPartition(1, "February");
    final PhysicalPartition pp2 = new PhysicalPartition(1, "Friday");
    Checkpoint cp = new Checkpoint();
    cp.setWindowScn(100L);
    cp.setWindowOffset(3);
    cpMult.addCheckpoint(pp1, cp)// Added one checkpoint with partial window.
    assertEquals(pp1, cpMult.getPartialWindowPartition());
View Full Code Here

Examples of com.linkedin.databus.core.data_model.PhysicalPartition

    String args;
    if (curState.getRelayConnection().getProtocolVersion() >= 3) {
      // for version 3 and higher we pass subscriptions
      args = curState.getSubsListString();
      for (DatabusSubscription sub : curState.getSubscriptions()) {
        PhysicalPartition p = sub.getPhysicalPartition();
        cpMult.addCheckpoint(p, cp);
      }
    } else {
      args = curState.getSourcesIdListString();
      cpMult.addCheckpoint(PhysicalPartition.ANY_PHYSICAL_PARTITION, cp);
View Full Code Here

Examples of com.linkedin.databus.core.data_model.PhysicalPartition

  private String composeName(String id) {
    StringBuilder shortSourcesListBuilder = new StringBuilder();
    String separatorChar = "[";
    for (DatabusSubscription sub : getSubscriptions()) {
      shortSourcesListBuilder.append(separatorChar);
      PhysicalPartition p = sub.getPhysicalPartition();
      String sourceName = "AnySource";
      LogicalSource source = sub.getLogicalPartition().getSource();
      if (!source.isAllSourcesWildcard()) {
        sourceName = source.getName();
        int lastDotIdx = sourceName.lastIndexOf('.');
        if (lastDotIdx >= 0)
          sourceName = sourceName.substring(lastDotIdx + 1);
      }
      String partString = "AnyPPart_";
      if (!p.isAnyPartitionWildcard()) {
        partString = p.getId() + "_";
      }
      shortSourcesListBuilder.append(partString + sourceName);
      separatorChar = "_";
    }
    shortSourcesListBuilder.append(']');
View Full Code Here

Examples of com.linkedin.databus.core.data_model.PhysicalPartition

    _lastWrittenSequence = -1;
    _prevScn=-1L;
    _timestampOfFirstEvent = 0;
    _timestampOfLatestDataEvent = 0;
    _bufferRemoveWaitPeriodSec = bufRemovalWaitPeriod;
    _physicalPartition = (physicalPartition == null)? new PhysicalPartition(0, "default") : physicalPartition;

    // file to read meta info for saved buffers (if any), MetaInfo constructor doesn't create/open any actual file
    DbusEventBufferMetaInfo mi = null;

    // in case of MMAPED memory - see if there is a meta file, and if there is - read from it
View Full Code Here

Examples of com.linkedin.databus.core.data_model.PhysicalPartition

    if(config == null)
      throw new InvalidConfigException("config cannot be null for addNewBuffer");

    // see if a buffer for this mapping exists
    PhysicalPartition pPartition = pConfig.getPhysicalPartition();

    PhysicalPartitionKey pKey = new PhysicalPartitionKey(pPartition);

    //record pSource association to the buffer
    PhysicalSource pSource = pConfig.getPhysicalSource();
View Full Code Here

Examples of com.linkedin.databus.core.data_model.PhysicalPartition

  /** add another buffer with the mappings */
  public synchronized void addBuffer(PhysicalSourceStaticConfig pConfig, DbusEventBuffer buf) {
    LOG.info("addBuffer for phSrc=" + pConfig + "; buf=" + buf.hashCode());

    PhysicalPartition pPartition = pConfig.getPhysicalPartition();
    PhysicalPartitionKey pKey = new PhysicalPartitionKey(pPartition);


    _bufsMap.put(pKey, buf);
    _uniqBufs.add(buf);
View Full Code Here

Examples of com.linkedin.databus.core.data_model.PhysicalPartition

  public DbusFilter constructFilters(Collection<DatabusSubscription> subs) throws DatabusException
  {
    HashMap<PhysicalPartition, PhysicalPartitionDbusFilter> filterMap = null;
    for (DatabusSubscription sub: subs)
    {
      PhysicalPartition ppart = sub.getPhysicalPartition();
      if (sub.getLogicalSource().isWildcard())
      {
        if (!ppart.isWildcard())
        {
          if (null == filterMap) filterMap = new HashMap<PhysicalPartition, PhysicalPartitionDbusFilter>(10);
          filterMap.put(ppart, new PhysicalPartitionDbusFilter(ppart, null));
        }
        else
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.