Package com.linkedin.databus.core

Examples of com.linkedin.databus.core.CheckpointMult


    //send partial /stream
    callback.clearLastMsg();
    objCapture.clear();
    Checkpoint cp = new Checkpoint();
    cp.setFlexible();
    CheckpointMult cpm = new CheckpointMult();
    cpm.addCheckpoint(PhysicalPartition.ANY_PHYSICAL_PARTITION, cp);
    conn.requestStream("1", null, 1000, cpm, null, msg);


    //////// verify server gets the /stream request
    HttpRequest msgReq = captureRequest(objCapture);
View Full Code Here


    //send partial /stream
    callback.clearLastMsg();
    objCapture.clear();
    Checkpoint cp = new Checkpoint();
    cp.setFlexible();
    CheckpointMult cpm = new CheckpointMult();
    cpm.addCheckpoint(PhysicalPartition.ANY_PHYSICAL_PARTITION, cp);
    conn.requestStream("1", null, 1000, cpm, null, msg);


    //////// verify server gets the /stream request
    HttpRequest msgReq = captureRequest(objCapture);
View Full Code Here

    //send partial /stream
    callback.clearLastMsg();
    objCapture.clear();
    Checkpoint cp = new Checkpoint();
    cp.setFlexible();
    CheckpointMult cpm = new CheckpointMult();
    cpm.addCheckpoint(PhysicalPartition.ANY_PHYSICAL_PARTITION, cp);
    conn.requestStream("1", null, 1000, cpm, null, msg);


    //////// verify server gets the /stream request
    HttpRequest msgReq = captureRequest(objCapture);
View Full Code Here

    serverChannel.close();

    Checkpoint cp = new Checkpoint();
    cp.setFlexible();
    CheckpointMult cpm = new CheckpointMult();
    cpm.addCheckpoint(PhysicalPartition.ANY_PHYSICAL_PARTITION, cp);
    conn.requestStream("1", null, 1000, cpm, null, msg);

    waitForCallback(callback,
                    TestResponseProcessors.TestConnectionStateMessage.State.STREAM_REQUEST_ERROR,
                    log);
View Full Code Here

    //send partial /stream
    callback.clearLastMsg();
    objCapture.clear();
    Checkpoint cp = new Checkpoint();
    cp.setFlexible();
    CheckpointMult cpm = new CheckpointMult();
    cpm.addCheckpoint(PhysicalPartition.ANY_PHYSICAL_PARTITION, cp);
    conn.requestStream("1", null, 1000, cpm, null, msg);


    //////// verify server gets the /stream request
    HttpRequest msgReq = captureRequest(objCapture);
View Full Code Here

  {
    HttpRequest msgReq;
    objCapture.clear();
    Checkpoint cp = new Checkpoint();
    cp.setFlexible();
    CheckpointMult cpm = new CheckpointMult();
    cpm.addCheckpoint(PhysicalPartition.ANY_PHYSICAL_PARTITION, cp);
    conn.requestStream("1", null, 1000, cpm, null, msg);


    //verify server gets the /stream request
    msgReq = captureRequest(objCapture);
View Full Code Here

      // and add create Checkpoint(checkpointString) and add it to cpMult;
      // 3 both are null - create empty CheckpointMult and add empty Checkpoint to it for each ppartition
      PhysicalPartition pPartition;

      Checkpoint cp = null;
      CheckpointMult cpMult = null;

      if(checkpointStringMult != null) {
        try {
          cpMult = new CheckpointMult(checkpointStringMult);
        } catch (InvalidParameterSpecException e) {
          LOG.error("Invalid CheckpointMult:" + checkpointStringMult, e);
          throw new InvalidRequestParamValueException("stream", "CheckpointMult", checkpointStringMult);
        }
      } else {
        // there is no checkpoint - create an empty one
        cpMult = new CheckpointMult();
        Iterator<Integer> it = sourceIds.iterator();
        while(it.hasNext()) {
          Integer srcId = it.next();
          pPartition = _eventBuffer.getPhysicalPartition(srcId);
          if(pPartition == null)
            throw new RequestProcessingException("unable to find physical partitions for source:" + srcId);

          if(checkpointString != null) {
            cp = new Checkpoint(checkpointString);
          } else {
            cp = new Checkpoint();
            cp.setFlexible();
          }
          cpMult.addCheckpoint(pPartition, cp);
        }
      }

      if (isDebug) LOG.debug("checkpointStringMult = " + checkpointStringMult +  ";singlecheckpointString="+ checkpointString + ";CPM="+cpMult);

      // If the client has not sent a cursor partition, then use the one we may have retained as a part
      // of the server context.
      if (cpMult.getCursorPartition() == null) {
        cpMult.setCursorPartition(request.getCursorPartition());
      }
      if (isDebug) {
        if (cpMult.getCursorPartition() != null) {
          LOG.debug("Using physical paritition cursor " + cpMult.getCursorPartition());
        }
      }

      // for registerStreamRequest we need a single Checkpoint (TODO - fix it) (DDSDBUS-81)
      if(cp==null) {
        Iterator<Integer> it = sourceIds.iterator();
        if (it.hasNext()) {
          Integer srcId = it.next();
          pPartition = _eventBuffer.getPhysicalPartition(srcId);
          cp = cpMult.getCheckpoint(pPartition);
        } else {
          cp = new Checkpoint();
          cp.setFlexible();
        }
      }

      if (null != checkpointString && isDebug)
        LOG.debug("About to stream from cp: " + checkpointString.toString());

      HttpStatisticsCollector globalHttpStatsCollector = _relay.getHttpStatisticsCollector();
      HttpStatisticsCollector connHttpStatsCollector = null;
      if (null != globalHttpStatsCollector)
      {
        connHttpStatsCollector = (HttpStatisticsCollector)request.getParams().get(globalHttpStatsCollector.getName());
      }

      if (null != globalHttpStatsCollector) globalHttpStatsCollector.registerStreamRequest(cp, sourceIds);

      StatsCollectors<DbusEventsStatisticsCollector> statsCollectors = _relay.getOutBoundStatsCollectors();

      try
      {


        DbusEventBufferBatchReadable bufRead = v2Mode
          ? _eventBuffer.getDbusEventBufferBatchReadable(sourceIds, cpMult, statsCollectors)
          : _eventBuffer.getDbusEventBufferBatchReadable(cpMult, ppartKeys, statsCollectors);

        int eventsRead = 0;
        int minPendingEventSize = 0;
        StreamEventsResult result = null;

        bufRead.setClientMaxEventVersion(clientEventVersion);

        if (v2Mode)
        {
          result = bufRead.streamEvents(streamFromLatestSCN, fetchSize,
                                            request.getResponseContent(), enc, filters);
          eventsRead = result.getNumEventsStreamed();
          minPendingEventSize = result.getSizeOfPendingEvent();
          if(isDebug) {
            LOG.debug("Process: streamed " + eventsRead + " from sources " +
                     Arrays.toString(sourceIds.toArray()));
            LOG.debug("CP=" + cpMult); //can be used for debugging to stream from a cp
          }
          //if (null != statsCollectors) statsCollectors.mergeStatsCollectors();
        }
        else
        {
          result = bufRead.streamEvents(streamFromLatestSCN, fetchSize,
                                            request.getResponseContent(), enc, filters);
          eventsRead = result.getNumEventsStreamed();
          minPendingEventSize = result.getSizeOfPendingEvent();
          if(isDebug)
            LOG.debug("Process: streamed " + eventsRead + " with subscriptions " + subs);
          cpMult = bufRead.getCheckpointMult();
          if (cpMult != null) {
            request.setCursorPartition(cpMult.getCursorPartition());
          }
        }

        if (eventsRead == 0 && minPendingEventSize > 0)
        {
View Full Code Here

    _streamCallStartMs = System.currentTimeMillis();
    if (null != _relayCallsStats)
      _relayCallsStats.registerStreamRequest(cp, EMPTY_STREAM_LIST);
    int fetchSize = (int)((curState.getDataEventsBuffer().getBufferFreeReadSpace() / 100.0) * _pullerBufferUtilizationPct);
    fetchSize = Math.max(freeBufferThreshold, fetchSize);
    CheckpointMult cpMult = new CheckpointMult();
    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);
    }

    curState.switchToStreamRequestSent();
    sendHeartbeat(_sourcesConn.getUnifiedClientStats());
    curState.getRelayConnection().requestStream(
View Full Code Here

TOP

Related Classes of com.linkedin.databus.core.CheckpointMult

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.