示例#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
  @Test
  public void getColumnsTest()
      throws InvalidPathException, FileAlreadyExistException, TableColumnException,
          TableDoesNotExistException, TException, FileDoesNotExistException {
    for (int k = 1; k < Constants.MAX_COLUMNS; k += Constants.MAX_COLUMNS / 5) {
      int fileId = mClient.createRawTable("/table" + k, k);
      RawTable table = mClient.getRawTable(fileId);
      Assert.assertEquals(k, table.getColumns());
      table = mClient.getRawTable("/table" + k);
      Assert.assertEquals(k, table.getColumns());

      fileId = mClient.createRawTable("/tabl" + k, k, TestUtils.getIncreasingByteBuffer(k % 10));
      table = mClient.getRawTable(fileId);
      Assert.assertEquals(k, table.getColumns());
      table = mClient.getRawTable("/tabl" + k);
      Assert.assertEquals(k, table.getColumns());
    }
  }