@Test public void testDeleteByTimestamp() throws Exception { hbaseDataStore.deleteByTimestamp("tableName", 0L); }
public void deleteByTimestamp(String tableName, long timestamp) throws IOException { LOG.info("YuLing == entering deleteByTimestamp "); int batchSize = 500; List<Delete> deleteList = new ArrayList<>(); Scan scan = new Scan(); scan.setTimeRange(Long.MIN_VALUE, timestamp); HTableInterface htable = null; try { htable = getConnection(tableName); ResultScanner rs = htable.getScanner(scan); int count = 0; for (Result rr = rs.next(); rr != null; rr = rs.next()) { deleteList.add(new Delete(rr.getRow())); count++; if (count >= batchSize) { htable.delete(deleteList); count = 0; deleteList.clear(); } } if (count > 0 && deleteList.size() != 0) { htable.delete(deleteList); } } catch (TableNotFoundException nfe) { throw nfe; } catch (IOException ioe) { LOG.error("Deletion from HBase Data Store failed!", ioe); closeConnection(tableName); HConnectionManager.deleteAllConnections(); } finally { close(htable); } LOG.debug("Exiting deleteByTimeStamp()"); }
HBaseDataStore { public void deleteByTimestamp(String tableName, long timestamp) throws IOException { LOG.info("YuLing == entering deleteByTimestamp "); int batchSize = 500; List<Delete> deleteList = new ArrayList<>(); Scan scan = new Scan(); scan.setTimeRange(Long.MIN_VALUE, timestamp); HTableInterface htable = null; try { htable = getConnection(tableName); ResultScanner rs = htable.getScanner(scan); int count = 0; for (Result rr = rs.next(); rr != null; rr = rs.next()) { deleteList.add(new Delete(rr.getRow())); count++; if (count >= batchSize) { htable.delete(deleteList); count = 0; deleteList.clear(); } } if (count > 0 && deleteList.size() != 0) { htable.delete(deleteList); } } catch (TableNotFoundException nfe) { throw nfe; } catch (IOException ioe) { LOG.error("Deletion from HBase Data Store failed!", ioe); closeConnection(tableName); HConnectionManager.deleteAllConnections(); } finally { close(htable); } LOG.debug("Exiting deleteByTimeStamp()"); } }
HBaseDataStore { public void deleteByTimestamp(String tableName, long timestamp) throws IOException { LOG.info("YuLing == entering deleteByTimestamp "); int batchSize = 500; List<Delete> deleteList = new ArrayList<>(); Scan scan = new Scan(); scan.setTimeRange(Long.MIN_VALUE, timestamp); HTableInterface htable = null; try { htable = getConnection(tableName); ResultScanner rs = htable.getScanner(scan); int count = 0; for (Result rr = rs.next(); rr != null; rr = rs.next()) { deleteList.add(new Delete(rr.getRow())); count++; if (count >= batchSize) { htable.delete(deleteList); count = 0; deleteList.clear(); } } if (count > 0 && deleteList.size() != 0) { htable.delete(deleteList); } } catch (TableNotFoundException nfe) { throw nfe; } catch (IOException ioe) { LOG.error("Deletion from HBase Data Store failed!", ioe); closeConnection(tableName); HConnectionManager.deleteAllConnections(); } finally { close(htable); } LOG.debug("Exiting deleteByTimeStamp()"); } HBaseDataStore();  HBaseDataStore(HBaseDataStoreContext context); }
HBaseDataStore { public void deleteByTimestamp(String tableName, long timestamp) throws IOException { LOG.info("YuLing == entering deleteByTimestamp "); int batchSize = 500; List<Delete> deleteList = new ArrayList<>(); Scan scan = new Scan(); scan.setTimeRange(Long.MIN_VALUE, timestamp); HTableInterface htable = null; try { htable = getConnection(tableName); ResultScanner rs = htable.getScanner(scan); int count = 0; for (Result rr = rs.next(); rr != null; rr = rs.next()) { deleteList.add(new Delete(rr.getRow())); count++; if (count >= batchSize) { htable.delete(deleteList); count = 0; deleteList.clear(); } } if (count > 0 && deleteList.size() != 0) { htable.delete(deleteList); } } catch (TableNotFoundException nfe) { throw nfe; } catch (IOException ioe) { LOG.error("Deletion from HBase Data Store failed!", ioe); closeConnection(tableName); HConnectionManager.deleteAllConnections(); } finally { close(htable); } LOG.debug("Exiting deleteByTimeStamp()"); } HBaseDataStore();  HBaseDataStore(HBaseDataStoreContext context); HTableInterface getConnection(String tableName); void createTable(String tableName); HBaseEntity create(final HBaseEntity entity); List<HBaseEntity> create(List<HBaseEntity> entityList); List<HBaseEntity> getDataByRowFamilyQualifier(String tableName, String startRow, String endRow,
            String family, String qualifier); List<HBaseEntity> getDataByRowFamilyQualifier(String tableName, String startRow, String endRow,
            String family, String qualifier, long pageSize); List<HBaseEntity> getDataByRowFamilyQualifier(String tableName, String startRow, String endRow,
            String family, List<String> qualifierList); List<HBaseEntity> getDataByRowFamilyQualifier(String tableName, String startRow, String endRow,
            String family, List<String> qualifierList, long pageSize); List<HBaseEntity> getDataByTimeRange(String tableName, long startTime, long endTime); List<HBaseEntity> getDataByTimeRange(String tableName, List<String> filters, long startTime, long endTime); void deleteByTimestamp(String tableName, long timestamp); HBaseEntity convertResultToEntity(String tableName, Result result); void flushCommit(String tableName); void closeConnection(String tableName); void closeConnection(HTable htable); }
HBaseDataStore { public void deleteByTimestamp(String tableName, long timestamp) throws IOException { LOG.info("YuLing == entering deleteByTimestamp "); int batchSize = 500; List<Delete> deleteList = new ArrayList<>(); Scan scan = new Scan(); scan.setTimeRange(Long.MIN_VALUE, timestamp); HTableInterface htable = null; try { htable = getConnection(tableName); ResultScanner rs = htable.getScanner(scan); int count = 0; for (Result rr = rs.next(); rr != null; rr = rs.next()) { deleteList.add(new Delete(rr.getRow())); count++; if (count >= batchSize) { htable.delete(deleteList); count = 0; deleteList.clear(); } } if (count > 0 && deleteList.size() != 0) { htable.delete(deleteList); } } catch (TableNotFoundException nfe) { throw nfe; } catch (IOException ioe) { LOG.error("Deletion from HBase Data Store failed!", ioe); closeConnection(tableName); HConnectionManager.deleteAllConnections(); } finally { close(htable); } LOG.debug("Exiting deleteByTimeStamp()"); } HBaseDataStore();  HBaseDataStore(HBaseDataStoreContext context); HTableInterface getConnection(String tableName); void createTable(String tableName); HBaseEntity create(final HBaseEntity entity); List<HBaseEntity> create(List<HBaseEntity> entityList); List<HBaseEntity> getDataByRowFamilyQualifier(String tableName, String startRow, String endRow,
            String family, String qualifier); List<HBaseEntity> getDataByRowFamilyQualifier(String tableName, String startRow, String endRow,
            String family, String qualifier, long pageSize); List<HBaseEntity> getDataByRowFamilyQualifier(String tableName, String startRow, String endRow,
            String family, List<String> qualifierList); List<HBaseEntity> getDataByRowFamilyQualifier(String tableName, String startRow, String endRow,
            String family, List<String> qualifierList, long pageSize); List<HBaseEntity> getDataByTimeRange(String tableName, long startTime, long endTime); List<HBaseEntity> getDataByTimeRange(String tableName, List<String> filters, long startTime, long endTime); void deleteByTimestamp(String tableName, long timestamp); HBaseEntity convertResultToEntity(String tableName, Result result); void flushCommit(String tableName); void closeConnection(String tableName); void closeConnection(HTable htable);  }