当前位置: 首页>>代码示例>>Java>>正文


Java VoltTableUtil类代码示例

本文整理汇总了Java中org.voltdb.utils.VoltTableUtil的典型用法代码示例。如果您正苦于以下问题:Java VoltTableUtil类的具体用法?Java VoltTableUtil怎么用?Java VoltTableUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


VoltTableUtil类属于org.voltdb.utils包,在下文中一共展示了VoltTableUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: formatFinalResults

import org.voltdb.utils.VoltTableUtil; //导入依赖的package包/类
@Override
public String formatFinalResults(BenchmarkResults br) {
    if (this.stop) return (null);
    
    VoltTable vt = new VoltTable(COLUMNS);
    for (Object row[] : this.results) {
        vt.addRow(row);
    }
    
    try {
        FileWriter writer = new FileWriter(this.outputPath);
        VoltTableUtil.csv(writer, vt, true);
        writer.close();
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
    LOG.info("Wrote CSV table stats periodically to '" + this.outputPath.getAbsolutePath() + "'");
    return (null);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:20,代码来源:TableStatsPrinter.java

示例2: formatFinalResults

import org.voltdb.utils.VoltTableUtil; //导入依赖的package包/类
@Override
public String formatFinalResults(BenchmarkResults br) {
    if (this.stop) return (null);
    
    VoltTable vt = new VoltTable(COLUMNS);
    for (Object row[] : this.results) {
        vt.addRow(row);
    }
    
    try {
        FileWriter writer = new FileWriter(this.outputPath);
        VoltTableUtil.csv(writer, vt, true);
        writer.close();
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
    LOG.info("Wrote CSV results to '" + this.outputPath.getAbsolutePath() + "'");
    return (null);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:20,代码来源:CSVResultsPrinter.java

示例3: formatFinalResults

import org.voltdb.utils.VoltTableUtil; //导入依赖的package包/类
@Override
public String formatFinalResults(BenchmarkResults br) {
    if (this.stop) return (null);
    
    VoltTable vt = new VoltTable(this.columns);
    for (Object row[] : this.results) {
        vt.addRow(row);
    }
    
    try {
        FileWriter writer = new FileWriter(this.outputPath);
        VoltTableUtil.csv(writer, vt, true);
        writer.close();
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
    LOG.info("Wrote CSV memory stats to '" + this.outputPath.getAbsolutePath() + "'");
    return (null);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:20,代码来源:MemoryStatsPrinter.java

示例4: evictData

import org.voltdb.utils.VoltTableUtil; //导入依赖的package包/类
private VoltTable evictData() throws Exception {
     VoltTable results[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, false, 0L);
     assertEquals(1, results.length);
     // System.err.println(VoltTableUtil.format(results));
     for (String col : statsFields) {
results[0].advanceRow(); 
         int idx = results[0].getColumnIndex(col);
         assertEquals(0, results[0].getLong(idx));    
     } // FOR
     
     // Now force the EE to evict our boys out
     // We'll tell it to remove 1MB, which is guaranteed to include all of our tuples
     VoltTable evictResult = this.ee.antiCacheEvictBlock(catalog_tbl, 1024 * 1024, 1);

     System.err.println("-------------------------------");
     System.err.println(VoltTableUtil.format(evictResult));
     assertNotNull(evictResult);
     assertEquals(1, evictResult.getRowCount());
     assertNotSame(results[0].getColumnCount(), evictResult.getColumnCount());
     evictResult.resetRowPosition();
     boolean adv = evictResult.advanceRow();
     assertTrue(adv);
     return (evictResult);
 }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:25,代码来源:TestAntiCacheManagerTPCC.java

示例5: testEvictTuples

import org.voltdb.utils.VoltTableUtil; //导入依赖的package包/类
/**
   * testEvictTuples
   */
  @Test
  public void testEvictTuples() throws Exception {
      this.loadData();
      VoltTable evictResult = this.evictData();
evictResult.advanceRow(); 

      // Our stats should now come back with at least one block evicted
      VoltTable results[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, false, 0L);
      assertEquals(1, results.length);
      System.err.println("-------------------------------");
      System.err.println(VoltTableUtil.format(results));

results[0].advanceRow(); 
      for (String col : statsFields) {
          assertEquals(col, evictResult.getLong(col), results[0].getLong(col));
          if (col == "ANTICACHE_BLOCKS_EVICTED") {
              assertEquals(col, 1, results[0].getLong(col));
          } else {
              assertNotSame(col, 0, results[0].getLong(col));
          }
      } // FOR
  }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:26,代码来源:TestAntiCacheManagerTPCC.java

示例6: evictData

import org.voltdb.utils.VoltTableUtil; //导入依赖的package包/类
private VoltTable evictData() throws Exception {
     VoltTable results[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, false, 0L);
     assertEquals(1, results.length);
     // System.err.println(VoltTableUtil.format(results));
     for (String col : statsFields) {
results[0].advanceRow(); 
         int idx = results[0].getColumnIndex(col);
         assertEquals(0, results[0].getLong(idx));    
     } // FOR

     // Now force the EE to evict our boys out
     // We'll tell it to remove 1MB, which is guaranteed to include all of our tuples
     VoltTable evictResult = this.ee.antiCacheEvictBlock(catalog_tbl, 1024 * 500, 1);

     System.err.println("-------------------------------");
     System.err.println(VoltTableUtil.format(evictResult));
     assertNotNull(evictResult);
     assertEquals(1, evictResult.getRowCount());
     //assertNotSame(results[0].getColumnCount(), evictResult.getColumnCount());
     evictResult.resetRowPosition();
     boolean adv = evictResult.advanceRow();
     assertTrue(adv);
       return (evictResult);
 }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:25,代码来源:TestAntiCacheManager.java

示例7: testEvictTuples

import org.voltdb.utils.VoltTableUtil; //导入依赖的package包/类
@Test
  public void testEvictTuples() throws Exception {
      this.loadData();
      VoltTable evictResult = this.evictData();
evictResult.advanceRow(); 

      // Our stats should now come back with at least one block evicted
      VoltTable results[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, false, 0L);
      assertEquals(1, results.length);
      System.err.println("-------------------------------");
      System.err.println(VoltTableUtil.format(results));

results[0].advanceRow(); 
      for (String col : statsFields) {
          assertEquals(col, evictResult.getLong(col), results[0].getLong(col));
          if (col == "BLOCKS_EVICTED") {
              assertEquals(col, 1, results[0].getLong(col));
          } else {
              assertNotSame(col, 0, results[0].getLong(col));
          }
      } // FOR
  }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:23,代码来源:TestAntiCacheManager.java

示例8: testDistributedTxn

import org.voltdb.utils.VoltTableUtil; //导入依赖的package包/类
/**
     * testDistributedTxn
     */
    public void testDistributedTxn() throws Exception {
        CatalogContext catalogContext = this.getCatalogContext();
        Client client = this.getClient();
        RegressionSuiteUtil.initializeTPCCDatabase(catalogContext, client);

        // Fire off a distributed neworder txn
        // It should always come back with zero restarts
        String procName = neworder.class.getSimpleName();
        Object params[] = RegressionSuiteUtil.generateNewOrder(catalogContext.numberOfPartitions, true, (short)2);
        
        ClientResponse cresponse = client.callProcedure(procName, params);
        assertEquals(cresponse.toString(), Status.OK, cresponse.getStatus());
        assertFalse(cresponse.toString(), cresponse.isSinglePartition());
        assertEquals(cresponse.toString(), 0, cresponse.getRestartCounter());
//        System.err.println(cresponse);
        
        // Get the MarkovEstimatorProfiler stats
        cresponse = RegressionSuiteUtil.getStats(client, SysProcSelector.MARKOVPROFILER);
        System.err.println(VoltTableUtil.format(cresponse.getResults()[0]));
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:24,代码来源:TestMarkovSuite.java

示例9: checkBalance

import org.voltdb.utils.VoltTableUtil; //导入依赖的package包/类
public static void checkBalance(Client client, long acctId, double expected) throws Exception {
    // Make sure that we set it correctly
    String query = String.format("SELECT * FROM %s WHERE custid = %d",
                          SmallBankConstants.TABLENAME_CHECKING, acctId);
    ClientResponse cresponse = client.callProcedure("@AdHoc", query);
    assertEquals(Status.OK, cresponse.getStatus());
    VoltTable results[] = cresponse.getResults();
    assertEquals(1, results.length);
    
    if (results[0].getRowCount() == 0) {
        System.err.println(VoltTableUtil.format(results[0]));
    }
    assertEquals("No rows for acctId "+acctId, 1, results[0].getRowCount());
    assertTrue(results[0].advanceRow());
    assertEquals("Mismatched balance for acctId "+acctId, expected, results[0].getDouble("bal"));
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:17,代码来源:TestSmallBankSuite.java

示例10: trackNewWorkUnit

import org.voltdb.utils.VoltTableUtil; //导入依赖的package包/类
/**
 * Store dependency tables for later retrieval by the EE.
 * @param workunit
 */
void trackNewWorkUnit(final Map<Integer, List<VoltTable>> dependencies) {
    for (final Entry<Integer, List<VoltTable>> e : dependencies.entrySet()) {
        // could do this optionally - debug only.
        verifyDependencySanity(e.getKey(), e.getValue());
        // create a new list of references to the workunit's table
        // to avoid any changes to the WorkUnit's list. But do not
        // copy the table data.
        final ArrayDeque<VoltTable> deque = new ArrayDeque<VoltTable>();
        for (VoltTable depTable : e.getValue()) {
            // A joining node will respond with a table that has this status code
            if (depTable.getStatusCode() != VoltTableUtil.NULL_DEPENDENCY_STATUS) {
                deque.add(depTable);
            }
        }
        // intentionally overwrite the previous dependency id.
        // would a lookup and a clear() be faster?
        m_depsById.put(e.getKey(), deque);
    }
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:24,代码来源:ExecutionEngine.java

示例11: respondWithDummy

import org.voltdb.utils.VoltTableUtil; //导入依赖的package包/类
/**
 * Respond with a dummy fragment response.
 */
private void respondWithDummy()
{
    final FragmentResponseMessage response =
        new FragmentResponseMessage(m_fragmentMsg, m_initiator.getHSId());
    response.m_sourceHSId = m_initiator.getHSId();
    response.setRecovering(true);
    response.setStatus(FragmentResponseMessage.SUCCESS, null);

    // Set the dependencies even if this is a dummy response. This site could be the master
    // on elastic join, so the fragment response message is actually going to the MPI.
    VoltTable depTable = new VoltTable(new VoltTable.ColumnInfo("STATUS", VoltType.TINYINT));
    depTable.setStatusCode(VoltTableUtil.NULL_DEPENDENCY_STATUS);
    for (int frag = 0; frag < m_fragmentMsg.getFragmentCount(); frag++) {
        final int outputDepId = m_fragmentMsg.getOutputDepId(frag);
        response.addDependency(outputDepId, depTable);
    }

    m_initiator.deliver(response);
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:23,代码来源:SysprocFragmentTask.java

示例12: handleDuplicates

import org.voltdb.utils.VoltTableUtil; //导入依赖的package包/类
public void handleDuplicates(final String tableName, byte duplicates[]) throws IOException {
    final byte csvBytes[] = VoltTableUtil.toCSV( PrivateVoltTableFactory.createVoltTableFromBuffer(ByteBuffer.wrap(duplicates), true),
                         ',',
                         null,
                         1024 * 512).getSecond();
    es.execute(new Runnable() {
        @Override
        public void run() {
            try {
                handleDuplicatesInternal(tableName, csvBytes);
            } catch (Exception e) {
                VoltDB.crashLocalVoltDB("Error handling duplicate rows during snapshot restore", true, e);
            }
        }
    });
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:17,代码来源:DuplicateRowHandler.java

示例13: testCSVTimestamp

import org.voltdb.utils.VoltTableUtil; //导入依赖的package包/类
/**
 * Round-trip the time, see if it's still the same.
 * @throws IOException
 */
@Test
public void testCSVTimestamp() throws IOException {
    CSVWriter writer = mock(CSVWriter.class);
    ColumnInfo[] columns = new ColumnInfo[] {new ColumnInfo("", VoltType.TIMESTAMP)};
    ArrayList<VoltType> columnTypes = new ArrayList<VoltType>();
    // To make sure we have microseconds we get millisecond from current timestamp
    // and add remainder to ensure we have micros in timestamp.
    TimestampType ts = new TimestampType((System.currentTimeMillis() * 1000) + System.currentTimeMillis() % 1000);
    VoltTable vt = new VoltTable(columns);
    vt.addRow(ts);

    for (ColumnInfo ci : columns) {
        columnTypes.add(ci.type);
    }

    VoltTableUtil.toCSVWriter(writer, vt, columnTypes);

    ArgumentCaptor<String[]> captor = ArgumentCaptor.forClass(String[].class);
    verify(writer).writeNext(captor.capture());
    String[] values = captor.getValue();
    assertEquals(1, values.length);
    TimestampType newTs = new TimestampType(values[0]);
    assertEquals(ts, newTs);
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:29,代码来源:TestVoltTableUtil.java

示例14: formatResult

import org.voltdb.utils.VoltTableUtil; //导入依赖的package包/类
private String formatResult(ClientResponse cr) {
    
    final VoltTable results[] = cr.getResults();
    final int num_results = results.length;
    //System.out.println("num of results: " + String.valueOf(num_results));
    StringBuilder sb = new StringBuilder();
    sb.append(VoltTableUtil.format(results));
    
    VoltTable vt = results[0];
    int num_rows = vt.getRowCount();
    //System.out.println("num of rows: " + String.valueOf(num_rows));
    
    return (sb.toString());
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:15,代码来源:HStoreSite.java

示例15: formatResult

import org.voltdb.utils.VoltTableUtil; //导入依赖的package包/类
private String formatResult(ClientResponse cr) {
    final VoltTable results[] = cr.getResults();
    final int num_results = results.length;
    StringBuilder sb = new StringBuilder();
    
    if (this.enable_debug) {
        sb.append(cr.toString());
    }
    else {
        // MAIN BODY
        if (this.enable_csv) {
            StringWriter out = new StringWriter();
            for (int i = 0; i < num_results; i++) {
                if (i > 0) out.write("\n\n");
                VoltTableUtil.csv(out, results[i], true);
            } // FOR
            sb.append(out.toString());
        } else {
            sb.append(VoltTableUtil.format(results));
        }
        
        // FOOTER
        String footer = "";
        if (this.enable_csv == false) {
            if (num_results == 1) {
                int row_count = results[0].getRowCount(); 
                footer = String.format("%d row%s in set", row_count, (row_count > 1 ? "s" : ""));
            }
            else if (num_results == 0) {
                footer = "No results returned";
            }
            else {
                footer = num_results + " tables returned";
            }
            sb.append(String.format("\n%s (%.2f sec)\n", footer, (cr.getClientRoundtrip() / 1000d)));
        }
    }
    return (sb.toString());
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:40,代码来源:SStoreTerminal.java


注:本文中的org.voltdb.utils.VoltTableUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。