Package com.linkedin.databus.core

Examples of com.linkedin.databus.core.BootstrapCheckpointHandler


    try
    {
      log.info("initial setup");
      final List<String> sourceNamesList = Arrays.asList(SOURCE1_NAME);
      final Checkpoint cp = Checkpoint.createOnlineConsumptionCheckpoint(0);
      BootstrapCheckpointHandler cpHandler = new BootstrapCheckpointHandler(sourceNamesList);
      cpHandler.createInitialBootstrapCheckpoint(cp, 0L);
      final DummyDatabusBootstrapConnectionStateMessage bstCallback =
          new DummyDatabusBootstrapConnectionStateMessage(log);

      log.info("process a normal startSCN which should establish the connection");
      sendStartScnHappyPath(conn, cp, bstCallback, SOURCE1_NAME, 100L, log);
View Full Code Here


          cpNew.setCatchupOffset(-1);
          break;
        }*/
        case BOOTSTRAP_SNAPSHOT:
        {
          BootstrapCheckpointHandler handler = new BootstrapCheckpointHandler(_sources);
          cpNew = handler.createInitialBootstrapCheckpoint(cpNew, _sinceScn);
          //if (null != _bootstrapSource) cpNew.setSnapshotSource(_bootstrapSource);
          cpNew.setSnapshotOffset(-1);
          break;
        }
        default:
View Full Code Here

  // This method is overridden for V3
  public void createBootstrapCheckpointHandler()
  {
    assert _bstCheckpointHandler == null : "BootstrapCheckpointHandler already initialized " + _bstCheckpointHandler.toString();
    _bstCheckpointHandler = new BootstrapCheckpointHandler(_sourcesNames);
  }
View Full Code Here

                null, //registrationId
                null // logger
                );
        dispatcher.setSchemaIdCheck(false);

        BootstrapCheckpointHandler cptHandler = new BootstrapCheckpointHandler("source1");
        long sinceScn=15000L;
        long startTsNsecs = System.nanoTime();
        final Checkpoint initCheckpoint = cptHandler.createInitialBootstrapCheckpoint(null, sinceScn);
        initCheckpoint.setBootstrapStartNsecs(startTsNsecs);
        initCheckpoint.setBootstrapStartScn(0L);

        /* Launch writer */
        //numBootstrapCheckpoint - number of checkpoints before writing end of period
View Full Code Here

            _log.info("Bootstrap events read so far: " + numEventsInCurrentState);

            String status = readChannel.getMetadata("PhaseCompleted");

            final BootstrapCheckpointHandler ckptHandler = curState.getBstCheckpointHandler();
            if (status != null)
            { // set status in checkpoint to indicate that we are done with the current source
              if (cp.getConsumptionMode() == DbusClientMode.BOOTSTRAP_CATCHUP)
              {
                ckptHandler.finalizeCatchupPhase(cp);
              }
              else if (cp.getConsumptionMode() == DbusClientMode.BOOTSTRAP_SNAPSHOT)
              {
                ckptHandler.finalizeSnapshotPhase(cp);
              }
              else
              {
                 throw new RuntimeException("Invalid bootstrap phase: " + cp.getConsumptionMode());
              }
View Full Code Here

  private void determineNextStateFromCheckpoint(ConnectionState curState)
  {
    try
    {
      final Checkpoint cp = curState.getCheckpoint();
      final BootstrapCheckpointHandler cpHandler = curState.getBstCheckpointHandler();
      cpHandler.assertBootstrapCheckpoint(cp);
      switch (cp.getConsumptionMode())
      {
      case BOOTSTRAP_SNAPSHOT:
        determineNextStateFromSnapshotCheckpoint(cp, cpHandler, curState);
        break;
View Full Code Here

  {
    _targetScn = -1;
    _initState = initCheckpoint;
    _currState = _initState;
    sources = bootstrapSources;
    _bstCheckpointHandler = new BootstrapCheckpointHandler(sources);
    init();
  }
View Full Code Here

    long startScn = 1; /* getProcessor().getCurrentScn(); */
    _targetScn = startScn;

    sources = bootstrapSources;
    _bstCheckpointHandler = new BootstrapCheckpointHandler(sources);

    _initState = _bstCheckpointHandler.createInitialBootstrapCheckpoint(null, 12345L);
    _initState.setBootstrapStartScn(startScn);

    _currState = _initState;
View Full Code Here

      //insert one row
      insertOneSnapshotEvent(dao, srcStatusInfo.getSrcId(), Long.MAX_VALUE - 10,
                             Long.MAX_VALUE - 100, "check", "test_payload_data");

      BootstrapCheckpointHandler bstCheckpointHandler =
          new BootstrapCheckpointHandler(sourceName);
      Checkpoint c = bstCheckpointHandler.createInitialBootstrapCheckpoint(null, 0L);

      c.setConsumptionMode(DbusClientMode.BOOTSTRAP_SNAPSHOT);
          c.setBootstrapStartScn(Long.MAX_VALUE - 10);
      c.setSnapshotOffset(Long.MAX_VALUE - 1000);
      // System.out.println("Snapshot");
      processor.streamSnapShotRows(c, processorCallback);
      Assert.assertEquals(processorCallback.getrIds().size(), 1);
      Assert.assertEquals(Long.MAX_VALUE-10, processorCallback.getrIds().get(0).longValue());
      Assert.assertEquals(Long.MAX_VALUE-100, processorCallback.getSequences().get(0).longValue());
      Assert.assertEquals("check", processorCallback.getSrcKeys().get(0));
      Assert.assertEquals("test_payload_data", new String(processorCallback.getValues().get(0)));

      processorCallback.reset();

          c.setSnapshotOffset(Checkpoint.FULLY_CONSUMED_WINDOW_OFFSET);
          c.setBootstrapTargetScn(c.getBootstrapStartScn().longValue());
          bstCheckpointHandler.advanceAfterTargetScn(c);

          bstCheckpointHandler.advanceAfterSnapshotPhase(c);
//      c.setConsumptionMode(DbusClientMode.BOOTSTRAP_CATCHUP);
//      c.setCatchupSource(sourceName);
//      c.setWindowScn(0L);
//      c.setWindowOffset(0);
View Full Code Here

TOP

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

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.