Package org.apache.accumulo.server.data

Examples of org.apache.accumulo.server.data.ServerMutation


  public void testMultipleTabletDefinition() throws Exception {
    // test for a tablet defined multiple times in a log file
    // there was a bug where the oldest tablet id was used instead
    // of the newest

    Mutation ignored = new ServerMutation(new Text("row1"));
    ignored.put("foo", "bar", "v1");
    Mutation m = new ServerMutation(new Text("row1"));
    m.put("foo", "bar", "v1");

    KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET, 1, 1, extent),
        createKeyValue(DEFINE_TABLET, 1, 2, extent), createKeyValue(MUTATION, 2, 2, ignored), createKeyValue(COMPACTION_START, 3, 2, "/t1/f1"),
        createKeyValue(MUTATION, 4, 2, m), createKeyValue(COMPACTION_FINISH, 6, 2, null),};
View Full Code Here


  @Test
  public void testNoFinish0() throws Exception {
    // its possible that a minor compaction finishes successfully, but the process dies before writing the compaction event

    Mutation ignored = new ServerMutation(new Text("row1"));
    ignored.put("foo", "bar", "v1");

    KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET, 1, 2, extent),
        createKeyValue(MUTATION, 2, 2, ignored), createKeyValue(COMPACTION_START, 3, 2, "/t/f1")};

    Arrays.sort(entries);
View Full Code Here

  @Test
  public void testNoFinish1() throws Exception {
    // its possible that a minor compaction finishes successfully, but the process dies before writing the compaction event

    Mutation ignored = new ServerMutation(new Text("row1"));
    ignored.put("foo", "bar", "v1");
    Mutation m = new ServerMutation(new Text("row1"));
    m.put("foo", "bar", "v2");

    KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET, 1, 2, extent),
        createKeyValue(MUTATION, 2, 2, ignored), createKeyValue(COMPACTION_START, 3, 2, "/t/f1"), createKeyValue(MUTATION, 4, 2, m),};

    Arrays.sort(entries);
View Full Code Here

    Assert.assertEquals(1, mutations.size());
    Assert.assertEquals(m, mutations.get(0));
  }

  private void runPathTest(boolean startMatches, String compactionStartFile, String... tabletFiles) throws IOException {
    Mutation m1 = new ServerMutation(new Text("row1"));
    m1.put("foo", "bar", "v1");
    Mutation m2 = new ServerMutation(new Text("row1"));
    m2.put("foo", "bar", "v2");

    KeyValue entries[] = new KeyValue[] {createKeyValue(OPEN, 0, -1, "1"), createKeyValue(DEFINE_TABLET, 1, 2, extent),
        createKeyValue(MUTATION, 2, 2, m1), createKeyValue(COMPACTION_START, 3, 2, compactionStartFile), createKeyValue(MUTATION, 4, 2, m2),};

    Arrays.sort(entries);
View Full Code Here

  @Override
  public void readFields(DataInput in) throws IOException {
    int count = in.readInt();
    mutations = new ArrayList<Mutation>(count);
    for (int i = 0; i < count; i++) {
      ServerMutation mutation = new ServerMutation();
      mutation.readFields(in);
      mutations.add(mutation);
    }
  }
View Full Code Here

  }

  @Test
  public void testSetUpdateTimes() {
    List<Mutation> ms = new java.util.ArrayList<Mutation>();
    ServerMutation m = createMock(ServerMutation.class);
    ServerMutation m2 = createMock(ServerMutation.class);
    m.setSystemTimestamp(1235L);
    replay(m);
    m2.setSystemTimestamp(1236L);
    replay(m2);
    ms.add(m);
    ms.add(m2);
    long currTime = ltime.setUpdateTimes(ms);
    assertEquals(TIME + 2L, currTime);
View Full Code Here

    assertEquals('M', TabletTime.getTimeID(TimeType.MILLIS));
  }

  @Test
  public void testSetSystemTimes() {
    ServerMutation m = createMock(ServerMutation.class);
    long lastCommitTime = 1234L;
    m.setSystemTimestamp(lastCommitTime);
    replay(m);
    mtime.setSystemTimes(m, lastCommitTime);
    verify(m);
  }
View Full Code Here

  }

  @Test
  public void testSetUpdateTimes() {
    List<Mutation> ms = new java.util.ArrayList<Mutation>();
    ServerMutation m = createMock(ServerMutation.class);
    m.setSystemTimestamp(anyLong());
    replay(m);
    ms.add(m);
    long currTime = mtime.setUpdateTimes(ms);
    assertTrue(currTime > TIME);
    verify(m);
View Full Code Here

  public abstract long getTime();
 
  public abstract long getAndUpdateTime();
 
  protected void setSystemTimes(Mutation mutation, long lastCommitTime) {
    ServerMutation m = (ServerMutation) mutation;
    m.setSystemTimestamp(lastCommitTime);
  }
View Full Code Here

    readWrite(DEFINE_TABLET, 5, 6, null, tablet, null, key, value);
    assertEquals(key.event, DEFINE_TABLET);
    assertEquals(key.seq, 5);
    assertEquals(key.tid, 6);
    assertEquals(key.tablet, tablet);
    Mutation m = new ServerMutation(new Text("row"));
    m.put(new Text("cf"), new Text("cq"), new Value("value".getBytes()));
    readWrite(MUTATION, 7, 8, null, null, new Mutation[] {m}, key, value);
    assertEquals(key.event, MUTATION);
    assertEquals(key.seq, 7);
    assertEquals(key.tid, 8);
    assertEquals(value.mutations, Arrays.asList(m));
    m = new ServerMutation(new Text("row"));
    m.put(new Text("cf"), new Text("cq"), new ColumnVisibility("vis"), 12345, new Value("value".getBytes()));
    m.put(new Text("cf"), new Text("cq"), new ColumnVisibility("vis2"), new Value("value".getBytes()));
    m.putDelete(new Text("cf"), new Text("cq"), new ColumnVisibility("vis2"));
    readWrite(MUTATION, 8, 9, null, null, new Mutation[] {m}, key, value);
    assertEquals(key.event, MUTATION);
    assertEquals(key.seq, 8);
    assertEquals(key.tid, 9);
    assertEquals(value.mutations, Arrays.asList(m));
View Full Code Here

TOP

Related Classes of org.apache.accumulo.server.data.ServerMutation

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.