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

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


    }

    @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

    public Throwable getException(ChunkedBodyReadableByteChannel readChannel)
    {
      switch(_exType)
      {
      case NO_EXCEPTION: return null;
      case BOOTSTRAP_TOO_OLD_EXCEPTION: return new BootstrapDatabaseTooOldException();
      default: return new Exception();
      }
    }
View Full Code Here

        curState.getRelayConnection().enableReadFromLatestScn(true);
          _currentState.setRelayFellOff(false);
        curState.switchToStreamResponseDone();
      } else {
        _log.fatal("Got SCNNotFoundException but Read Latest SCN Window and bootstrap are disabled !!");
        _remoteExceptionHandler.handleException(new BootstrapDatabaseTooOldException(knownRemoteError));
        enqueueMessage = false;
      }
    } else {
      _log.info("Requested scn " + cp.getWindowScn() +
          " not found on relay; switching to bootstrap service");
View Full Code Here

      {
        remoteException = new ScnNotFoundException();
      }
      else if (err.equalsIgnoreCase(BootstrapDatabaseTooOldException.class.getName()))
      {
        remoteException = new BootstrapDatabaseTooOldException();
      }
      else if (err.equalsIgnoreCase( PullerRetriesExhaustedException.class.getName()))
      {
        remoteException = new PullerRetriesExhaustedException();
      }
View Full Code Here

          if ( producerScn < startScn)
          {
            String msg = "Bootstrap Producer has lower SCN than Applier SCN. This is unexpected !! Producer SCN :" + producerScn + ", Applier SCN :" + startScn;
            LOG.fatal(msg);
            throw new BootstrapDatabaseTooOldException(msg);
          }

          if (producerScn < sinceScn)
          { // bootstrap producer needs sometime to consumer events in the buffer, wait a bit.
            LOG.warn("Bootstrap producer has not caught up to all events in its buffer yet to server client properly");
            Thread.sleep(QUERY_WAIT_TIME_SLICE);
          }
        }
        catch (InterruptedException e)
        {
          // keeps on sleeping until timed out
        }
        catch (SQLException e)
        {
          LOG.warn("SQLException encountered while querying for start scn", e);

        }
        finally
        {
        DBHelper.close(rs,getScnStmt, null);
        }
      }

      // Slow Producer case
      if ( producerScn < sinceScn)
      {
        String msg = "Bootstrap producer is slower than the client. Client is at SCN :" + sinceScn
                      + ", Producer is at SCN :" + producerScn + ", Applier is at SCN :" + startScn;
        LOG.error(msg);
        throw new BootstrapDatabaseTooOldException(msg);
      }

      LOG.info("StartSCN Request for sources :" + sources + ",Client SCN :" + sinceScn + ",Producer SCN :" + producerScn + ", Applier SCN :" + startScn);
      return startScn;
    }
View Full Code Here

    switch (status)
    {
      case BootstrapProducerStatus.ACTIVE:
        return;
      case BootstrapProducerStatus.FELL_OFF_RELAY:
        throw new BootstrapDatabaseTooOldException("The bootstrap database for source :" + source + " is too old!");
      case BootstrapProducerStatus.SEEDING:
        throw new BootstrapDatabaseTooOldException("The bootstrap database for source :" + source + " is being seeded!");
      case BootstrapProducerStatus.SEEDING_CATCHUP:
        throw new BootstrapDatabaseTooOldException("The bootstrap database for source :" + source + " is seeded but not yet consistent!");
      case BootstrapProducerStatus.INACTIVE:
        throw new BootstrapDatabaseTooOldException("Bootstrapping for source :" + source + " is disabled");
      default:
        // nothing to do at this point for those status
    }
  }
View Full Code Here

        if (_bootstrapProducerStaticConfig.isBootstrapDBStateCheck())
        {
          if (!BootstrapProducerStatus.isReadyForConsumption(srcIdStatus
              .getStatus()))
            throw new BootstrapDatabaseTooOldException(
                "Bootstrap DB is not ready to read from relay !! Status :"
                    + srcIdStatus);
        }
      }
    }
View Full Code Here

TOP

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

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.