-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-21406 "status 'replication'" should not show SINK if the cluste… #1761
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
54444c7
HBASE-21406 "status 'replication'" should not show SINK if the cluste…
wchevreuil 28562e0
fixing build issues
wchevreuil 64a3888
addressing Viraj suggestions.
wchevreuil 6645ae4
Adjusting the waiter timeout
wchevreuil 5b9f46c
Adjusting checkstyles
wchevreuil d19ea42
Addressing latest comments from Josh and Jan, together with shell UT …
wchevreuil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,6 +50,15 @@ public class TestReplicationStatus extends TestReplicationBase { | |
| public static final HBaseClassTestRule CLASS_RULE = | ||
| HBaseClassTestRule.forClass(TestReplicationStatus.class); | ||
|
|
||
| private void insertRowsOnSource() throws IOException { | ||
| final byte[] qualName = Bytes.toBytes("q"); | ||
| for (int i = 0; i < NB_ROWS_IN_BATCH; i++) { | ||
| Put p = new Put(Bytes.toBytes("row" + i)); | ||
| p.addColumn(famName, qualName, Bytes.toBytes("val" + i)); | ||
| htable1.put(p); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Test for HBASE-9531. | ||
| * <p/> | ||
|
|
@@ -70,12 +79,7 @@ public void testReplicationStatus() throws Exception { | |
| Admin hbaseAdmin = UTIL1.getAdmin(); | ||
| // disable peer <= WHY? I DON'T GET THIS DISABLE BUT TEST FAILS W/O IT. | ||
| hbaseAdmin.disableReplicationPeer(PEER_ID2); | ||
| final byte[] qualName = Bytes.toBytes("q"); | ||
| for (int i = 0; i < NB_ROWS_IN_BATCH; i++) { | ||
| Put p = new Put(Bytes.toBytes("row" + i)); | ||
| p.addColumn(famName, qualName, Bytes.toBytes("val" + i)); | ||
| htable1.put(p); | ||
| } | ||
| insertRowsOnSource(); | ||
| LOG.info("AFTER PUTS"); | ||
| // TODO: Change this wait to a barrier. I tried waiting on replication stats to | ||
| // change but sleeping in main thread seems to mess up background replication. | ||
|
|
@@ -120,6 +124,35 @@ public void testReplicationStatus() throws Exception { | |
| assertEquals(PEER_ID2, rLoadSourceList.get(0).getPeerID()); | ||
| } | ||
|
|
||
| @Test | ||
| public void testReplicationStatusSink() throws Exception { | ||
| try (Admin hbaseAdmin = UTIL2.getConnection().getAdmin()) { | ||
| ServerName server = UTIL2.getHBaseCluster().getRegionServer(0).getServerName(); | ||
| ReplicationLoadSink loadSink = getLatestSinkMetric(hbaseAdmin, server); | ||
| //First checks if status of timestamp of last applied op is same as RS start, since no edits | ||
| //were replicated yet | ||
| assertEquals(loadSink.getTimestampStarted(), loadSink.getTimestampsOfLastAppliedOp()); | ||
| //now insert some rows on source, so that it gets delivered to target | ||
| insertRowsOnSource(); | ||
| long wait = Waiter.waitFor(UTIL2.getConfiguration(), | ||
| 100000, new Waiter.Predicate<Exception>() { | ||
|
||
| @Override | ||
| public boolean evaluate() throws Exception { | ||
| ReplicationLoadSink loadSink = getLatestSinkMetric(hbaseAdmin, server); | ||
| return loadSink.getTimestampsOfLastAppliedOp()>loadSink.getTimestampStarted(); | ||
| } | ||
| }); | ||
| //If wait is -1, we know predicate condition was never true | ||
| assertTrue(wait>=0); | ||
| } | ||
| } | ||
|
|
||
| private ReplicationLoadSink getLatestSinkMetric(Admin admin, ServerName server) | ||
| throws IOException { | ||
| ClusterMetrics metrics = admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)); | ||
| ServerMetrics sm = metrics.getLiveServerMetrics().get(server); | ||
| return sm.getReplicationLoadSink(); | ||
| } | ||
| /** | ||
| * Wait until Master shows metrics counts for ReplicationLoadSourceList that are | ||
| * greater than <code>greaterThan</code> for <code>serverName</code> before | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.