HBASE-490 Doubly-assigned .META.; master uses one and clients another

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@633597 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2008-03-04 19:25:14 +00:00
parent ab8b5920a9
commit 36b5f4791f
6 changed files with 21 additions and 26 deletions

View File

@ -28,6 +28,7 @@ Hbase Change Log
HBASE-462 Update migration tool HBASE-462 Update migration tool
HBASE-473 When a table is deleted, master sends multiple close messages to HBASE-473 When a table is deleted, master sends multiple close messages to
the region server the region server
HBASE-490 Doubly-assigned .META.; master uses one and clients another
IMPROVEMENTS IMPROVEMENTS
HBASE-415 Rewrite leases to use DelayedBlockingQueue instead of polling HBASE-415 Rewrite leases to use DelayedBlockingQueue instead of polling

View File

@ -372,21 +372,13 @@ abstract class BaseScanner extends Chore implements HConstants {
} }
/* /*
* If the server is not dead and either: * If the server is a dead server or its startcode is off -- either null
* the stored info is not null and the start code does not match * or doesn't match the start code for the address -- then add it to the
* or: * list of unassigned regions IF not already there (or pending open).
* the stored info is null and the region is neither unassigned nor pending
* then:
*/ */
if (!deadServer && if (!deadServer && !regionManager.isUnassigned(info) &&
((storedInfo != null && storedInfo.getStartCode() != startCode) ||
(storedInfo == null &&
!regionManager.isUnassigned(info) &&
!regionManager.isPending(info.getRegionName()) !regionManager.isPending(info.getRegionName())
) && (storedInfo == null || storedInfo.getStartCode() != startCode)) {
)
) {
// The current assignment is invalid // The current assignment is invalid
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Current assignment of " + info.getRegionName() + LOG.debug("Current assignment of " + info.getRegionName() +

View File

@ -38,7 +38,7 @@ import org.apache.hadoop.hbase.RemoteExceptionHandler;
* action would prevent other work from getting done. * action would prevent other work from getting done.
*/ */
class MetaScanner extends BaseScanner { class MetaScanner extends BaseScanner {
/** Work for the meta scanner is queued up here */ /** Initial work for the meta scanner is queued up here */
private volatile BlockingQueue<MetaRegion> metaRegionsToScan = private volatile BlockingQueue<MetaRegion> metaRegionsToScan =
new LinkedBlockingQueue<MetaRegion>(); new LinkedBlockingQueue<MetaRegion>();
@ -50,10 +50,10 @@ class MetaScanner extends BaseScanner {
super(master, regionManager, false, master.metaRescanInterval, master.closed); super(master, regionManager, false, master.metaRescanInterval, master.closed);
} }
// Don't retry if we get an error while scanning. Errors are most often
// caused by the server going away. Wait until next rescan interval when
// things should be back to normal
private boolean scanOneMetaRegion(MetaRegion region) { private boolean scanOneMetaRegion(MetaRegion region) {
// Don't retry if we get an error while scanning. Errors are most often
// caused by the server going away. Wait until next rescan interval when
// things should be back to normal
boolean scanSuccessful = false; boolean scanSuccessful = false;
while (!master.closed.get() && !regionManager.isInitialRootScanComplete() && while (!master.closed.get() && !regionManager.isInitialRootScanComplete() &&
regionManager.getRootRegionLocation() == null) { regionManager.getRootRegionLocation() == null) {
@ -95,7 +95,9 @@ class MetaScanner extends BaseScanner {
@Override @Override
protected boolean initialScan() { protected boolean initialScan() {
MetaRegion region = null; MetaRegion region = null;
while (!master.closed.get() && region == null && !metaRegionsScanned()) { while (!master.closed.get() &&
(region == null && metaRegionsToScan.size() > 0) &&
!metaRegionsScanned()) {
try { try {
region = metaRegionsToScan.poll(master.threadWakeFrequency, region = metaRegionsToScan.poll(master.threadWakeFrequency,
TimeUnit.MILLISECONDS); TimeUnit.MILLISECONDS);
@ -164,4 +166,4 @@ class MetaScanner extends BaseScanner {
void addMetaRegionToScan(MetaRegion m) throws InterruptedException { void addMetaRegionToScan(MetaRegion m) throws InterruptedException {
metaRegionsToScan.add(m); metaRegionsToScan.add(m);
} }
} }

View File

@ -598,7 +598,7 @@ class RegionManager implements HConstants {
public void waitForRootRegionLocation() { public void waitForRootRegionLocation() {
synchronized (rootRegionLocation) { synchronized (rootRegionLocation) {
while(!master.closed.get() && rootRegionLocation.get() == null) { while (!master.closed.get() && rootRegionLocation.get() == null) {
// rootRegionLocation will be filled in when we get an 'open region' // rootRegionLocation will be filled in when we get an 'open region'
// regionServerReport message from the HRegionServer that has been // regionServerReport message from the HRegionServer that has been
// allocated the ROOT region below. // allocated the ROOT region below.

View File

@ -31,10 +31,10 @@ class RootScanner extends BaseScanner {
super(master, regionManager, true, master.metaRescanInterval, master.closed); super(master, regionManager, true, master.metaRescanInterval, master.closed);
} }
// Don't retry if we get an error while scanning. Errors are most often
// caused by the server going away. Wait until next rescan interval when
// things should be back to normal
private boolean scanRoot() { private boolean scanRoot() {
// Don't retry if we get an error while scanning. Errors are most often
// caused by the server going away. Wait until next rescan interval when
// things should be back to normal
boolean scanSuccessful = false; boolean scanSuccessful = false;
master.waitForRootRegionLocation(); master.waitForRootRegionLocation();
if (master.closed.get()) { if (master.closed.get()) {
@ -71,4 +71,4 @@ class RootScanner extends BaseScanner {
protected void maintenanceScan() { protected void maintenanceScan() {
scanRoot(); scanRoot();
} }
} }

View File

@ -44,7 +44,7 @@ public class Sleeper {
* Sleep for period. * Sleep for period.
*/ */
public void sleep() { public void sleep() {
sleep(period); sleep(System.currentTimeMillis());
} }
/** /**
@ -69,4 +69,4 @@ public class Sleeper {
} }
} }
} }
} }