-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-28209: Create a jmx metrics to expose the oldWALs directory size #5528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
369acda
b9dc07a
df889e0
11c0aa7
e868bdf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,9 @@ | |
| import org.apache.hadoop.fs.Path; | ||
| import org.apache.hadoop.fs.PathFilter; | ||
| import org.apache.hadoop.hbase.HConstants; | ||
| import org.apache.hadoop.hbase.ScheduledChore; | ||
| import org.apache.hadoop.hbase.ServerName; | ||
| import org.apache.hadoop.hbase.Stoppable; | ||
| import org.apache.hadoop.hbase.regionserver.wal.AbstractFSWAL; | ||
| import org.apache.hadoop.hbase.util.CommonFSUtils; | ||
| import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; | ||
|
|
@@ -89,6 +91,12 @@ public boolean accept(Path p) { | |
| // create the split log lock | ||
| private final Lock splitLogLock = new ReentrantLock(); | ||
|
|
||
| // old WALs directory size in bytes | ||
| private long oldWALsDirSize; | ||
|
|
||
| // old WALs directory size calculation interval | ||
| private final int OLD_WAL_DIR_UPDATE_INTERVAL = 5 * 60 * 1000; // 5 mins | ||
|
|
||
| /** | ||
| * Superceded by {@link SplitWALManager}; i.e. procedure-based WAL splitting rather than 'classic' | ||
| * zk-coordinated WAL splitting. | ||
|
|
@@ -114,6 +122,7 @@ public MasterWalManager(Configuration conf, FileSystem fs, Path rootDir, MasterS | |
| this.services = services; | ||
| this.splitLogManager = new SplitLogManager(services, conf); | ||
| this.oldLogDir = new Path(rootDir, HConstants.HREGION_OLDLOGDIR_NAME); | ||
| this.oldWALsDirSize = 0; | ||
| } | ||
|
|
||
| public void stop() { | ||
|
|
@@ -134,6 +143,13 @@ Path getOldLogDir() { | |
| return this.oldLogDir; | ||
| } | ||
|
|
||
| public void updateOldWALsDirSize() throws IOException { | ||
| this.oldWALsDirSize = fs.getContentSummary(this.oldLogDir).getLength(); | ||
| } | ||
| public long getOldWALsDirSize() { | ||
| return this.oldWALsDirSize; | ||
| } | ||
|
|
||
| public FileSystem getFileSystem() { | ||
| return this.fs; | ||
| } | ||
|
|
@@ -398,4 +414,33 @@ public void archiveMetaLog(final ServerName serverName) { | |
| LOG.warn("Failed archiving meta log for server " + serverName, ie); | ||
| } | ||
| } | ||
|
|
||
| private static Stoppable createDummyStoppable() { | ||
| return new Stoppable() { | ||
| private volatile boolean isStopped = false; | ||
|
|
||
| @Override | ||
| public void stop(String why) { | ||
| isStopped = true; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isStopped() { | ||
| return isStopped; | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| public ScheduledChore getOldWALsDirSizeUpdaterChore() { | ||
|
||
| return new ScheduledChore("UpdateOldWALsDirSize", createDummyStoppable(), OLD_WAL_DIR_UPDATE_INTERVAL) { | ||
|
||
| @Override | ||
| protected void chore() { | ||
| try { | ||
| MasterWalManager.this.updateOldWALsDirSize(); | ||
| } catch (IOException e) { | ||
| LOG.error("Got exception while trying to update the old WALs Directory size counter: " + e.getMessage(), e); | ||
| } | ||
| } | ||
| }; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.