@Override public void flushRegionServer(ServerName serverName) throws IOException { for (RegionInfo region : getRegions(serverName)) { flush(this.connection.getAdmin(serverName), region); } }
/** * @deprecated Use {@link #flush(org.apache.hadoop.hbase.TableName)} or {@link #flushRegion * (byte[])} instead. */ @Deprecated public void flush(final byte[] tableNameOrRegionName) throws IOException, InterruptedException { try { flushRegion(tableNameOrRegionName); } catch (IllegalArgumentException e) { // Unknown region. Try table. flush(TableName.valueOf(tableNameOrRegionName)); } }
@Override public void flushRegion(final byte[] regionName) throws IOException { Pair<RegionInfo, ServerName> regionServerPair = getRegion(regionName); if (regionServerPair == null) { throw new IllegalArgumentException("Unknown regionname: " + Bytes.toStringBinary(regionName)); } if (regionServerPair.getSecond() == null) { throw new NoServerForRegionException(Bytes.toStringBinary(regionName)); } final RegionInfo regionInfo = regionServerPair.getFirst(); ServerName serverName = regionServerPair.getSecond(); flush(this.connection.getAdmin(serverName), regionInfo); }
Delete delete = new Delete("row0".getBytes()); table.delete(delete); hba.flush(table1);
private void performMultiplePutAndFlush(HBaseAdmin admin, Table table, byte[] row, byte[] family, int nFlushes, int nPuts) throws Exception { try (RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(table.getName())) { // connection needed for poll-wait HRegionLocation loc = locator.getRegionLocation(row, true); AdminProtos.AdminService.BlockingInterface server = ((ClusterConnection) admin.getConnection()).getAdmin(loc.getServerName()); byte[] regName = loc.getRegionInfo().getRegionName(); for (int i = 0; i < nFlushes; i++) { randomCFPuts(table, row, family, nPuts); List<String> sf = ProtobufUtil.getStoreFiles(server, regName, FAMILY); int sfCount = sf.size(); admin.flush(table.getName()); } } }
@Override public void flushRegionServer(ServerName serverName) throws IOException { for (RegionInfo region : getRegions(serverName)) { flush(this.connection.getAdmin(serverName), region); } }
@Override public void flushRegion(final byte[] regionName) throws IOException { Pair<RegionInfo, ServerName> regionServerPair = getRegion(regionName); if (regionServerPair == null) { throw new IllegalArgumentException("Unknown regionname: " + Bytes.toStringBinary(regionName)); } if (regionServerPair.getSecond() == null) { throw new NoServerForRegionException(Bytes.toStringBinary(regionName)); } final RegionInfo regionInfo = regionServerPair.getFirst(); ServerName serverName = regionServerPair.getSecond(); flush(this.connection.getAdmin(serverName), regionInfo); }
getUtility().getHBaseAdmin().flush(TableName.valueOf(fullTableName)); conn.createStatement().executeUpdate("UPSERT INTO " + fullTableName + "(k,v1,v2) VALUES ('testKey','v1_4','v2_3')"); conn.commit();
/** * Test to repro ArrayIndexOutOfBoundException that happens during filtering in BinarySubsetComparator * only after a flush is performed * @throws Exception */ @Test public void testFilterOnTrailingKeyColumn() throws Exception { long ts = nextTimestamp(); String tenantId = getOrganizationId(); Properties props = new Properties(TEST_PROPERTIES); props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts+1)); Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, props); HBaseAdmin admin = null; try { initTableValues(tenantId, getSplits(tenantId), ts); admin = conn.unwrap(PhoenixConnection.class).getQueryServices().getAdmin(); admin.flush(SchemaUtil.getTableNameAsBytes(PRODUCT_METRICS_SCHEMA_NAME,PRODUCT_METRICS_NAME)); String query = "SELECT SUM(TRANSACTIONS) FROM " + PRODUCT_METRICS_NAME + " WHERE FEATURE=?"; PreparedStatement statement = conn.prepareStatement(query); statement.setString(1, F1); ResultSet rs = statement.executeQuery(); assertTrue(rs.next()); assertEquals(1200, rs.getInt(1)); } finally { if (admin != null) admin.close(); conn.close(); } }
/** * Flush a table or an individual region. * Asynchronous operation. * * @param tableNameOrRegionName table or region to flush * @throws IOException if a remote or network exception occurs * @throws InterruptedException */ public void flush(final String tableNameOrRegionName) throws IOException, InterruptedException { flush(Bytes.toBytes(tableNameOrRegionName)); }
/** * @deprecated Use {@link #flush(org.apache.hadoop.hbase.TableName)} or {@link #flushRegion * (byte[])} instead. */ @Deprecated public void flush(final String tableNameOrRegionName) throws IOException, InterruptedException { flush(Bytes.toBytes(tableNameOrRegionName)); }
@Override public void flushRegionServer(ServerName serverName) throws IOException { for (RegionInfo region : getRegions(serverName)) { flush(this.connection.getAdmin(serverName), region); } }
/** * Flushes all metadata tables. * * @param hbaseAdmin An hbase admin utility. * @param instanceName The name of the Fiji instance. * @throws IOException If there is an error. * @throws InterruptedException If the thread is interrupted. */ private void flushMetaTables(HBaseAdmin hbaseAdmin, String instanceName) throws IOException, InterruptedException { LOG.debug("Flushing schema hash table"); FijiManagedHBaseTableName hbaseTableName = FijiManagedHBaseTableName.getSchemaHashTableName( instanceName); hbaseAdmin.flush(hbaseTableName.toString()); LOG.debug("Flushing schema id table"); hbaseTableName = FijiManagedHBaseTableName.getSchemaIdTableName(instanceName); hbaseAdmin.flush(hbaseTableName.toString()); LOG.debug("Flushing meta table"); hbaseTableName = FijiManagedHBaseTableName.getMetaTableName( instanceName); hbaseAdmin.flush(hbaseTableName.toString()); LOG.debug("Flushing system table"); hbaseTableName = FijiManagedHBaseTableName.getSystemTableName(instanceName); hbaseAdmin.flush(hbaseTableName.toString()); LOG.debug("Flushing -ROOT-"); hbaseAdmin.flush("-ROOT-"); LOG.debug("Flushing .META."); hbaseAdmin.flush(".META."); }
public Void flush(ByteBuffer table) throws AIOError { try { admin.flush(Bytes.toBytes(table)); return null; } catch (InterruptedException e) { AIOError ioe = new AIOError(); ioe.message = new Utf8(e.getMessage()); throw ioe; } catch (IOException e) { AIOError ioe = new AIOError(); ioe.message = new Utf8(e.getMessage()); throw ioe; } }
/** * If the durability is set to {@link Durability#SKIP_WAL} and the data is imported to hbase, we * need to flush all the regions of the table as the data is held in memory and is also not * present in the Write Ahead Log to replay in scenarios of a crash. This method flushes all the * regions of the table in the scenarios of import data to hbase with {@link Durability#SKIP_WAL} */ public static void flushRegionsIfNecessary(Configuration conf) throws IOException, InterruptedException { String tableName = conf.get(TABLE_NAME); HBaseAdmin hAdmin = null; String durability = conf.get(WAL_DURABILITY); // Need to flush if the data is written to hbase and skip wal is enabled. if (conf.get(BULK_OUTPUT_CONF_KEY) == null && durability != null && Durability.SKIP_WAL.name().equalsIgnoreCase(durability)) { try { hAdmin = new HBaseAdmin(conf); hAdmin.flush(tableName); } finally { if (hAdmin != null) { hAdmin.close(); } } } }
/** * Flushes a fiji table with the name 'tableName'. * * @param hbaseAdmin An hbase admin utility. * @param tableURI URI of the Fiji table to flush. * @throws IOException If there is an error. * @throws InterruptedException If the thread is interrupted. */ private static void flushTable(HBaseAdmin hbaseAdmin, FijiURI tableURI) throws IOException, InterruptedException { final FijiManagedHBaseTableName hbaseTableName = FijiManagedHBaseTableName.getFijiTableName(tableURI.getInstance(), tableURI.getTable()); hbaseAdmin.flush(hbaseTableName.toString()); }
/** * {@inheritDoc} */ @Override public void flushRegion(final byte[] regionName) throws IOException { Pair<HRegionInfo, ServerName> regionServerPair = getRegion(regionName); if (regionServerPair == null) { throw new IllegalArgumentException("Unknown regionname: " + Bytes.toStringBinary(regionName)); } if (regionServerPair.getSecond() == null) { throw new NoServerForRegionException(Bytes.toStringBinary(regionName)); } flush(regionServerPair.getSecond(), regionServerPair.getFirst()); }
@Override public void flushRegion(final byte[] regionName) throws IOException { Pair<RegionInfo, ServerName> regionServerPair = getRegion(regionName); if (regionServerPair == null) { throw new IllegalArgumentException("Unknown regionname: " + Bytes.toStringBinary(regionName)); } if (regionServerPair.getSecond() == null) { throw new NoServerForRegionException(Bytes.toStringBinary(regionName)); } final RegionInfo regionInfo = regionServerPair.getFirst(); ServerName serverName = regionServerPair.getSecond(); flush(this.connection.getAdmin(serverName), regionInfo); }
ZKUtil.createSetData(zk, ThemisMasterObserver.getThemisExpiredTsZNodePath(zk), Bytes.toBytes(String.valueOf(Long.MIN_VALUE))); admin.flush(TABLENAME); // cleanTs is invalid when flush ZKUtil.createSetData(zk, ThemisMasterObserver.getThemisExpiredTsZNodePath(zk), Bytes.toBytes(String.valueOf(prewriteTs + 5)));
private void performMultiplePutAndFlush(HBaseAdmin admin, Table table, byte[] row, byte[] family, int nFlushes, int nPuts) throws Exception { try (RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(table.getName())) { // connection needed for poll-wait HRegionLocation loc = locator.getRegionLocation(row, true); AdminProtos.AdminService.BlockingInterface server = ((ClusterConnection) admin.getConnection()).getAdmin(loc.getServerName()); byte[] regName = loc.getRegionInfo().getRegionName(); for (int i = 0; i < nFlushes; i++) { randomCFPuts(table, row, family, nPuts); List<String> sf = ProtobufUtil.getStoreFiles(server, regName, FAMILY); int sfCount = sf.size(); admin.flush(table.getName()); } } }