HBASE-4152 Rename o.a.h.h.regionserver.wal.WALObserver to o.a.h.h.regionserver.wal.WALActionsListener
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1155202 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4c52d623da
commit
1185c6c89c
|
@ -378,6 +378,8 @@ Release 0.91.0 - Unreleased
|
|||
HBASE-4025 Server startup fails during startup due to failure in loading
|
||||
all table descriptors. (Subbu Iyer via Ted Yu)
|
||||
HBASE-4017 BlockCache interface should be truly modular (Li Pi)
|
||||
HBASE-4152 Rename o.a.h.h.regionserver.wal.WALObserver to
|
||||
o.a.h.h.regionserver.wal.WALActionsListener
|
||||
|
||||
NEW FEATURES
|
||||
HBASE-2001 Coprocessors: Colocate user code with regions (Mingjie Lai via
|
||||
|
|
|
@ -117,7 +117,7 @@ import org.apache.hadoop.hbase.regionserver.handler.OpenRegionHandler;
|
|||
import org.apache.hadoop.hbase.regionserver.handler.OpenRootHandler;
|
||||
import org.apache.hadoop.hbase.regionserver.metrics.RegionServerMetrics;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.HLog;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.WALObserver;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener;
|
||||
import org.apache.hadoop.hbase.regionserver.RegionOpeningState;
|
||||
import org.apache.hadoop.hbase.replication.regionserver.Replication;
|
||||
import org.apache.hadoop.hbase.security.User;
|
||||
|
@ -1167,12 +1167,12 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler,
|
|||
|
||||
/**
|
||||
* Called by {@link #instantiateHLog(Path, Path)} setting up WAL instance.
|
||||
* Add any {@link WALObserver}s you want inserted before WAL startup.
|
||||
* Add any {@link WALActionsListener}s you want inserted before WAL startup.
|
||||
* @return List of WALActionsListener that will be passed in to
|
||||
* {@link HLog} on construction.
|
||||
*/
|
||||
protected List<WALObserver> getWALActionListeners() {
|
||||
List<WALObserver> listeners = new ArrayList<WALObserver>();
|
||||
protected List<WALActionsListener> getWALActionListeners() {
|
||||
List<WALActionsListener> listeners = new ArrayList<WALActionsListener>();
|
||||
// Log roller.
|
||||
this.hlogRoller = new LogRoller(this, this);
|
||||
listeners.add(this.hlogRoller);
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.hadoop.hbase.*;
|
|||
import org.apache.hadoop.hbase.regionserver.wal.FailedLogCloseException;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.HLogKey;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.WALObserver;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -40,7 +40,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
|||
* can be interrupted when there is something to do, rather than the Chore
|
||||
* sleep time which is invariant.
|
||||
*/
|
||||
class LogRoller extends Thread implements WALObserver {
|
||||
class LogRoller extends Thread implements WALActionsListener {
|
||||
static final Log LOG = LogFactory.getLog(LogRoller.class);
|
||||
private final ReentrantLock rollLock = new ReentrantLock();
|
||||
private final AtomicBoolean rollLog = new AtomicBoolean(false);
|
||||
|
|
|
@ -119,8 +119,8 @@ public class HLog implements Syncable {
|
|||
private final Path dir;
|
||||
private final Configuration conf;
|
||||
// Listeners that are called on WAL events.
|
||||
private List<WALObserver> listeners =
|
||||
new CopyOnWriteArrayList<WALObserver>();
|
||||
private List<WALActionsListener> listeners =
|
||||
new CopyOnWriteArrayList<WALActionsListener>();
|
||||
private final long optionalFlushInterval;
|
||||
private final long blocksize;
|
||||
private final String prefix;
|
||||
|
@ -295,7 +295,7 @@ public class HLog implements Syncable {
|
|||
* @throws IOException
|
||||
*/
|
||||
public HLog(final FileSystem fs, final Path dir, final Path oldLogDir,
|
||||
final Configuration conf, final List<WALObserver> listeners,
|
||||
final Configuration conf, final List<WALActionsListener> listeners,
|
||||
final String prefix) throws IOException {
|
||||
this(fs, dir, oldLogDir, conf, listeners, true, prefix);
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ public class HLog implements Syncable {
|
|||
* @throws IOException
|
||||
*/
|
||||
public HLog(final FileSystem fs, final Path dir, final Path oldLogDir,
|
||||
final Configuration conf, final List<WALObserver> listeners,
|
||||
final Configuration conf, final List<WALActionsListener> listeners,
|
||||
final boolean failIfLogDirExists, final String prefix)
|
||||
throws IOException {
|
||||
super();
|
||||
|
@ -329,7 +329,7 @@ public class HLog implements Syncable {
|
|||
this.dir = dir;
|
||||
this.conf = conf;
|
||||
if (listeners != null) {
|
||||
for (WALObserver i: listeners) {
|
||||
for (WALActionsListener i: listeners) {
|
||||
registerWALActionsListener(i);
|
||||
}
|
||||
}
|
||||
|
@ -404,11 +404,11 @@ public class HLog implements Syncable {
|
|||
return m;
|
||||
}
|
||||
|
||||
public void registerWALActionsListener (final WALObserver listener) {
|
||||
public void registerWALActionsListener(final WALActionsListener listener) {
|
||||
this.listeners.add(listener);
|
||||
}
|
||||
|
||||
public boolean unregisterWALActionsListener(final WALObserver listener) {
|
||||
public boolean unregisterWALActionsListener(final WALActionsListener listener) {
|
||||
return this.listeners.remove(listener);
|
||||
}
|
||||
|
||||
|
@ -501,7 +501,7 @@ public class HLog implements Syncable {
|
|||
}
|
||||
// Tell our listeners that a new log was created
|
||||
if (!this.listeners.isEmpty()) {
|
||||
for (WALObserver i : this.listeners) {
|
||||
for (WALActionsListener i : this.listeners) {
|
||||
i.logRolled(newPath);
|
||||
}
|
||||
}
|
||||
|
@ -813,7 +813,7 @@ public class HLog implements Syncable {
|
|||
try {
|
||||
// Tell our listeners that the log is closing
|
||||
if (!this.listeners.isEmpty()) {
|
||||
for (WALObserver i : this.listeners) {
|
||||
for (WALActionsListener i : this.listeners) {
|
||||
i.logCloseRequested();
|
||||
}
|
||||
}
|
||||
|
@ -1053,7 +1053,7 @@ public class HLog implements Syncable {
|
|||
|
||||
private void requestLogRoll() {
|
||||
if (!this.listeners.isEmpty()) {
|
||||
for (WALObserver i: this.listeners) {
|
||||
for (WALActionsListener i: this.listeners) {
|
||||
i.logRollRequested();
|
||||
}
|
||||
}
|
||||
|
@ -1066,7 +1066,7 @@ public class HLog implements Syncable {
|
|||
return;
|
||||
}
|
||||
if (!this.listeners.isEmpty()) {
|
||||
for (WALObserver i: this.listeners) {
|
||||
for (WALActionsListener i: this.listeners) {
|
||||
i.visitLogEntryBeforeWrite(htd, logKey, logEdit);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2010 The Apache Software Foundation
|
||||
* Copyright 2011 The Apache Software Foundation
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
|
@ -27,7 +27,7 @@ import org.apache.hadoop.hbase.HTableDescriptor;
|
|||
* Get notification of {@link HLog}/WAL log events. The invocations are inline
|
||||
* so make sure your implementation is fast else you'll slow hbase.
|
||||
*/
|
||||
public interface WALObserver {
|
||||
public interface WALActionsListener {
|
||||
/**
|
||||
* The WAL was rolled.
|
||||
* @param newFile the path to the new hlog
|
|
@ -34,7 +34,7 @@ import org.apache.hadoop.hbase.Server;
|
|||
import org.apache.hadoop.hbase.regionserver.wal.HLog;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.HLogKey;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.WALObserver;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener;
|
||||
import org.apache.hadoop.hbase.replication.ReplicationZookeeper;
|
||||
import org.apache.hadoop.hbase.replication.master.ReplicationLogCleaner;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
|
@ -47,7 +47,7 @@ import static org.apache.hadoop.hbase.HConstants.REPLICATION_SCOPE_LOCAL;
|
|||
/**
|
||||
* Gateway to Replication. Used by {@link org.apache.hadoop.hbase.regionserver.HRegionServer}.
|
||||
*/
|
||||
public class Replication implements WALObserver {
|
||||
public class Replication implements WALActionsListener {
|
||||
private final boolean replication;
|
||||
private final ReplicationSourceManager replicationManager;
|
||||
private final AtomicBoolean replicating = new AtomicBoolean(true);
|
||||
|
|
|
@ -594,7 +594,7 @@ public class TestHLog {
|
|||
final byte [] tableName = Bytes.toBytes("tablename");
|
||||
final byte [] row = Bytes.toBytes("row");
|
||||
HLog log = new HLog(fs, dir, oldLogDir, conf);
|
||||
DumbWALObserver visitor = new DumbWALObserver();
|
||||
DumbWALActionsListener visitor = new DumbWALActionsListener();
|
||||
log.registerWALActionsListener(visitor);
|
||||
long timestamp = System.currentTimeMillis();
|
||||
HTableDescriptor htd = new HTableDescriptor();
|
||||
|
@ -692,7 +692,7 @@ public class TestHLog {
|
|||
}
|
||||
}
|
||||
|
||||
static class DumbWALObserver implements WALObserver {
|
||||
static class DumbWALActionsListener implements WALActionsListener {
|
||||
int increments = 0;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* Copyright 2010 The Apache Software Foundation
|
||||
* Copyright 2011 The Apache Software Foundation
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
|
@ -38,8 +38,8 @@ import static org.junit.Assert.*;
|
|||
/**
|
||||
* Test that the actions are called while playing with an HLog
|
||||
*/
|
||||
public class TestWALObserver {
|
||||
protected static final Log LOG = LogFactory.getLog(TestWALObserver.class);
|
||||
public class TestWALActionsListener {
|
||||
protected static final Log LOG = LogFactory.getLog(TestWALActionsListener.class);
|
||||
|
||||
private final static HBaseTestingUtility TEST_UTIL =
|
||||
new HBaseTestingUtility();
|
||||
|
@ -79,10 +79,10 @@ public class TestWALObserver {
|
|||
*/
|
||||
@Test
|
||||
public void testActionListener() throws Exception {
|
||||
DummyWALObserver observer = new DummyWALObserver();
|
||||
List<WALObserver> list = new ArrayList<WALObserver>();
|
||||
DummyWALActionsListener observer = new DummyWALActionsListener();
|
||||
List<WALActionsListener> list = new ArrayList<WALActionsListener>();
|
||||
list.add(observer);
|
||||
DummyWALObserver laterobserver = new DummyWALObserver();
|
||||
DummyWALActionsListener laterobserver = new DummyWALActionsListener();
|
||||
HLog hlog = new HLog(fs, logDir, oldLogDir, conf, list, null);
|
||||
HRegionInfo hri = new HRegionInfo(SOME_BYTES,
|
||||
SOME_BYTES, SOME_BYTES, false);
|
||||
|
@ -117,7 +117,7 @@ public class TestWALObserver {
|
|||
/**
|
||||
* Just counts when methods are called
|
||||
*/
|
||||
static class DummyWALObserver implements WALObserver {
|
||||
static class DummyWALActionsListener implements WALActionsListener {
|
||||
public int logRollCounter = 0;
|
||||
public int closedCount = 0;
|
||||
|
||||
|
@ -135,7 +135,7 @@ public class TestWALObserver {
|
|||
public void visitLogEntryBeforeWrite(HRegionInfo info, HLogKey logKey,
|
||||
WALEdit logEdit) {
|
||||
// Not interested
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
|
@ -43,7 +43,7 @@ import org.apache.hadoop.hbase.catalog.CatalogTracker;
|
|||
import org.apache.hadoop.hbase.regionserver.wal.HLog;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.HLogKey;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.WALObserver;
|
||||
import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener;
|
||||
import org.apache.hadoop.hbase.replication.ReplicationSourceDummy;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
import org.apache.hadoop.hbase.zookeeper.ZKUtil;
|
||||
|
@ -156,7 +156,7 @@ public class TestReplicationSourceManager {
|
|||
WALEdit edit = new WALEdit();
|
||||
edit.add(kv);
|
||||
|
||||
List<WALObserver> listeners = new ArrayList<WALObserver>();
|
||||
List<WALActionsListener> listeners = new ArrayList<WALActionsListener>();
|
||||
listeners.add(replication);
|
||||
HLog hlog = new HLog(fs, logDir, oldLogDir, conf, listeners,
|
||||
URLEncoder.encode("regionserver:60020", "UTF8"));
|
||||
|
|
Loading…
Reference in New Issue