Package org.apache.accumulo.server.logger

Examples of org.apache.accumulo.server.logger.LogFileValue


    key.seq = seq;
    key.tid = tid;
    key.filename = filename;
    key.tablet = tablet;
    key.tserverSession = keyResult.tserverSession;
    LogFileValue value = new LogFileValue();
    value.mutations = mutations != null ? mutations : new Mutation[0];
    DataOutputBuffer out = new DataOutputBuffer();
    key.write(out);
    value.write(out);
    out.flush();
    DataInputBuffer in = new DataInputBuffer();
    in.reset(out.getData(), out.size());
    keyResult.readFields(in);
    valueResult.readFields(in);
View Full Code Here


  }
 
  @Test
  public void testReadFields() throws IOException {
    LogFileKey key = new LogFileKey();
    LogFileValue value = new LogFileValue();
    key.tserverSession = "";
    readWrite(OPEN, -1, -1, null, null, null, key, value);
    assertEquals(key.event, OPEN);
    readWrite(COMPACTION_FINISH, 1, 2, null, null, null, key, value);
    assertEquals(key.event, COMPACTION_FINISH);
View Full Code Here

        } catch (IllegalArgumentException ex) {
          log.info("Ignoring non-log file " + name + " in " + localWalDirectory);
          continue;
        }
        LogFileKey key = new LogFileKey();
        LogFileValue value = new LogFileValue();
        log.info("Openning local log " + file.getPath());
        Reader reader = new SequenceFile.Reader(localfs, file.getPath(), localfs.getConf());
        Path tmp = new Path(Constants.getWalDirectory(conf) + "/" + name + ".copy");
        FSDataOutputStream writer = fs.create(tmp);
        while (reader.next(key, value)) {
          try {
            key.write(writer);
            value.write(writer);
          } catch (EOFException ex) {
            break;
          }
        }
        writer.close();
View Full Code Here

    for (TabletMutations tabletMutations : mutations) {
      LogFileKey key = new LogFileKey();
      key.event = MANY_MUTATIONS;
      key.seq = tabletMutations.getSeq();
      key.tid = tabletMutations.getTid();
      LogFileValue value = new LogFileValue();
      value.mutations = tabletMutations.getMutations();
      data.add(new Pair<LogFileKey, LogFileValue>(key, value));
    }
    return logFileData(data);
  }
View Full Code Here

  private SequenceFile.Reader readOpen(LogFile logFile) throws Exception {
    String path = "./target/" + logFile.name;
    assertTrue(fs.exists(new Path(path)));
    SequenceFile.Reader result = new SequenceFile.Reader(fs, new Path(path), conf);
    LogFileKey key = new LogFileKey();
    LogFileValue value = new LogFileValue();
    assertTrue(result.next(key, value));
    assertTrue(key.event == LogEvents.OPEN);
    assertTrue(key.tid == LogFileKey.VERSION);
    return result;
  }
View Full Code Here

    m.put(new Text("cf1"), new Text("cq1"), new Value("value1".getBytes()));
    writer.log(null, logFile.id, 2, 42, m.toThrift());
    writer.close(null, logFile.id);
    SequenceFile.Reader dis = readOpen(logFile);
    LogFileKey key = new LogFileKey();
    LogFileValue value = new LogFileValue();
    assertTrue(dis.next(key, value));
    assertTrue(key.event == MUTATION);
    assertEquals(key.seq, 2);
    assertEquals(key.tid, 42);
    assertEquals(value.mutations.length, 1);
View Full Code Here

    updates.add(new TabletMutations(13, 3, all));
    writer.logManyTablets(null, logFile.id, updates);
    writer.close(null, logFile.id);
    SequenceFile.Reader dis = readOpen(logFile);
    LogFileKey key = new LogFileKey();
    LogFileValue value = new LogFileValue();
    assertTrue(dis.next(key, value));
    assertTrue(key.event == MANY_MUTATIONS);
    assertEquals(key.seq, 3);
    assertEquals(key.tid, 13);
    assertEquals(value.mutations.length, 10);
View Full Code Here

    String fqfn = "/foo/bar";
    writer.minorCompactionFinished(null, logFile.id, 4, 17, fqfn);
    writer.close(null, logFile.id);
    SequenceFile.Reader dis = readOpen(logFile);
    LogFileKey key = new LogFileKey();
    LogFileValue value = new LogFileValue();
    assertTrue(dis.next(key, value));
    assertTrue(key.event == COMPACTION_FINISH);
    assertEquals(key.seq, 4);
    assertEquals(key.tid, 17);
    cleanup(logFile);
View Full Code Here

    String fqfn = "/foo/bar";
    writer.minorCompactionStarted(null, logFile.id, 5, 23, fqfn);
    writer.close(null, logFile.id);
    SequenceFile.Reader dis = readOpen(logFile);
    LogFileKey key = new LogFileKey();
    LogFileValue value = new LogFileValue();
    assertTrue(dis.next(key, value));
    assertTrue(key.event == COMPACTION_START);
    assertEquals(key.seq, 5);
    assertEquals(key.tid, 23);
    assertEquals(key.filename, "/foo/bar");
View Full Code Here

    KeyExtent ke = new KeyExtent(new Text("table1"), new Text("zzzz"), new Text("aaaaa"));
    writer.defineTablet(null, logFile.id, 6, 31, ke.toThrift());
    writer.close(null, logFile.id);
    SequenceFile.Reader dis = readOpen(logFile);
    LogFileKey key = new LogFileKey();
    LogFileValue value = new LogFileValue();
    assertTrue(dis.next(key, value));
    assertTrue(key.event == DEFINE_TABLET);
    assertEquals(key.seq, 6);
    assertEquals(key.tid, 31);
    assertEquals(ke, key.tablet);
View Full Code Here

TOP

Related Classes of org.apache.accumulo.server.logger.LogFileValue

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.