protected void wipeOutMeta() throws IOException { // Mess it up by blowing up meta. Admin admin = TEST_UTIL.getHBaseAdmin(); Scan s = new Scan(); Table meta = new HTable(conf, TableName.META_TABLE_NAME); ResultScanner scanner = meta.getScanner(s); List<Delete> dels = new ArrayList<Delete>(); for (Result r : scanner) { HRegionInfo info = HRegionInfo.getHRegionInfo(r); if(info != null && !info.getTable().getNamespaceAsString() .equals(NamespaceDescriptor.SYSTEM_NAMESPACE_NAME_STR)) { Delete d = new Delete(r.getRow()); dels.add(d); admin.unassign(r.getRow(), true); } } meta.delete(dels); scanner.close(); meta.close(); }
/** * Reset the split parent region info in meta table */ private void resetSplitParent(HbckInfo hi) throws IOException { RowMutations mutations = new RowMutations(hi.metaEntry.getRegionName()); Delete d = new Delete(hi.metaEntry.getRegionName()); d.deleteColumn(HConstants.CATALOG_FAMILY, HConstants.SPLITA_QUALIFIER); d.deleteColumn(HConstants.CATALOG_FAMILY, HConstants.SPLITB_QUALIFIER); mutations.add(d); HRegionInfo hri = new HRegionInfo(hi.metaEntry); hri.setOffline(false); hri.setSplit(false); Put p = MetaTableAccessor.makePutFromRegionInfo(hri); mutations.add(p); meta.mutateRow(mutations); LOG.info("Reset split parent " + hi.metaEntry.getRegionNameAsString() + " in META" ); }
private void commitDeletes(final List<ODelete> deletes) throws IOException { boolean flushSuccessfully = false; try { this.adapter.deleteMultiple(tableName.getNameAsString(), deletes); flushSuccessfully = true; } finally { if (!flushSuccessfully && !clearBufferOnFail) { List<Delete> hDeletes = ElementConvertor.toHBaseDeletes(deletes, this.columnMapping); synchronized (writeBuffer) { for (Delete delete : hDeletes) { writeBuffer.add(delete); currentWriteBufferSize += delete.heapSize(); } } } } }
@Override public void deleteAllTs(ByteBuffer tableName, ByteBuffer row, ByteBuffer column, long timestamp, Map<ByteBuffer, ByteBuffer> attributes) throws IOError { Table table = null; try { table = getTable(tableName); Delete delete = new Delete(getBytes(row)); addAttributes(delete, attributes); byte [][] famAndQf = KeyValue.parseColumn(getBytes(column)); if (famAndQf.length == 1) { delete.deleteFamily(famAndQf[0], timestamp); } else { delete.deleteColumns(famAndQf[0], famAndQf[1], timestamp); } table.delete(delete); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new IOError(Throwables.getStackTraceAsString(e)); } finally { closeTable(table); } }
@Override public void deleteAllRowTs( ByteBuffer tableName, ByteBuffer row, long timestamp, Map<ByteBuffer, ByteBuffer> attributes) throws IOError { Table table = null; try { table = getTable(tableName); Delete delete = new Delete(getBytes(row), timestamp); addAttributes(delete, attributes); table.delete(delete); } catch (IOException e) { LOG.warn(e.getMessage(), e); throw new IOError(Throwables.getStackTraceAsString(e)); } finally { closeTable(table); } }
/** * Removes a previously granted permission from the stored access control * lists. The {@link TablePermission} being removed must exactly match what * is stored -- no wildcard matching is attempted. Ie, if user "bob" has * been granted "READ" access to the "data" table, but only to column family * plus qualifier "info:colA", then trying to call this method with only * user "bob" and the table name "data" (but without specifying the * column qualifier "info:colA") will have no effect. * * @param conf the configuration * @param userPerm the details of the permission to be revoked * @throws IOException if there is an error accessing the metadata table */ static void removeUserPermission(Configuration conf, UserPermission userPerm) throws IOException { Delete d = new Delete(userPermissionRowKey(userPerm)); byte[] key = userPermissionKey(userPerm); if (LOG.isDebugEnabled()) { LOG.debug("Removing permission "+ userPerm.toString()); } d.addColumns(ACL_LIST_FAMILY, key); // TODO: Pass in a Connection rather than create one each time. try (Connection connection = ConnectionFactory.createConnection(conf)) { try (Table table = connection.getTable(ACL_TABLE_NAME)) { table.delete(d); } } }
/** * Deletes some replica columns corresponding to replicas for the passed rows * @param metaRows rows in hbase:meta * @param replicaIndexToDeleteFrom the replica ID we would start deleting from * @param numReplicasToRemove how many replicas to remove * @param connection connection we're using to access meta table * @throws IOException */ public static void removeRegionReplicasFromMeta(Set<byte[]> metaRows, int replicaIndexToDeleteFrom, int numReplicasToRemove, Connection connection) throws IOException { int absoluteIndex = replicaIndexToDeleteFrom + numReplicasToRemove; for (byte[] row : metaRows) { Delete deleteReplicaLocations = new Delete(row); for (int i = replicaIndexToDeleteFrom; i < absoluteIndex; i++) { deleteReplicaLocations.deleteColumns(HConstants.CATALOG_FAMILY, getServerColumn(i)); deleteReplicaLocations.deleteColumns(HConstants.CATALOG_FAMILY, getSeqNumColumn(i)); deleteReplicaLocations.deleteColumns(HConstants.CATALOG_FAMILY, getStartCodeColumn(i)); } deleteFromMetaTable(connection, deleteReplicaLocations); } }
@Override protected void updateMeta(final byte [] oldRegion1, final byte [] oldRegion2, HRegion newRegion) throws IOException { byte[][] regionsToDelete = {oldRegion1, oldRegion2}; for (int r = 0; r < regionsToDelete.length; r++) { if(Bytes.equals(regionsToDelete[r], latestRegion.getRegionName())) { latestRegion = null; } Delete delete = new Delete(regionsToDelete[r]); table.delete(delete); if(LOG.isDebugEnabled()) { LOG.debug("updated columns in row: " + Bytes.toStringBinary(regionsToDelete[r])); } } newRegion.getRegionInfo().setOffline(true); MetaTableAccessor.addRegionToMeta(table, newRegion.getRegionInfo()); if(LOG.isDebugEnabled()) { LOG.debug("updated columns in row: " + Bytes.toStringBinary(newRegion.getRegionInfo().getRegionName())); } }
@Override public void postProcess(HRegion region, WALEdit walEdit, boolean success) throws IOException { RegionCoprocessorHost coprocessorHost = region.getCoprocessorHost(); if (coprocessorHost != null) { for (Mutation m : mutations) { if (m instanceof Put) { coprocessorHost.postPut((Put) m, walEdit, m.getDurability()); } else if (m instanceof Delete) { coprocessorHost.postDelete((Delete) m, walEdit, m.getDurability()); } } // At the end call the CP hook postBatchMutateIndispensably if (miniBatch != null) { // Directly calling this hook, with out calling pre/postBatchMutate() when Processor do a // read only process. Then no need to call this batch based CP hook also. coprocessorHost.postBatchMutateIndispensably(miniBatch, success); } } }
private void deleteAndWait(byte[] row, Table source, Table... targets) throws Exception { Delete del = new Delete(row); source.delete(del); Get get = new Get(row); for (int i = 0; i < NB_RETRIES; i++) { if (i==NB_RETRIES-1) { fail("Waited too much time for del replication"); } boolean removedFromAll = true; for (Table target : targets) { Result res = target.get(get); if (res.size() >= 1) { LOG.info("Row not deleted"); removedFromAll = false; break; } } if (removedFromAll) { break; } else { Thread.sleep(SLEEP_TIME); } } }
/** * Create a protocol buffer MutateRequest for a conditioned delete * * @param regionName * @param row * @param family * @param qualifier * @param comparator * @param compareType * @param delete * @return a mutate request * @throws IOException */ public static MutateRequest buildMutateRequest( final byte[] regionName, final byte[] row, final byte[] family, final byte [] qualifier, final ByteArrayComparable comparator, final CompareType compareType, final Delete delete) throws IOException { MutateRequest.Builder builder = MutateRequest.newBuilder(); RegionSpecifier region = buildRegionSpecifier( RegionSpecifierType.REGION_NAME, regionName); builder.setRegion(region); Condition condition = buildCondition( row, family, qualifier, comparator, compareType); builder.setMutation(ProtobufUtil.toMutation(MutationType.DELETE, delete, MutationProto.newBuilder())); builder.setCondition(condition); return builder.build(); }
private void verifyUserDeniedForDeleteMultipleVersions(final User user, final byte[] row, final byte[] q1, final byte[] q2) throws IOException, InterruptedException { user.runAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { try (Connection connection = ConnectionFactory.createConnection(conf)) { try (Table t = connection.getTable(TEST_TABLE.getTableName())) { Delete d = new Delete(row); d.addColumns(TEST_FAMILY1, q1); d.addColumns(TEST_FAMILY1, q2); t.delete(d); fail(user.getShortName() + " should not be allowed to delete the row"); } catch (Exception e) { } } return null; } }); }
private void verifyUserDeniedForDeleteExactVersion(final User user, final byte[] row, final byte[] q1, final byte[] q2) throws IOException, InterruptedException { user.runAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { try (Connection connection = ConnectionFactory.createConnection(conf)) { try (Table t = connection.getTable(TEST_TABLE.getTableName())) { Delete d = new Delete(row, 127); d.addColumns(TEST_FAMILY1, q1); d.addColumns(TEST_FAMILY1, q2); d.addFamily(TEST_FAMILY2, 129); t.delete(d); fail(user.getShortName() + " can not do the delete"); } catch (Exception e) { } } return null; } }); }
private void verifyUserAllowedforCheckAndDelete(final User user, final byte[] row, final byte[] q1, final byte[] value) throws IOException, InterruptedException { user.runAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { try (Connection connection = ConnectionFactory.createConnection(conf)) { try (Table t = connection.getTable(TEST_TABLE.getTableName())) { Delete d = new Delete(row); d.addColumn(TEST_FAMILY1, q1, 120); t.checkAndDelete(row, TEST_FAMILY1, q1, value, d); } } return null; } }); }
private void verifyUserDeniedForCheckAndDelete(final User user, final byte[] row, final byte[] value) throws IOException, InterruptedException { user.runAs(new PrivilegedExceptionAction<Void>() { @Override public Void run() throws Exception { try (Connection connection = ConnectionFactory.createConnection(conf)) { try (Table t = connection.getTable(TEST_TABLE.getTableName())) { Delete d = new Delete(row); d.addColumns(TEST_FAMILY1, TEST_Q1); t.checkAndDelete(row, TEST_FAMILY1, TEST_Q1, value, d); fail(user.getShortName() + " should not be allowed to do checkAndDelete"); } catch (Exception e) { } } return null; } }); }
/** * Create a protocol buffer MultiRequest for row mutations that does not hold data. Data/Cells * are carried outside of protobuf. Return references to the Cells in <code>cells</code> param. * Does not propagate Action absolute position. Does not set atomic action on the created * RegionAtomic. Caller should do that if wanted. * @param regionName * @param rowMutations * @param cells Return in here a list of Cells as CellIterable. * @return a region mutation minus data * @throws IOException */ public static RegionAction.Builder buildNoDataRegionAction(final byte[] regionName, final RowMutations rowMutations, final List<CellScannable> cells, final RegionAction.Builder regionActionBuilder, final ClientProtos.Action.Builder actionBuilder, final MutationProto.Builder mutationBuilder) throws IOException { for (Mutation mutation: rowMutations.getMutations()) { MutationType type = null; if (mutation instanceof Put) { type = MutationType.PUT; } else if (mutation instanceof Delete) { type = MutationType.DELETE; } else { throw new DoNotRetryIOException("RowMutations supports only put and delete, not " + mutation.getClass().getName()); } mutationBuilder.clear(); MutationProto mp = ProtobufUtil.toMutationNoData(type, mutation, mutationBuilder); cells.add(mutation); actionBuilder.clear(); regionActionBuilder.addAction(actionBuilder.setMutation(mp).build()); } return regionActionBuilder; }
public static void deleteRow(String tablename, String rowkey) { try { HTable table = new HTable(configuration, tablename); List list = new ArrayList(); Delete d1 = new Delete(rowkey.getBytes()); list.add(d1); table.delete(list); System.out.println("删除行成功!"); } catch (IOException e) { e.printStackTrace(); } }
boolean doCheckAndDelete(final byte[] row, final byte[] family, final byte[] qualifier, final byte[] value, final Delete delete) { boolean result; final Table tableInterface = getTable(); try { result = doCheckAndDelete(tableInterface, row, family, qualifier, value, delete); } finally { closeTable(tableInterface); } return result; }
@Test public void testMinorCompactionWithDeleteColumn1() throws Exception { Delete dc = new Delete(secondRowBytes); /* delete all timestamps in the column */ dc.deleteColumns(fam2, col2); testMinorCompactionWithDelete(dc); }
/** * Gets a tableInterface, does the passed delete on this table and then * closes the tableInterface * * @param delete * The HBase delete object */ public void doDelete(final Delete delete) { final Table tableInterface = getTable(); try { doDelete(delete); } finally { closeTable(tableInterface); } }
/** * Does the delete using the passed tableInterface but leaves it open * * @param tableInterface * @param delete */ public static void doDelete(final Table tableInterface, final Delete delete) { try { tableInterface.delete(delete); } catch (final Exception e) { closeTable(tableInterface); throw new HBaseException(e.getMessage(), e); } }
private void delete(byte[] row) { try { Delete del = new Delete(row); table.delete(del); } catch (IOException e) { throw new DrillRuntimeException("Caught error while deleting row '" + Bytes.toStringBinary(row) + "' from for table:" + Bytes.toString(table.getTableName()), e); } }
@Test public void testWriteRequestsCounter() throws IOException { byte[] fam = Bytes.toBytes("info"); byte[][] families = { fam }; this.region = initHRegion(tableName, method, CONF, families); Assert.assertEquals(0L, region.getWriteRequestsCount()); Put put = new Put(row); put.add(fam, fam, fam); Assert.assertEquals(0L, region.getWriteRequestsCount()); region.put(put); Assert.assertEquals(1L, region.getWriteRequestsCount()); region.put(put); Assert.assertEquals(2L, region.getWriteRequestsCount()); region.put(put); Assert.assertEquals(3L, region.getWriteRequestsCount()); region.delete(new Delete(row)); Assert.assertEquals(4L, region.getWriteRequestsCount()); HRegion.closeHRegion(this.region); this.region = null; }
@Test public void testMinorCompactionWithDeleteVersion1() throws Exception { Delete deleteVersion = new Delete(secondRowBytes); deleteVersion.deleteColumns(fam2, col2, 2); /* compactionThreshold is 3. The table has 4 versions: 0, 1, 2, and 3. * We delete versions 0 ... 2. So, we still have one remaining. */ testMinorCompactionWithDelete(deleteVersion, 1); }
private Delete createDelete(Object key) { try { @SuppressWarnings("unchecked") Delete delete = new Delete(keySerializer.serialize((K) key)); delete.addColumns(family(), QUALIFIER); return delete; } catch (ClassCastException | SerializationException e) { throw new CacheWriterException("Failed to create delete", e); } }
/** * Deletes merge qualifiers for the specified merged region. * @param connection connection we're using * @param mergedRegion * @throws IOException */ public static void deleteMergeQualifiers(Connection connection, final HRegionInfo mergedRegion) throws IOException { Delete delete = new Delete(mergedRegion.getRegionName()); delete.deleteColumns(HConstants.CATALOG_FAMILY, HConstants.MERGEA_QUALIFIER); delete.deleteColumns(HConstants.CATALOG_FAMILY, HConstants.MERGEB_QUALIFIER); deleteFromMetaTable(connection, delete); LOG.info("Deleted references in merged region " + mergedRegion.getRegionNameAsString() + ", qualifier=" + Bytes.toStringBinary(HConstants.MERGEA_QUALIFIER) + " and qualifier=" + Bytes.toStringBinary(HConstants.MERGEB_QUALIFIER)); }
public static TDelete deleteFromHBase(Delete in) { TDelete out = new TDelete(ByteBuffer.wrap(in.getRow())); List<TColumn> columns = new ArrayList<TColumn>(); long rowTimestamp = in.getTimeStamp(); if (rowTimestamp != HConstants.LATEST_TIMESTAMP) { out.setTimestamp(rowTimestamp); } // Map<family, List<KeyValue>> for (Map.Entry<byte[], List<org.apache.hadoop.hbase.Cell>> familyEntry: in.getFamilyCellMap().entrySet()) { TColumn column = new TColumn(ByteBuffer.wrap(familyEntry.getKey())); for (org.apache.hadoop.hbase.Cell cell: familyEntry.getValue()) { byte[] family = CellUtil.cloneFamily(cell); byte[] qualifier = CellUtil.cloneQualifier(cell); long timestamp = cell.getTimestamp(); if (family != null) { column.setFamily(family); } if (qualifier != null) { column.setQualifier(qualifier); } if (timestamp != HConstants.LATEST_TIMESTAMP) { column.setTimestamp(timestamp); } } columns.add(column); } out.setColumns(columns); return out; }
@Override public boolean preCheckAndDelete(ObserverContext<RegionCoprocessorEnvironment> e, byte[] row, byte[] family, byte[] qualifier, CompareOp compareOp, ByteArrayComparable comparator, Delete delete, boolean result) throws IOException { ctPreCheckAndDelete.incrementAndGet(); return true; }
/** * Remove specified namespace from the acl table. */ static void removeNamespacePermissions(Configuration conf, String namespace) throws IOException{ Delete d = new Delete(Bytes.toBytes(toNamespaceEntry(namespace))); if (LOG.isDebugEnabled()) { LOG.debug("Removing permissions of removed namespace "+ namespace); } try (Connection connection = ConnectionFactory.createConnection(conf)) { try (Table table = connection.getTable(ACL_TABLE_NAME)) { table.delete(d); } } }
@Override public void preDelete(final ObserverContext<RegionCoprocessorEnvironment> c, final Delete delete, final WALEdit edit, final Durability durability) throws IOException { // An ACL on a delete is useless, we shouldn't allow it if (delete.getAttribute(AccessControlConstants.OP_ATTRIBUTE_ACL) != null) { throw new DoNotRetryIOException("ACL on delete has no effect: " + delete.toString()); } // Require WRITE permissions on all cells covered by the delete. Unlike // for Puts we need to check all visible prior versions, because a major // compaction could remove them. If the user doesn't have permission to // overwrite any of the visible versions ('visible' defined as not covered // by a tombstone already) then we have to disallow this operation. RegionCoprocessorEnvironment env = c.getEnvironment(); Map<byte[],? extends Collection<Cell>> families = delete.getFamilyCellMap(); User user = getActiveUser(); AuthResult authResult = permissionGranted(OpType.DELETE, user, env, families, Action.WRITE); logResult(authResult); if (!authResult.isAllowed()) { if (cellFeaturesEnabled && !compatibleEarlyTermination) { delete.setAttribute(CHECK_COVERING_PERM, TRUE); } else if (authorizationEnabled) { throw new AccessDeniedException("Insufficient permissions " + authResult.toContextString()); } } }
@Override public void postDelete(final ObserverContext<RegionCoprocessorEnvironment> c, final Delete delete, final WALEdit edit, final Durability durability) throws IOException { if (aclRegion) { updateACL(c.getEnvironment(), delete.getFamilyCellMap()); } }
@Override public boolean preCheckAndDeleteAfterRowLock( final ObserverContext<RegionCoprocessorEnvironment> c, final byte[] row, final byte[] family, final byte[] qualifier, final CompareFilter.CompareOp compareOp, final ByteArrayComparable comparator, final Delete delete, final boolean result) throws IOException { if (delete.getAttribute(CHECK_COVERING_PERM) != null) { // We had failure with table, cf and q perm checks and now giving a chance for cell // perm check TableName table = c.getEnvironment().getRegion().getRegionInfo().getTable(); Map<byte[], ? extends Collection<byte[]>> families = makeFamilyMap(family, qualifier); AuthResult authResult = null; if (checkCoveringPermission(OpType.CHECK_AND_DELETE, c.getEnvironment(), row, families, HConstants.LATEST_TIMESTAMP, Action.READ)) { authResult = AuthResult.allow(OpType.CHECK_AND_DELETE.toString(), "Covering cell set", getActiveUser(), Action.READ, table, families); } else { authResult = AuthResult.deny(OpType.CHECK_AND_DELETE.toString(), "Covering cell set", getActiveUser(), Action.READ, table, families); } logResult(authResult); if (authorizationEnabled && !authResult.isAllowed()) { throw new AccessDeniedException("Insufficient permissions " + authResult.toContextString()); } } return result; }
private void checkRowAndDelete(Table t, byte[] row, int count) throws IOException { Get g = new Get(row); Result r = t.get(g); assertEquals(count, r.size()); Delete d = new Delete(row); t.delete(d); }
@Test public void testCheckAndMutate_WithWrongValue() throws IOException { byte[] row1 = Bytes.toBytes("row1"); byte[] fam1 = Bytes.toBytes("fam1"); byte[] qf1 = Bytes.toBytes("qualifier"); byte[] val1 = Bytes.toBytes("value1"); byte[] val2 = Bytes.toBytes("value2"); // Setting up region String method = this.getName(); this.region = initHRegion(tableName, method, CONF, fam1); try { // Putting data in key Put put = new Put(row1); put.add(fam1, qf1, val1); region.put(put); // checkAndPut with wrong value boolean res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL, new BinaryComparator( val2), put, true); assertEquals(false, res); // checkAndDelete with wrong value Delete delete = new Delete(row1); delete.deleteFamily(fam1); res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL, new BinaryComparator(val2), put, true); assertEquals(false, res); } finally { HRegion.closeHRegion(this.region); this.region = null; } }
public synchronized void remove(String name) throws IOException { if (get(name) == null) { throw new NamespaceNotFoundException(name); } if (NamespaceDescriptor.RESERVED_NAMESPACES.contains(name)) { throw new ConstraintException("Reserved namespace "+name+" cannot be removed."); } int tableCount; try { tableCount = masterServices.listTableDescriptorsByNamespace(name).size(); } catch (FileNotFoundException fnfe) { throw new NamespaceNotFoundException(name); } if (tableCount > 0) { throw new ConstraintException("Only empty namespaces can be removed. " + "Namespace "+name+" has "+tableCount+" tables"); } Delete d = new Delete(Bytes.toBytes(name)); getNamespaceTable().delete(d); //don't abort if cleanup isn't complete //it will be replaced on new namespace creation zkNamespaceManager.remove(name); FileSystem fs = masterServices.getMasterFileSystem().getFileSystem(); for(FileStatus status : fs.listStatus(FSUtils.getNamespaceDir( masterServices.getMasterFileSystem().getRootDir(), name))) { if (!HConstants.HBASE_NON_TABLE_DIRS.contains(status.getPath().getName())) { throw new IOException("Namespace directory contains table dir: "+status.getPath()); } } if (!fs.delete(FSUtils.getNamespaceDir( masterServices.getMasterFileSystem().getRootDir(), name), true)) { throw new IOException("Failed to remove namespace: "+name); } this.masterServices.getMasterQuotaManager().removeNamespaceQuota(name); }
@Override public void serialize(Mutation mutation) throws IOException { MutationType type; if (mutation instanceof Put) { type = MutationType.PUT; } else if (mutation instanceof Delete) { type = MutationType.DELETE; } else { throw new IllegalArgumentException("Only Put and Delete are supported"); } ProtobufUtil.toMutation(type, mutation).writeDelimitedTo(out); }
@Test public void testMutations(){ Class<?> cl; long expected; long actual; cl = TimeRange.class; actual = ClassSize.TIMERANGE; expected = ClassSize.estimateBase(cl, false); if (expected != actual) { ClassSize.estimateBase(cl, true); assertEquals(expected, actual); } byte[] row = new byte[] { 0 }; cl = Put.class; actual = new Put(row).MUTATION_OVERHEAD + ClassSize.align(ClassSize.ARRAY); expected = ClassSize.estimateBase(cl, false); //The actual TreeMap is not included in the above calculation expected += ClassSize.align(ClassSize.TREEMAP); if (expected != actual) { ClassSize.estimateBase(cl, true); assertEquals(expected, actual); } cl = Delete.class; actual = new Delete(row).MUTATION_OVERHEAD + ClassSize.align(ClassSize.ARRAY); expected = ClassSize.estimateBase(cl, false); //The actual TreeMap is not included in the above calculation expected += ClassSize.align(ClassSize.TREEMAP); if (expected != actual) { ClassSize.estimateBase(cl, true); assertEquals(expected, actual); } }
@Override public void postDelete(final ObserverContext<RegionCoprocessorEnvironment> c, final Delete delete, final WALEdit edit, final Durability durability) throws IOException { Map<byte[], List<Cell>> familyMap = delete.getFamilyCellMap(); RegionCoprocessorEnvironment e = c.getEnvironment(); assertNotNull(e); assertNotNull(e.getRegion()); assertNotNull(familyMap); ctBeforeDelete.set(0); ctPostDeleted.incrementAndGet(); }
@Override public boolean preCheckAndDelete(final ObserverContext<RegionCoprocessorEnvironment> e, final byte [] row, final byte [] family, final byte [] qualifier, final CompareOp compareOp, final ByteArrayComparable comparator, final Delete delete, final boolean result) throws IOException { return result; }
@Override public boolean preCheckAndDeleteAfterRowLock( final ObserverContext<RegionCoprocessorEnvironment> e, final byte[] row, final byte[] family, final byte[] qualifier, final CompareOp compareOp, final ByteArrayComparable comparator, final Delete delete, final boolean result) throws IOException { return result; }