Examples of LogFileKey


Examples of org.apache.accumulo.tserver.logger.LogFileKey

  static class KeyValue implements Comparable<KeyValue> {
    public final LogFileKey key;
    public final LogFileValue value;

    KeyValue() {
      key = new LogFileKey();
      value = new LogFileValue();
    }
View Full Code Here

Examples of org.apache.accumulo.tserver.logger.LogFileKey

    HashSet<String> suffixes = new HashSet<String>();
    for (String path : tabletFiles)
      suffixes.add(getPathSuffix(path));

    // Scan for tableId for this extent (should always be in the log)
    LogFileKey key = new LogFileKey();
    LogFileValue value = new LogFileValue();
    int tid = -1;
    if (!reader.next(key, value))
      throw new EmptyMapFileException();
    if (key.event != OPEN)
      throw new RuntimeException("First log entry value is not OPEN");
   
    if (key.tserverSession.compareTo(lastStartToFinish.tserverSession) != 0) {
      if (lastStartToFinish.compactionStatus == Status.LOOKING_FOR_FINISH)
        throw new RuntimeException("COMPACTION_FINISH (without preceding COMPACTION_START) is not followed by a successful minor compaction.");
      lastStartToFinish.update(key.tserverSession);
    }
    KeyExtent alternative = extent;
    if (extent.isRootTablet()) {
      alternative = RootTable.OLD_EXTENT;
    }
   
    LogFileKey defineKey = null;
   
    // find the maximum tablet id... because a tablet may leave a tserver and then come back, in which case it would have a different tablet id
    // for the maximum tablet id, find the minimum sequence #... may be ok to find the max seq, but just want to make the code behave like it used to
    while (reader.next(key, value)) {
      // LogReader.printEntry(entry);
      if (key.event != DEFINE_TABLET)
        break;
      if (key.tablet.equals(extent) || key.tablet.equals(alternative)) {
        if (tid != key.tid) {
          tid = key.tid;
          defineKey = key;
          key = new LogFileKey();
        }
      }
    }
    if (tid < 0) {
      throw new UnusedException();
View Full Code Here

Examples of org.apache.accumulo.tserver.logger.LogFileKey

    }
    return tid;
  }
 
  private void playbackMutations(MultiReader reader, int tid, LastStartToFinish lastStartToFinish, MutationReceiver mr) throws IOException {
    LogFileKey key = new LogFileKey();
    LogFileValue value = new LogFileValue();
   
    // Playback mutations after the last stop to finish
    log.info("Scanning for mutations starting at sequence number " + lastStartToFinish.seq + " for tid " + tid);
    key.event = MUTATION;
View Full Code Here

Examples of org.apache.accumulo.tserver.logger.LogFileKey

      } else {
        log.debug("Enciphering found, wrapping in DataOutputStream");
        encryptingLogFile = new DataOutputStream(encipheringOutputStream);
      }

      LogFileKey key = new LogFileKey();
      key.event = OPEN;
      key.tserverSession = filename;
      key.filename = filename;
      write(key, EMPTY);
      sync.invoke(logFile);
View Full Code Here

Examples of org.apache.accumulo.tserver.logger.LogFileKey

      }
  }

  public synchronized void defineTablet(int seq, int tid, KeyExtent tablet) throws IOException {
    // write this log to the METADATA table
    final LogFileKey key = new LogFileKey();
    key.event = DEFINE_TABLET;
    key.seq = seq;
    key.tid = tid;
    key.tablet = tablet;
    try {
View Full Code Here

Examples of org.apache.accumulo.tserver.logger.LogFileKey

  }

  public LoggerOperation logManyTablets(List<TabletMutations> mutations) throws IOException {
    List<Pair<LogFileKey,LogFileValue>> data = new ArrayList<Pair<LogFileKey,LogFileValue>>();
    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();
View Full Code Here

Examples of org.apache.accumulo.tserver.logger.LogFileKey

    }
    return logFileData(data);
  }

  public LoggerOperation minorCompactionFinished(int seq, int tid, String fqfn) throws IOException {
    LogFileKey key = new LogFileKey();
    key.event = COMPACTION_FINISH;
    key.seq = seq;
    key.tid = tid;
    return logFileData(Collections.singletonList(new Pair<LogFileKey,LogFileValue>(key, EMPTY)));
  }
View Full Code Here

Examples of org.apache.accumulo.tserver.logger.LogFileKey

    key.tid = tid;
    return logFileData(Collections.singletonList(new Pair<LogFileKey,LogFileValue>(key, EMPTY)));
  }

  public LoggerOperation minorCompactionStarted(int seq, int tid, String fqfn) throws IOException {
    LogFileKey key = new LogFileKey();
    key.event = COMPACTION_START;
    key.seq = seq;
    key.tid = tid;
    key.filename = fqfn;
    return logFileData(Collections.singletonList(new Pair<LogFileKey,LogFileValue>(key, EMPTY)));
View Full Code Here

Examples of org.apache.accumulo.tserver.logger.LogFileKey

public class LogFileTest {
 
  static private void readWrite(LogEvents event, long seq, int tid, String filename, KeyExtent tablet, Mutation[] mutations, LogFileKey keyResult,
      LogFileValue valueResult) throws IOException {
    LogFileKey key = new LogFileKey();
    key.event = event;
    key.seq = seq;
    key.tid = tid;
    key.filename = filename;
    key.tablet = tablet;
    key.tserverSession = keyResult.tserverSession;
    LogFileValue value = new LogFileValue();
    value.mutations = Arrays.asList(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);
    assertTrue(key.compareTo(keyResult) == 0);
    assertEquals(value.mutations, valueResult.mutations);
    assertTrue(in.read() == -1);
  }
View Full Code Here

Examples of org.apache.accumulo.tserver.logger.LogFileKey

    assertTrue(in.read() == -1);
  }
 
  @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);
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.