HBASE-1342 Add to filesystem info needed to rebuild .META.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@770844 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dc3e57659d
commit
c8cdf88bf3
|
@ -14,6 +14,7 @@ Release 0.20.0 - Unreleased
|
||||||
HBASE-1234 Change HBase StoreKey format
|
HBASE-1234 Change HBase StoreKey format
|
||||||
HBASE-1348 Move 0.20.0 targeted TRUNK to 0.20.0 hadoop
|
HBASE-1348 Move 0.20.0 targeted TRUNK to 0.20.0 hadoop
|
||||||
(Ryan Rawson and Stack)
|
(Ryan Rawson and Stack)
|
||||||
|
HBASE-1342 Add to filesystem info needed to rebuild .META.
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
HBASE-1140 "ant clean test" fails (Nitay Joffe via Stack)
|
HBASE-1140 "ant clean test" fails (Nitay Joffe via Stack)
|
||||||
|
|
|
@ -279,7 +279,8 @@ public class HColumnDescriptor implements ISerializable, WritableComparable<HCol
|
||||||
* @return <code>b</code>
|
* @return <code>b</code>
|
||||||
* @throws IllegalArgumentException If not null and not a legitimate family
|
* @throws IllegalArgumentException If not null and not a legitimate family
|
||||||
* name: i.e. 'printable' and ends in a ':' (Null passes are allowed because
|
* name: i.e. 'printable' and ends in a ':' (Null passes are allowed because
|
||||||
* <code>b</code> can be null when deserializing).
|
* <code>b</code> can be null when deserializing). Cannot start with a '.'
|
||||||
|
* either.
|
||||||
*/
|
*/
|
||||||
public static byte [] isLegalFamilyName(final byte [] b) {
|
public static byte [] isLegalFamilyName(final byte [] b) {
|
||||||
if (b == null) {
|
if (b == null) {
|
||||||
|
@ -289,6 +290,10 @@ public class HColumnDescriptor implements ISerializable, WritableComparable<HCol
|
||||||
throw new IllegalArgumentException("Family names must end in a colon: " +
|
throw new IllegalArgumentException("Family names must end in a colon: " +
|
||||||
Bytes.toString(b));
|
Bytes.toString(b));
|
||||||
}
|
}
|
||||||
|
if (b[0] == '.') {
|
||||||
|
throw new IllegalArgumentException("Family names cannot start with a " +
|
||||||
|
"period: " + Bytes.toString(b));
|
||||||
|
}
|
||||||
for (int i = 0; i < (b.length - 1); i++) {
|
for (int i = 0; i < (b.length - 1); i++) {
|
||||||
if (Character.isISOControl(b[i])) {
|
if (Character.isISOControl(b[i])) {
|
||||||
throw new IllegalArgumentException("Illegal character <" + b[i] +
|
throw new IllegalArgumentException("Illegal character <" + b[i] +
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class HMsg implements Writable {
|
||||||
// If null or empty region, don't bother printing it out.
|
// If null or empty region, don't bother printing it out.
|
||||||
if (this.info != null && this.info.getRegionName().length > 0) {
|
if (this.info != null && this.info.getRegionName().length > 0) {
|
||||||
sb.append(": ");
|
sb.append(": ");
|
||||||
sb.append(this.info.getRegionNameAsString());
|
sb.append(this.info.toString());
|
||||||
}
|
}
|
||||||
if (this.message != null && this.message.length > 0) {
|
if (this.message != null && this.message.length > 0) {
|
||||||
sb.append(": " + Bytes.toString(this.message));
|
sb.append(": " + Bytes.toString(this.message));
|
||||||
|
|
|
@ -259,7 +259,8 @@ abstract class BaseScanner extends Chore implements HConstants {
|
||||||
parent.getRegionName(), rowContent, COL_SPLITB);
|
parent.getRegionName(), rowContent, COL_SPLITB);
|
||||||
if (!hasReferencesA && !hasReferencesB) {
|
if (!hasReferencesA && !hasReferencesB) {
|
||||||
LOG.info("Deleting region " + parent.getRegionNameAsString() +
|
LOG.info("Deleting region " + parent.getRegionNameAsString() +
|
||||||
" because daughter splits no longer hold references");
|
" (encoded=" + parent.getEncodedName() +
|
||||||
|
") because daughter splits no longer hold references");
|
||||||
HRegion.deleteRegion(this.master.fs, this.master.rootdir, parent);
|
HRegion.deleteRegion(this.master.fs, this.master.rootdir, parent);
|
||||||
HRegion.removeRegionFromMETA(srvr, metaRegionName,
|
HRegion.removeRegionFromMETA(srvr, metaRegionName,
|
||||||
parent.getRegionName());
|
parent.getRegionName());
|
||||||
|
|
|
@ -40,6 +40,7 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.apache.hadoop.fs.FSDataOutputStream;
|
||||||
import org.apache.hadoop.fs.FileStatus;
|
import org.apache.hadoop.fs.FileStatus;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hadoop.fs.Path;
|
import org.apache.hadoop.fs.Path;
|
||||||
|
@ -196,6 +197,17 @@ public class HRegion implements HConstants {
|
||||||
private final Object splitLock = new Object();
|
private final Object splitLock = new Object();
|
||||||
private long minSequenceId;
|
private long minSequenceId;
|
||||||
final AtomicInteger activeScannerCount = new AtomicInteger(0);
|
final AtomicInteger activeScannerCount = new AtomicInteger(0);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the region info file that resides just under the region directory.
|
||||||
|
*/
|
||||||
|
public final static String REGIONINFO_FILE = ".regioninfo";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* REGIONINFO_FILE as byte array.
|
||||||
|
*/
|
||||||
|
public final static byte [] REGIONINFO_FILE_BYTES =
|
||||||
|
Bytes.toBytes(REGIONINFO_FILE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HRegion constructor.
|
* HRegion constructor.
|
||||||
|
@ -261,6 +273,9 @@ public class HRegion implements HConstants {
|
||||||
public void initialize( Path initialFiles, final Progressable reporter)
|
public void initialize( Path initialFiles, final Progressable reporter)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Path oldLogFile = new Path(regiondir, HREGION_OLDLOGFILE_NAME);
|
Path oldLogFile = new Path(regiondir, HREGION_OLDLOGFILE_NAME);
|
||||||
|
|
||||||
|
// Write HRI to a file in case we need to recover .META.
|
||||||
|
checkRegioninfoOnFilesystem();
|
||||||
|
|
||||||
// Move prefab HStore files into place (if any). This picks up split files
|
// Move prefab HStore files into place (if any). This picks up split files
|
||||||
// and any merges from splits and merges dirs.
|
// and any merges from splits and merges dirs.
|
||||||
|
@ -316,6 +331,32 @@ public class HRegion implements HConstants {
|
||||||
" available");
|
" available");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Write out an info file under the region directory. Useful recovering
|
||||||
|
* mangled regions.
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
private void checkRegioninfoOnFilesystem() throws IOException {
|
||||||
|
// Name of this file has two leading and trailing underscores so it doesn't
|
||||||
|
// clash w/ a store/family name. There is possibility, but assumption is
|
||||||
|
// that its slim (don't want to use control character in filename because
|
||||||
|
//
|
||||||
|
Path regioninfo = new Path(this.regiondir, REGIONINFO_FILE);
|
||||||
|
if (this.fs.exists(regioninfo) &&
|
||||||
|
this.fs.getFileStatus(regioninfo).getLen() > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FSDataOutputStream out = this.fs.create(regioninfo, true);
|
||||||
|
try {
|
||||||
|
this.regionInfo.write(out);
|
||||||
|
out.write('\n');
|
||||||
|
out.write('\n');
|
||||||
|
out.write(Bytes.toBytes(this.regionInfo.toString()));
|
||||||
|
} finally {
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Updates to this region need to have a sequence id that is >= to
|
* @return Updates to this region need to have a sequence id that is >= to
|
||||||
* the this number.
|
* the this number.
|
||||||
|
|
|
@ -1280,7 +1280,7 @@ public class HRegionServer implements HConstants, HRegionInterface,
|
||||||
void reportSplit(HRegionInfo oldRegion, HRegionInfo newRegionA,
|
void reportSplit(HRegionInfo oldRegion, HRegionInfo newRegionA,
|
||||||
HRegionInfo newRegionB) {
|
HRegionInfo newRegionB) {
|
||||||
outboundMsgs.add(new HMsg(HMsg.Type.MSG_REPORT_SPLIT, oldRegion,
|
outboundMsgs.add(new HMsg(HMsg.Type.MSG_REPORT_SPLIT, oldRegion,
|
||||||
(oldRegion.getRegionNameAsString() + " split; daughters: " +
|
("Daughters; " +
|
||||||
newRegionA.getRegionNameAsString() + ", " +
|
newRegionA.getRegionNameAsString() + ", " +
|
||||||
newRegionB.getRegionNameAsString()).getBytes()));
|
newRegionB.getRegionNameAsString()).getBytes()));
|
||||||
outboundMsgs.add(new HMsg(HMsg.Type.MSG_REPORT_OPEN, newRegionA));
|
outboundMsgs.add(new HMsg(HMsg.Type.MSG_REPORT_OPEN, newRegionA));
|
||||||
|
|
Loading…
Reference in New Issue