Examples of PhysicalPartition


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

      long prevScn = request.getRequiredLongParam(PREV_SCN_PARAM);
      long binlogOffset = request.getOptionalLongParam(BINLOG_OFFSET_PARAM, 0L);
      LOG.info("reset command = " + dbName + " part =" + dbPart);
      try
      {
        _relay.resetBuffer(new PhysicalPartition(Integer.parseInt(dbPart), dbName), prevScn, binlogOffset);
      }
      catch(BufferNotFoundException e)
      {
        reply = new String("command " + command + ":" + e.getMessage());
      }
View Full Code Here

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

       * Close the buffers
       */
      for (DbusEventBuffer dBuf : eventMult.bufIterable())
      {

        PhysicalPartition pp = dBuf.getPhysicalPartition();
        if (pp.getName().equals(dbName))
        {
          dBuf.closeBuffer(false);
          dBuf.removeMMapFiles();
          PhysicalPartitionKey pKey = new PhysicalPartitionKey(pp);
          eventMult.removeBuffer(pKey, null);
View Full Code Here

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

     
      if ( category.startsWith(INBOUND_VIEW))
      {
          String sourceIdStr = category.substring(INBOUND_VIEW.length());
          sourceIdStr = sourceIdStr.replace('/', ':');
          PhysicalPartition pPartition = PhysicalPartition.parsePhysicalPartitionString(sourceIdStr, ":");
          processInboundRequest(request,pPartition);
      } else {
        throw new InvalidRequestParamValueException(COMMAND_NAME, "category", category);
      }
     
View Full Code Here

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

    TestStatsCollectorCallback callback = new TestStatsCollectorCallback();
    collector.registerStatsCallback(callback);

    // Add 2 collectors for DB1
    PhysicalPartition p1 = new PhysicalPartition(1, "db1");
    PhysicalPartition p2 = new PhysicalPartition(2, "db1");
    DbusEventsStatisticsCollector c1 =
        new DbusEventsStatisticsCollector(1, "db1:1", true, false, null);
    DbusEventsStatisticsCollector c2 =
        new DbusEventsStatisticsCollector(1, "db1:2", true, false, null);
    collector.addStatsCollector(p1, c1);
View Full Code Here

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

    TestStatsCollectorCallback callback = new TestStatsCollectorCallback();
    collector.registerStatsCallback(callback);

    // Add 2 collectors for DB1
    PhysicalPartition p1 = new PhysicalPartition(1, "db1");
    PhysicalPartition p2 = new PhysicalPartition(2, "db1");
    DbusEventsStatisticsCollector c1 =
        new DbusEventsStatisticsCollector(1, "db1:1", true, false, null);
    DbusEventsStatisticsCollector c2 =
        new DbusEventsStatisticsCollector(1, "db1:2", true, false, null);
    collector.addStatsCollector(p1, c1);
    collector.addStatsCollector(p2, c2);

    // Add 2 collectors for DB2
    PhysicalPartition p3 = new PhysicalPartition(1, "db2");
    PhysicalPartition p4 = new PhysicalPartition(2, "db2");
    DbusEventsStatisticsCollector c3 =
        new DbusEventsStatisticsCollector(1, "db2:1", true, false, null);
    DbusEventsStatisticsCollector c4 =
        new DbusEventsStatisticsCollector(1, "db2:2", true, false, null);
    collector.addStatsCollector(p3, c3);
    collector.addStatsCollector(p4, c4);

    // Add 2 collectors for DB3
    PhysicalPartition p5 = new PhysicalPartition(3, "db3");
    PhysicalPartition p6 = new PhysicalPartition(4, "db3");
    DbusEventsStatisticsCollector c5 =
        new DbusEventsStatisticsCollector(1, "db3:3", true, false, null);
    DbusEventsStatisticsCollector c6 =
        new DbusEventsStatisticsCollector(1, "db3:4", true, false, null);
    collector.addStatsCollector(p5, c5);
View Full Code Here

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

{

  @Test
  public void testSimpleStringSerialization()
  {
    PhysicalPartition p1 = new PhysicalPartition(10, "testdb");
    Assert.assertEquals(p1.toSimpleString(), "testdb:10");

    PhysicalPartition p2 = PhysicalPartition.createAnyPartitionWildcard("somedb");
    Assert.assertEquals(p2.toSimpleString(), "somedb:*");
  }
View Full Code Here

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

  }

  @Test
  public void testSimpleStringDeserialization()
  {
    PhysicalPartition p1 = new PhysicalPartition(10, "testdb");
    PhysicalPartition p1test = PhysicalPartition.createFromSimpleString(p1.toSimpleString());
    Assert.assertEquals(p1test, p1);

    PhysicalPartition p2 = PhysicalPartition.createAnyPartitionWildcard("somedb");
    PhysicalPartition p2test = PhysicalPartition.createFromSimpleString(p2.toSimpleString());
    Assert.assertEquals(p2test, p2);

    PhysicalPartition p2test2 = PhysicalPartition.createFromSimpleString("somedb");
    Assert.assertEquals(p2test2, p2);
  }
View Full Code Here

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

  // test partial constructor
    @Test
    public void testPhysicalSourceConfigConstructor() {
      Integer pPartitionId = 10;
      String name = "dbName";
      PhysicalPartition pPartition = new PhysicalPartition(pPartitionId, name);
      PhysicalSource pSource = new PhysicalSource("uri");

      PhysicalSourceConfig pConfig = new PhysicalSourceConfig(pPartition.getName(), pSource.getUri(), pPartition.getId());

      int lSourceId = 10;
      String lSourceName = "lName";
      for(int i=0; i< 10; i++) {
        LogicalSourceConfig lSC = new LogicalSourceConfig();
View Full Code Here

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

  }

  @Test
  public void testParsePhysicalPartitionString () throws IOException {
    String partString  = "abc_123";
    PhysicalPartition pPart = PhysicalPartition.parsePhysicalPartitionString(partString, "_");
    assertEquals("abc", pPart.getName());
    assertEquals(123, pPart.getId().intValue());

    partString  = "abc.123";
      pPart = PhysicalPartition.parsePhysicalPartitionString(partString, "\\.");
      assertEquals("abc", pPart.getName());
      assertEquals(123, pPart.getId().intValue());

      String [] partStrings = new String [] {"abc.123","abc123", "123", "abc", "" };
      for(String s : partStrings) {
        try {
          PhysicalPartition.parsePhysicalPartitionString(s, "_");
View Full Code Here

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

      cfgBuilder.getTrace().setOption(RelayEventTraceOption.Option.file.toString());
      cfgBuilder.getTrace().setFilename(tmpFile.getAbsolutePath());
      cfgBuilder.getTrace().setNeedFileSuffix(true);

      //test that the first gets created
      PhysicalPartition pp = new PhysicalPartition(1, "TestPart");
      DbusEventFactory eventFactory = new DbusEventV2Factory();
      DbusEventBuffer buf1 = new DbusEventBuffer(cfgBuilder.build(), pp, eventFactory);
      buf1Trace = new File(tmpFile.getAbsolutePath() + "." + pp.getName() + "_" + pp.getId());
      Assert.assertTrue(buf1Trace.exists());

      buf1.start(1);
      for (int i = 1; i <= 10; ++i)
      {
        buf1.startEvents();
        buf1.appendEvent(new DbusEventKey(i), (short)0, (short)0, 0L, (short)0, new byte[16],
                         new byte[10], false, null);
        buf1.endEvents(10 * i);
      }

      long trace1len = buf1Trace.length();
      Assert.assertTrue(trace1len > 0);

      //create the second buffer and check its trace is different
      DbusEventBuffer buf2 = new DbusEventBuffer(cfgBuilder.build(), pp, eventFactory);
      buf2Trace = new File(tmpFile.getAbsolutePath() + "." + pp.getName() + "_" + pp.getId() + ".1");
      Assert.assertTrue(buf2Trace.exists());

      buf2.start(1);
      for (int i = 1; i <= 5; ++i)
      {
        buf2.startEvents();
        buf2.appendEvent(new DbusEventKey(i), (short)0, (short)0, 0L, (short)0, new byte[16],
                         new byte[10], false, null);
        buf2.endEvents(10 * i);
      }

      long trace2len = buf2Trace.length();
      Assert.assertTrue(trace2len > 0);
      Assert.assertTrue(buf1Trace.length() == trace1len);

      //create a third buffer and check its trace is different
      DbusEventBuffer buf3 = new DbusEventBuffer(cfgBuilder.build(), pp, eventFactory);
      buf3Trace = new File(tmpFile.getAbsolutePath() + "." + pp.getName() + "_" + pp.getId() + ".2");
      Assert.assertTrue(buf3Trace.exists());

      buf3.start(1);
      for (int i = 1; i <= 6; ++i)
      {
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.