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-992 Up the versions kept by catalog tables; currently 1. Make it 10?
|
||||
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
|
||||
HBASE-875 Use MurmurHash instead of JenkinsHash [in bloomfilters]
|
||||
|
|
|
@ -234,6 +234,8 @@ public interface HConstants {
|
|||
* Unlimited time-to-live.
|
||||
*/
|
||||
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
|
||||
// there.
|
||||
|
|
|
@ -617,10 +617,10 @@ public class HTableDescriptor implements WritableComparable<HTableDescriptor> {
|
|||
public static final HTableDescriptor META_TABLEDESC = new HTableDescriptor(
|
||||
HConstants.META_TABLE_NAME, new HColumnDescriptor[] {
|
||||
new HColumnDescriptor(HConstants.COLUMN_FAMILY,
|
||||
10, // Ten is arbitrary number. Keep versions to help debuggging.
|
||||
HColumnDescriptor.CompressionType.NONE, false, false,
|
||||
Integer.MAX_VALUE, HConstants.FOREVER, false),
|
||||
10, // Ten is arbitrary number. Keep versions to help debuggging.
|
||||
HColumnDescriptor.CompressionType.NONE, false, false,
|
||||
Integer.MAX_VALUE, HConstants.FOREVER, false),
|
||||
new HColumnDescriptor(HConstants.COLUMN_FAMILY_HISTORIAN,
|
||||
HConstants.ALL_VERSIONS, HColumnDescriptor.CompressionType.NONE,
|
||||
false, false, Integer.MAX_VALUE, HConstants.FOREVER, false) });
|
||||
HConstants.ALL_VERSIONS, HColumnDescriptor.CompressionType.NONE,
|
||||
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.
|
||||
* Use {@link #getInstance(HBaseConfiguration)} to obtain the Singleton
|
||||
|
@ -170,8 +172,8 @@ public class RegionHistorian implements HConstants {
|
|||
HRegionInfo newInfo2) {
|
||||
HRegionInfo[] infos = new HRegionInfo[] { newInfo1, newInfo2 };
|
||||
for (HRegionInfo info : infos) {
|
||||
add(HistorianColumnKey.REGION_SPLIT.key, "Region split from : "
|
||||
+ oldInfo.getRegionNameAsString(), info);
|
||||
add(HistorianColumnKey.REGION_SPLIT.key, SPLIT_PREFIX +
|
||||
oldInfo.getRegionNameAsString(), info);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1335,8 +1335,9 @@ public class HRegion implements HConstants {
|
|||
long now = System.currentTimeMillis();
|
||||
try {
|
||||
for (HStore store : stores.values()) {
|
||||
List<HStoreKey> keys = store.getKeys(new HStoreKey(row, ts, this.regionInfo),
|
||||
ALL_VERSIONS, now, null);
|
||||
List<HStoreKey> keys =
|
||||
store.getKeys(new HStoreKey(row, ts, this.regionInfo), ALL_VERSIONS,
|
||||
now, null);
|
||||
TreeMap<HStoreKey, byte []> edits = new TreeMap<HStoreKey, byte []>(
|
||||
new HStoreKey.HStoreKeyWritableComparator(regionInfo));
|
||||
for (HStoreKey key: keys) {
|
||||
|
@ -2104,7 +2105,8 @@ public class HRegion implements HConstants {
|
|||
|
||||
/**
|
||||
* 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 metaRegionName Meta region name
|
||||
|
@ -2115,7 +2117,8 @@ public class HRegion implements HConstants {
|
|||
public static void removeRegionFromMETA(final HRegionInterface srvr,
|
||||
final byte [] metaRegionName, final byte [] regionName)
|
||||
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
|
||||
*/
|
||||
private boolean updateVersions(final HRegionInfo hri) {
|
||||
boolean result = false;
|
||||
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) {
|
||||
// Set it to 10, an arbitrary high number
|
||||
hcd.setMaxVersions(10);
|
||||
return true;
|
||||
result = true;
|
||||
}
|
||||
return false;
|
||||
return result;
|
||||
}
|
||||
|
||||
private int parseArgs(String[] args) {
|
||||
|
|
|
@ -74,4 +74,4 @@ public class TestEmptyMetaInfo extends HBaseClusterTestCase {
|
|||
assertTrue(tries >= 0);
|
||||
assertEquals(0, count);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
<%@ page contentType="text/html;charset=UTF-8"
|
||||
import="java.util.List"
|
||||
import="java.util.regex.*"
|
||||
import="org.apache.hadoop.hbase.RegionHistorian"
|
||||
import="org.apache.hadoop.hbase.master.HMaster"
|
||||
import="org.apache.hadoop.hbase.RegionHistorian.RegionHistoryInformation"
|
||||
|
@ -7,6 +8,8 @@
|
|||
String regionName = request.getParameter("regionname");
|
||||
HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
|
||||
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" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
@ -24,8 +27,18 @@
|
|||
<hr id="head_rule" />
|
||||
<%if(informations != null && informations.size() > 0) { %>
|
||||
<table><tr><th>Timestamp</th><th>Event</th><th>Description</th></tr>
|
||||
<% for( RegionHistoryInformation information : informations) {%>
|
||||
<tr><td><%= information.getTimestampAsString() %></td><td><%= information.getEvent() %></td><td><%= information.getDescription()%></td></tr>
|
||||
<% for( RegionHistoryInformation information : informations) {
|
||||
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>
|
||||
<p>
|
||||
|
|
Loading…
Reference in New Issue