예제 #1
0
  @Test
  public void rawtablePerfTest()
      throws TableDoesNotExistException, InvalidPathException, FileAlreadyExistException,
          TableColumnException, IOException, TException {
    int col = 200;

    long sMs = System.currentTimeMillis();
    int fileId = mClient.createRawTable("/table", col);
    //    System.out.println("A " + (System.currentTimeMillis() - sMs));

    sMs = System.currentTimeMillis();
    RawTable table = mClient.getRawTable(fileId);
    Assert.assertEquals(col, table.getColumns());
    table = mClient.getRawTable("/table");
    Assert.assertEquals(col, table.getColumns());
    //    System.out.println("B " + (System.currentTimeMillis() - sMs));

    sMs = System.currentTimeMillis();
    for (int k = 0; k < col; k++) {
      RawColumn rawCol = table.getRawColumn(k);
      rawCol.createPartition(0);
      TachyonFile file = rawCol.getPartition(0);
      OutStream outStream = file.getOutStream(OpType.WRITE_CACHE);
      outStream.write(TestUtils.getIncreasingByteArray(10));
      outStream.close();
    }
    //    System.out.println("C " + (System.currentTimeMillis() - sMs));

    sMs = System.currentTimeMillis();
    for (int k = 0; k < col; k++) {
      RawColumn rawCol = table.getRawColumn(k);
      TachyonFile file = rawCol.getPartition(0, true);
      Assert.assertEquals(TestUtils.getIncreasingByteBuffer(10), file.readByteBuffer());
      file.releaseFileLock();
    }
    //    System.out.println("D " + (System.currentTimeMillis() - sMs));

    sMs = System.currentTimeMillis();
    for (int k = 0; k < col; k++) {
      RawColumn rawCol = table.getRawColumn(k);
      TachyonFile file = rawCol.getPartition(0, true);
      Assert.assertEquals(TestUtils.getIncreasingByteBuffer(10), file.readByteBuffer());
      file.releaseFileLock();
    }
    //    System.out.println("E " + (System.currentTimeMillis() - sMs));
  }
예제 #2
0
  public static void readPartition()
      throws IOException, TableDoesNotExistException, InvalidPathException, TException {
    LOG.info("Reading data...");
    RawTable rawTable = sTachyonClient.getRawTable(mId);
    ByteBuffer metadata = rawTable.getMetadata();
    LOG.info("Metadata: ");
    LOG.info(metadata.getInt() + " ");
    LOG.info(metadata.getInt() + " ");
    LOG.info(metadata.getInt() + " ");

    for (int column = 0; column < COLS; column++) {
      RawColumn rawColumn = rawTable.getRawColumn(column);
      TachyonFile tFile = rawColumn.getPartition(0);

      ByteBuffer buf = tFile.readByteBuffer();
      if (buf == null) {
        tFile.recacheData();
      }
      CommonUtils.printByteBuffer(LOG, tFile.readByteBuffer());
      tFile.releaseFileLock();
    }
  }