HBASE-25230 Embedded zookeeper server not clean up the old data
Closes #2732 Signed-off-by: maoling <maoling199210191@sina.com> Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
parent
4127a3940a
commit
9a2994a5a3
|
@ -44,6 +44,9 @@ import org.apache.zookeeper.server.ZooKeeperServerMain;
|
||||||
import org.apache.zookeeper.server.admin.AdminServer;
|
import org.apache.zookeeper.server.admin.AdminServer;
|
||||||
import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
|
import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
|
||||||
import org.apache.zookeeper.server.quorum.QuorumPeerMain;
|
import org.apache.zookeeper.server.quorum.QuorumPeerMain;
|
||||||
|
import org.apache.zookeeper.server.DatadirCleanupManager;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HBase's version of ZooKeeper's QuorumPeer. When HBase is set to manage
|
* HBase's version of ZooKeeper's QuorumPeer. When HBase is set to manage
|
||||||
|
@ -84,6 +87,20 @@ public final class HQuorumPeer {
|
||||||
|
|
||||||
private static void runZKServer(QuorumPeerConfig zkConfig)
|
private static void runZKServer(QuorumPeerConfig zkConfig)
|
||||||
throws IOException, AdminServer.AdminServerException {
|
throws IOException, AdminServer.AdminServerException {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Start and schedule the purge task
|
||||||
|
* autopurge.purgeInterval is 0 by default,so in fact the DatadirCleanupManager task will not
|
||||||
|
* be started to clean the logs by default. Config is recommended only for standalone server.
|
||||||
|
*/
|
||||||
|
|
||||||
|
DatadirCleanupManager purgeMgr=new DatadirCleanupManager(
|
||||||
|
zkConfig.getDataDir(),
|
||||||
|
zkConfig.getDataLogDir(),
|
||||||
|
zkConfig.getSnapRetainCount(),
|
||||||
|
zkConfig.getPurgeInterval());
|
||||||
|
purgeMgr.start();
|
||||||
|
|
||||||
if (zkConfig.isDistributed()) {
|
if (zkConfig.isDistributed()) {
|
||||||
QuorumPeerMain qp = new QuorumPeerMain();
|
QuorumPeerMain qp = new QuorumPeerMain();
|
||||||
qp.runFromConfig(zkConfig);
|
qp.runFromConfig(zkConfig);
|
||||||
|
|
Loading…
Reference in New Issue