Package com.linkedin.databus2.core.container.request

Examples of com.linkedin.databus2.core.container.request.BootstrapDBException


    }

    @Override
    protected DatabusComponentAdmin createComponentAdmin()
    { 
      return new DatabusComponentAdmin(this, null, "fake")
    }
View Full Code Here


  }

  @Override
  protected DatabusComponentAdmin createComponentAdmin()
  {
    return new DatabusComponentAdmin(this,
                                     getMbeanServer(),
                                     BootstrapHttpServer.class.getSimpleName());
  }
View Full Code Here

      {
        eventStatsCollectors.addStatsCollector(sw.getStatsName(), sw.getEventsStatsCollector());
      }

      //aggregator thread; 250 ms poll time
      GlobalStatsCalc agg = new GlobalStatsCalc(10);
      agg.registerStatsCollector(eventStatsCollectors);
      Thread aggThread = new Thread(agg);
      aggThread.start();

      //start writers
      for (StatsWriter sw : nStatsWriters)
      {
        sw.start();
      }

      //Let the writers start
      Thread.sleep(1000);

      long startTimeMs = System.currentTimeMillis();
      long durationInMs = 5*1000; //5s
      DbusEventsTotalStats globalStats = aggregateEventStatsCollectors.getTotalStats();
      long prevValue = 0, prevSize =0;
      while (System.currentTimeMillis() < (startTimeMs+durationInMs))
      {
        //constraint checks;

        //check that readers don't have partial updates or get initialized
        long value = globalStats.getNumDataEvents();
        long size = globalStats.getSizeDataEvents();
        Assert.assertTrue(value > 0);
        if (prevValue > 0 && (value != prevValue))
        {
          Assert.assertTrue(size != prevSize);
          prevValue = value;
          prevSize = size;
        }
        Assert.assertTrue(globalStats.getMaxSeenWinScn() > 0);
        Thread.sleep(RngUtils.randomPositiveInt()%10+1);
      }
      //shut down
      for (StatsWriter sw : nStatsWriters)
      {
        sw.shutdown();
        sw.interrupt();
      }
      //Give a chance to catch up
      Thread.sleep(1000);

      agg.halt();
      aggThread.interrupt();

      //final tally aggregatedEventTotalStats = sum of all individual statsWriter objects in a thread free way

      AggregatedDbusEventsTotalStats myTotalStats = new AggregatedDbusEventsTotalStats(StatsWriter.OWNERID, "mytotal", true, false, null);
View Full Code Here

   * @param opcode          the TCP command opcode
   * @return the parser or null if no such command has been registered.
   */
  public BinaryCommandParser createParser(byte opcode, Channel channel, ByteOrder byteOrder)
  {
    BinaryCommandParserFactory factory = _binaryParsers.get(opcode);
    return (null != factory) ? factory.createParser(channel, byteOrder) : null;
  }
View Full Code Here

      {
        remoteException = new BootstrapDatabaseTooYoungException();
      }
      else if (err.equalsIgnoreCase(BootstrapDBException.class.getName()))
      {
        remoteException = new BootstrapDBException();
      }
      else if (err.equalsIgnoreCase(SQLException.class.getName()))
      {
        remoteException = new SQLException();
      }
View Full Code Here

    if ((null == sourceNames) || (sourceNames.isEmpty()))
    {
      String msg = "SourceNames is empty for getMinWindowSCNFromStateTable !!";
      LOG.error(msg);
      throw new BootstrapDBException(msg);
    }

    for (String s : sourceNames)
    {
      SourceStatusInfo info = getSrcIdStatusFromDB(s, false);
      if (info.getSrcId() <0)
      {
        String msg = "Unable to determine sourceId for sourceName :" + s + " Source List is :" + sourceNames;
        LOG.error(msg);
        throw new BootstrapDBException(msg);
      }

      srcIdList.add(info.getSrcId());
    }
View Full Code Here

        bootstrapProducerStaticConfig.getBootstrapDBName());
    if (!_dbDao.doesMinScnTableExist())
    {
      LOG.error("Bootstrap table not found! Please create table: "
          + BootstrapDBMetaDataDAO.CREATE_MINSCN_TABLE);
      throw new BootstrapDBException(
          "Bootstrap DB does not have necessary meta data table! "
              + BootstrapDBMetaDataDAO.MIN_SCN_TABLE_NAME);
    }
    initBootstrapDBMetadata();
View Full Code Here

        {
          // Bootstrapping bootstrap Producer not yet supported !!
          String msg = "Bootstrap Producer starting from non-online consumption mode for sources :"
              + sourceNames + ", Ckpt :" + cp;
          LOG.error(msg);
          throw new BootstrapDBException(msg);
        }
        else
        {
          String msg = null;
          if (((cp.getWindowScn() > scn) && (scn > -1))
              || ((cp.getWindowScn() < scn) && (scn > -1)))
          {

            if (((cp.getWindowScn() > scn) && (scn > -1)))
              LOG.warn("Non-Empty checkpint. Bootstrap Producer is at SCN:"
                  + scn
                  + ", while checkpoint is :"
                  + cp
                  + ", Could result in gap in event consumption. Repairing ckpt !!");
            else
              LOG.info("Non-Empty checkpoint. Bootstrap Producer is at SCN:"
                  + scn + ", while checkpoint is :" + cp
                  + ", Copying producer Scn to checkpoint !!");

            cp.setWindowScn(scn);
            cp.setWindowOffset(-1);
            try
            {
              provider.removeCheckpoint(sourceNames);
              provider.storeCheckpoint(sourceNames, cp);

              // Check if persisted properly
              cp = provider.loadCheckpoint(sourceNames);
              if ((null == cp)
                  || (cp.getWindowScn() != scn)
                  || (cp.getWindowOffset() != -1)
                  || (cp.getConsumptionMode() != DbusClientMode.ONLINE_CONSUMPTION))
              {
                msg = "Unable to repair and store the new checkpoint (" + cp
                    + ") to make it same as producer SCN (" + scn + ") !!";
                LOG.fatal(msg);
                throw new BootstrapDBException(msg);
              }
            } catch (IOException ex)
            {
              msg = "Unable to repair and store the new checkpoint (" + cp
                  + ") to make it same as producer SCN (" + scn + ") !!";
              LOG.fatal(msg, ex);
              throw new BootstrapDBException(msg);
            }
          }
        }
      }
      else
      {
        /**
         * Currently since bootstrapping is not available, a null ckpt would
         * result in flexible checkpoint and could result in gap !!
         */
        if (scn > -1)
        {
          String msg = "Empty checkpoint. Bootstrap Producer SCN is at SCN:"
              + scn
              + ", while checkpoint is null !! Could result in gap in event consumption. Repairing ckpt !!";
          LOG.warn(msg);
          cp = new Checkpoint();
          cp.setWindowScn(scn);
          cp.setWindowOffset(-1);
          cp.setConsumptionMode(DbusClientMode.ONLINE_CONSUMPTION);
          try
          {
            provider.removeCheckpoint(sourceNames);
            provider.storeCheckpoint(sourceNames, cp);

            // Check if persisted properly
            cp = provider.loadCheckpoint(sourceNames);
            if ((null == cp)
                || (cp.getWindowScn() != scn)
                || (cp.getWindowOffset() != -1)
                || (cp.getConsumptionMode() != DbusClientMode.ONLINE_CONSUMPTION))
            {
              LOG.fatal("Unable to repair and store the checkpoint (" + cp
                  + ") to make it same as producer SCN (" + scn + ") !!");
              throw new BootstrapDBException(msg);
            }
          } catch (IOException ex)
          {
            msg = "Unable to repair and store the checkpoint (" + cp
                + ") to make it same as producer SCN (" + scn + ") !!";
            LOG.fatal(msg, ex);
            throw new BootstrapDBException(msg);
          }
        }
      }
    }
    LOG.info("Validating bootstrap DB checkpoints done successfully!!");
View Full Code Here

    LOG.info("Initializing Bootstrap HTTP Server");
    LOG.info("Config=" + _bootstrapServerConfig);
    try{
      RequestProcessorRegistry processorRegistry = getProcessorRegistry();
      processorRegistry.register(ConfigRequestProcessor.COMMAND_NAME,
                                 new ConfigRequestProcessor(null, this));
      processorRegistry.register(BootstrapRequestProcessor.COMMAND_NAME,
                                 new BootstrapRequestProcessor(null, _bootstrapServerConfig, this));
      processorRegistry.register(StartSCNRequestProcessor.COMMAND_NAME,
                                 new StartSCNRequestProcessor(null, _bootstrapServerConfig, this));
      processorRegistry.register(TargetSCNRequestProcessor.COMMAND_NAME,
View Full Code Here

      processorRegistry.register(StartSCNRequestProcessor.COMMAND_NAME,
                                 new StartSCNRequestProcessor(null, _bootstrapServerConfig, this));
      processorRegistry.register(TargetSCNRequestProcessor.COMMAND_NAME,
                                 new TargetSCNRequestProcessor(null, _bootstrapServerConfig, this));
      processorRegistry.register(ContainerOperationProcessor.COMMAND_NAME,
                                 new ContainerOperationProcessor(null, this));
    }
    catch (SQLException sqle)
    {
      throw new DatabusException("command registration failed", sqle);
    }
View Full Code Here

TOP

Related Classes of com.linkedin.databus2.core.container.request.BootstrapDBException

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.