HBASE-999 Up versions on historian and keep history of deleted regions for a while rather than delete immediately
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@714193 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ad9b391811
commit
b5bdaf2c1f
|
@ -117,6 +117,8 @@ Release 0.19.0 - Unreleased
|
||||||
HBASE-993 Turn of logging of every catalog table row entry on every scan
|
HBASE-993 Turn of logging of every catalog table row entry on every scan
|
||||||
HBASE-992 Up the versions kept by catalog tables; currently 1. Make it 10?
|
HBASE-992 Up the versions kept by catalog tables; currently 1. Make it 10?
|
||||||
HBASE-998 Narrow getClosestRowBefore by passing column family
|
HBASE-998 Narrow getClosestRowBefore by passing column family
|
||||||
|
HBASE-999 Up versions on historian and keep history of deleted regions for a
|
||||||
|
while rather than delete immediately
|
||||||
|
|
||||||
NEW FEATURES
|
NEW FEATURES
|
||||||
HBASE-875 Use MurmurHash instead of JenkinsHash [in bloomfilters]
|
HBASE-875 Use MurmurHash instead of JenkinsHash [in bloomfilters]
|
||||||
|
|
|
@ -235,6 +235,8 @@ public interface HConstants {
|
||||||
*/
|
*/
|
||||||
static final int FOREVER = -1;
|
static final int FOREVER = -1;
|
||||||
|
|
||||||
|
public static final int WEEK_IN_SECONDS = 7 * 24 * 3600;
|
||||||
|
|
||||||
//TODO: HBASE_CLIENT_RETRIES_NUMBER_KEY is only used by TestMigrate. Move it
|
//TODO: HBASE_CLIENT_RETRIES_NUMBER_KEY is only used by TestMigrate. Move it
|
||||||
// there.
|
// there.
|
||||||
public static final String HBASE_CLIENT_RETRIES_NUMBER_KEY =
|
public static final String HBASE_CLIENT_RETRIES_NUMBER_KEY =
|
||||||
|
|
|
@ -622,5 +622,5 @@ public class HTableDescriptor implements WritableComparable<HTableDescriptor> {
|
||||||
Integer.MAX_VALUE, HConstants.FOREVER, false),
|
Integer.MAX_VALUE, HConstants.FOREVER, false),
|
||||||
new HColumnDescriptor(HConstants.COLUMN_FAMILY_HISTORIAN,
|
new HColumnDescriptor(HConstants.COLUMN_FAMILY_HISTORIAN,
|
||||||
HConstants.ALL_VERSIONS, HColumnDescriptor.CompressionType.NONE,
|
HConstants.ALL_VERSIONS, HColumnDescriptor.CompressionType.NONE,
|
||||||
false, false, Integer.MAX_VALUE, HConstants.FOREVER, false) });
|
false, false, Integer.MAX_VALUE, HConstants.WEEK_IN_SECONDS, false)});
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,8 @@ public class RegionHistorian implements HConstants {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String SPLIT_PREFIX = "Region split from: ";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor. Initializes reference to .META. table. Inaccessible.
|
* Default constructor. Initializes reference to .META. table. Inaccessible.
|
||||||
* Use {@link #getInstance(HBaseConfiguration)} to obtain the Singleton
|
* Use {@link #getInstance(HBaseConfiguration)} to obtain the Singleton
|
||||||
|
@ -170,8 +172,8 @@ public class RegionHistorian implements HConstants {
|
||||||
HRegionInfo newInfo2) {
|
HRegionInfo newInfo2) {
|
||||||
HRegionInfo[] infos = new HRegionInfo[] { newInfo1, newInfo2 };
|
HRegionInfo[] infos = new HRegionInfo[] { newInfo1, newInfo2 };
|
||||||
for (HRegionInfo info : infos) {
|
for (HRegionInfo info : infos) {
|
||||||
add(HistorianColumnKey.REGION_SPLIT.key, "Region split from : "
|
add(HistorianColumnKey.REGION_SPLIT.key, SPLIT_PREFIX +
|
||||||
+ oldInfo.getRegionNameAsString(), info);
|
oldInfo.getRegionNameAsString(), info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1335,8 +1335,9 @@ public class HRegion implements HConstants {
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
try {
|
try {
|
||||||
for (HStore store : stores.values()) {
|
for (HStore store : stores.values()) {
|
||||||
List<HStoreKey> keys = store.getKeys(new HStoreKey(row, ts, this.regionInfo),
|
List<HStoreKey> keys =
|
||||||
ALL_VERSIONS, now, null);
|
store.getKeys(new HStoreKey(row, ts, this.regionInfo), ALL_VERSIONS,
|
||||||
|
now, null);
|
||||||
TreeMap<HStoreKey, byte []> edits = new TreeMap<HStoreKey, byte []>(
|
TreeMap<HStoreKey, byte []> edits = new TreeMap<HStoreKey, byte []>(
|
||||||
new HStoreKey.HStoreKeyWritableComparator(regionInfo));
|
new HStoreKey.HStoreKeyWritableComparator(regionInfo));
|
||||||
for (HStoreKey key: keys) {
|
for (HStoreKey key: keys) {
|
||||||
|
@ -2104,7 +2105,8 @@ public class HRegion implements HConstants {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a region's meta information from the passed
|
* Delete a region's meta information from the passed
|
||||||
* <code>meta</code> region.
|
* <code>meta</code> region. Removes content in the 'info' column family.
|
||||||
|
* Does not remove region historian info.
|
||||||
*
|
*
|
||||||
* @param srvr META server to be updated
|
* @param srvr META server to be updated
|
||||||
* @param metaRegionName Meta region name
|
* @param metaRegionName Meta region name
|
||||||
|
@ -2115,7 +2117,8 @@ public class HRegion implements HConstants {
|
||||||
public static void removeRegionFromMETA(final HRegionInterface srvr,
|
public static void removeRegionFromMETA(final HRegionInterface srvr,
|
||||||
final byte [] metaRegionName, final byte [] regionName)
|
final byte [] metaRegionName, final byte [] regionName)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
srvr.deleteAll(metaRegionName, regionName, HConstants.LATEST_TIMESTAMP, -1L);
|
srvr.deleteFamily(metaRegionName, regionName, HConstants.COLUMN_FAMILY,
|
||||||
|
HConstants.LATEST_TIMESTAMP, -1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -257,14 +257,22 @@ public class Migrate extends Configured implements Tool {
|
||||||
* @param true if we changed value
|
* @param true if we changed value
|
||||||
*/
|
*/
|
||||||
private boolean updateVersions(final HRegionInfo hri) {
|
private boolean updateVersions(final HRegionInfo hri) {
|
||||||
|
boolean result = false;
|
||||||
HColumnDescriptor hcd =
|
HColumnDescriptor hcd =
|
||||||
hri.getTableDesc().getFamily(HConstants.COLUMN_FAMILY);
|
hri.getTableDesc().getFamily(HConstants.COLUMN_FAMILY_HISTORIAN);
|
||||||
|
// Set historian records so they timeout after a week.
|
||||||
|
if (hcd.getTimeToLive() == HConstants.FOREVER) {
|
||||||
|
hcd.setTimeToLive(HConstants.WEEK_IN_SECONDS);
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
// Set the versions up to 10 from old default of 1.
|
||||||
|
hcd = hri.getTableDesc().getFamily(HConstants.COLUMN_FAMILY);
|
||||||
if (hcd.getMaxVersions() == 1) {
|
if (hcd.getMaxVersions() == 1) {
|
||||||
// Set it to 10, an arbitrary high number
|
// Set it to 10, an arbitrary high number
|
||||||
hcd.setMaxVersions(10);
|
hcd.setMaxVersions(10);
|
||||||
return true;
|
result = true;
|
||||||
}
|
}
|
||||||
return false;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int parseArgs(String[] args) {
|
private int parseArgs(String[] args) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<%@ page contentType="text/html;charset=UTF-8"
|
<%@ page contentType="text/html;charset=UTF-8"
|
||||||
import="java.util.List"
|
import="java.util.List"
|
||||||
|
import="java.util.regex.*"
|
||||||
import="org.apache.hadoop.hbase.RegionHistorian"
|
import="org.apache.hadoop.hbase.RegionHistorian"
|
||||||
import="org.apache.hadoop.hbase.master.HMaster"
|
import="org.apache.hadoop.hbase.master.HMaster"
|
||||||
import="org.apache.hadoop.hbase.RegionHistorian.RegionHistoryInformation"
|
import="org.apache.hadoop.hbase.RegionHistorian.RegionHistoryInformation"
|
||||||
|
@ -7,6 +8,8 @@
|
||||||
String regionName = request.getParameter("regionname");
|
String regionName = request.getParameter("regionname");
|
||||||
HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
|
HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
|
||||||
List<RegionHistoryInformation> informations = RegionHistorian.getInstance().getRegionHistory(regionName);
|
List<RegionHistoryInformation> informations = RegionHistorian.getInstance().getRegionHistory(regionName);
|
||||||
|
// Pattern used so we can wrap a regionname in an href.
|
||||||
|
Pattern pattern = Pattern.compile(RegionHistorian.SPLIT_PREFIX + "(.*)$");
|
||||||
%><?xml version="1.0" encoding="UTF-8" ?>
|
%><?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
@ -24,8 +27,18 @@
|
||||||
<hr id="head_rule" />
|
<hr id="head_rule" />
|
||||||
<%if(informations != null && informations.size() > 0) { %>
|
<%if(informations != null && informations.size() > 0) { %>
|
||||||
<table><tr><th>Timestamp</th><th>Event</th><th>Description</th></tr>
|
<table><tr><th>Timestamp</th><th>Event</th><th>Description</th></tr>
|
||||||
<% for( RegionHistoryInformation information : informations) {%>
|
<% for( RegionHistoryInformation information : informations) {
|
||||||
<tr><td><%= information.getTimestampAsString() %></td><td><%= information.getEvent() %></td><td><%= information.getDescription()%></td></tr>
|
String description = information.getDescription();
|
||||||
|
Matcher m = pattern.matcher(description);
|
||||||
|
if (m.matches()) {
|
||||||
|
// Wrap the region name in an href so user can click on it.
|
||||||
|
description = RegionHistorian.SPLIT_PREFIX +
|
||||||
|
"<a href=\"regionhistorian.jsp?regionname=" + m.group(1) + "\">" +
|
||||||
|
m.group(1) + "</a>";
|
||||||
|
}
|
||||||
|
|
||||||
|
%>
|
||||||
|
<tr><td><%= information.getTimestampAsString() %></td><td><%= information.getEvent() %></td><td><%= description %></td></tr>
|
||||||
<% } %>
|
<% } %>
|
||||||
</table>
|
</table>
|
||||||
<p>
|
<p>
|
||||||
|
|
Loading…
Reference in New Issue