Database Reference
In-Depth Information
Deleting data
The Delete command only marks the cell for deletion rather than deleting the
data immediately. The actual deletion is performed when the compaction of HFiles
is done to reconcile these marked records and to free the space occupied by the
deleted data.
Compaction is the process of choosing HFiles from a region and
combining them. In a major compaction process, it picks all the
HFiles and writes back the key-values to the output HFile that are
not marked as deleted. Whereas, in a minor compaction, it only takes
a few iles placed together and combines them into one. Also, minor
compaction does not ilter the deleted iles. The compaction process
takes care of the versions and uses the ExploringCompactionPolicy
algorithms internally.
Similar to the Put and Get classes, the Delete class instance is used to delete the data
from the HBase table. The HBase table deines the following method for deleting the
data, which takes the Delete class instance as an argument:
void delete(Delete deleteInst)
This method deletes the latest cells from a given row. Here, the Delete class instance
can be created using either of the class constructors:
Delete(byte[] row)
Delete(byte[] rowArray, int rowOffset, int rowLength)
Delete(byte[] rowArray, int rowOffset, int rowLength, long ts)
Delete(byte[] row, long timestamp)
Delete(Delete d)
This constructor creates a Delete operation for the speciied row identiied by the
rowkey. For narrowing down the data search to a speciic cell, additional methods
provided within the Delete class are as follows:
Method name
Description
deleteColumn(byte[] family, byte[]
qualifier)
deleteColumn(byte[] family, byte[]
qualifier, long timestamp)
This deletes the latest version of
the specified column based on the
timestamp
deleteColumns(byte[] family, byte[]
qualifier)
This deletes all the versions of the
specified column
deleteFamily(byte[] family)
This deletes all the versions of all
columns of the specified family
Search WWH ::




Custom Search