Package org.apache.accumulo.server.logger

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


 
  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), fs.getConf());
    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


    Mutation m = new Mutation(new Text("somerow"));
    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);
View Full Code Here

    List<TabletMutations> updates = new ArrayList<TabletMutations>();
    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);
View Full Code Here

    LogFile logFile = writer.create(null, CREDENTIALS, "");
    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);
View Full Code Here

    LogFile logFile = writer.create(null, CREDENTIALS, "");
    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);
View Full Code Here

    LogFile logFile = writer.create(null, CREDENTIALS, "");
    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);
View Full Code Here

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 = 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);
    assertTrue(Arrays.equals(value.mutations, valueResult.mutations));
    assertTrue(in.read() == -1);
  }
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);
View Full Code Here

          UUID.fromString(name);
        } 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;
          }
        }
View Full Code Here

        encryptingLogFile = logFile;
      } else {
        encryptingLogFile = new DataOutputStream(encipheringOutputStream);
      }

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

TOP

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

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.