HBASE-23165 [hbtop] Some modifications from HBASE-22988 (#987)
Signed-off-by: stack <stack@apache.org>
This commit is contained in:
parent
c473f355fc
commit
79e799ab7b
|
@ -673,7 +673,10 @@ elif [ "$COMMAND" = "hbtop" ] ; then
|
|||
done
|
||||
fi
|
||||
|
||||
HBASE_OPTS="${HBASE_OPTS} -Dlog4j.configuration=file:${HBASE_HOME}/conf/log4j-hbtop.properties"
|
||||
if [ -f "${HBASE_HOME}/conf/log4j-hbtop.properties" ] ; then
|
||||
HBASE_HBTOP_OPTS="${HBASE_HBTOP_OPTS} -Dlog4j.configuration=file:${HBASE_HOME}/conf/log4j-hbtop.properties"
|
||||
fi
|
||||
HBASE_OPTS="${HBASE_OPTS} ${HBASE_HBTOP_OPTS}"
|
||||
else
|
||||
CLASS=$COMMAND
|
||||
fi
|
||||
|
|
|
@ -24,4 +24,4 @@ log4j.appender.console.layout=org.apache.log4j.PatternLayout
|
|||
log4j.appender.console.layout.ConversionPattern=%d{ISO8601} %-5p [%t] %c{2}: %m%n
|
||||
|
||||
# ZooKeeper will still put stuff at WARN
|
||||
log4j.logger.org.apache.zookeeper=ERROR
|
||||
log4j.logger.org.apache.zookeeper=ERROR
|
||||
|
|
|
@ -55,6 +55,9 @@ public final class RecordFilter {
|
|||
return parse(filterString, Arrays.asList(Field.values()), ignoreCase);
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse a filter string and build a RecordFilter instance.
|
||||
*/
|
||||
public static RecordFilter parse(String filterString, List<Field> fields, boolean ignoreCase) {
|
||||
int index = 0;
|
||||
|
||||
|
|
|
@ -41,13 +41,14 @@ public class RequestCountPerSecond {
|
|||
previousFilteredReadRequestCount = filteredReadRequestCount;
|
||||
previousWriteRequestCount = writeRequestCount;
|
||||
} else if (previousLastReportTimestamp != lastReportTimestamp) {
|
||||
readRequestCountPerSecond = (readRequestCount - previousReadRequestCount) /
|
||||
((lastReportTimestamp - previousLastReportTimestamp) / 1000);
|
||||
long delta = (lastReportTimestamp - previousLastReportTimestamp) / 1000;
|
||||
if (delta < 1) {
|
||||
delta = 1;
|
||||
}
|
||||
readRequestCountPerSecond = (readRequestCount - previousReadRequestCount) / delta;
|
||||
filteredReadRequestCountPerSecond =
|
||||
(filteredReadRequestCount - previousFilteredReadRequestCount) /
|
||||
((lastReportTimestamp - previousLastReportTimestamp) / 1000);
|
||||
writeRequestCountPerSecond = (writeRequestCount - previousWriteRequestCount) /
|
||||
((lastReportTimestamp - previousLastReportTimestamp) / 1000);
|
||||
(filteredReadRequestCount - previousFilteredReadRequestCount) / delta;
|
||||
writeRequestCountPerSecond = (writeRequestCount - previousWriteRequestCount) / delta;
|
||||
|
||||
previousLastReportTimestamp = lastReportTimestamp;
|
||||
previousReadRequestCount = readRequestCount;
|
||||
|
|
|
@ -129,10 +129,10 @@ public class FieldScreenView extends AbstractScreenView {
|
|||
}
|
||||
}
|
||||
|
||||
public void showScreenDescription(String sortKeyHeader) {
|
||||
public void showScreenDescription(String sortFieldHeader) {
|
||||
TerminalPrinter printer = getTerminalPrinter(SCREEN_DESCRIPTION_START_ROW);
|
||||
printer.startBold().print("Fields Management").stopBold().endOfLine();
|
||||
printer.print("Current Sort Field: ").startBold().print(sortKeyHeader).stopBold().endOfLine();
|
||||
printer.print("Current Sort Field: ").startBold().print(sortFieldHeader).stopBold().endOfLine();
|
||||
printer.print("Navigate with up/down, Right selects for move then <Enter> or Left commits,")
|
||||
.endOfLine();
|
||||
printer.print("'d' or <Space> toggles display, 's' sets sort. Use 'q' or <Esc> to end!")
|
||||
|
|
|
@ -234,8 +234,8 @@ public class TopScreenPresenter {
|
|||
return new FieldScreenView(screen, terminal,
|
||||
topScreenModel.getCurrentSortField(), topScreenModel.getFields(),
|
||||
fieldDisplayMap,
|
||||
(sortKey, fields, fieldDisplayMap) -> {
|
||||
topScreenModel.setSortFieldAndFields(sortKey, fields);
|
||||
(sortField, fields, fieldDisplayMap) -> {
|
||||
topScreenModel.setSortFieldAndFields(sortField, fields);
|
||||
this.fieldDisplayMap.clear();
|
||||
this.fieldDisplayMap.putAll(fieldDisplayMap);
|
||||
}, topScreenView);
|
||||
|
|
|
@ -30,11 +30,11 @@ import org.junit.experimental.categories.Category;
|
|||
|
||||
|
||||
@Category(SmallTests.class)
|
||||
public class RecordTest {
|
||||
public class TestRecord {
|
||||
|
||||
@ClassRule
|
||||
public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(RecordTest.class);
|
||||
HBaseClassTestRule.forClass(TestRecord.class);
|
||||
|
||||
@Test
|
||||
public void testBuilder() {
|
|
@ -38,11 +38,11 @@ import org.junit.experimental.categories.Category;
|
|||
|
||||
|
||||
@Category(SmallTests.class)
|
||||
public class RecordFilterTest {
|
||||
public class TestRecordFilter {
|
||||
|
||||
@ClassRule
|
||||
public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(RecordFilterTest.class);
|
||||
HBaseClassTestRule.forClass(TestRecordFilter.class);
|
||||
|
||||
@Test
|
||||
public void testParseAndBuilder() {
|
|
@ -232,7 +232,7 @@ public final class TestUtils {
|
|||
long requestCountPerSecond, long readRequestCountPerSecond,
|
||||
long filteredReadRequestCountPerSecond, long writeCountRequestPerSecond,
|
||||
Size storeFileSize, Size uncompressedStoreFileSize, int numStoreFiles,
|
||||
Size memStoreSize, float Locality, String startKey, long compactingCellCount,
|
||||
Size memStoreSize, float locality, String startKey, long compactingCellCount,
|
||||
long compactedCellCount, float compactionProgress, String lastMajorCompactionTime) {
|
||||
assertThat(record.size(), is(22));
|
||||
assertThat(record.get(Field.NAMESPACE).asString(), is(namespace));
|
||||
|
@ -255,7 +255,7 @@ public final class TestUtils {
|
|||
is(uncompressedStoreFileSize));
|
||||
assertThat(record.get(Field.NUM_STORE_FILES).asInt(), is(numStoreFiles));
|
||||
assertThat(record.get(Field.MEM_STORE_SIZE).asSize(), is(memStoreSize));
|
||||
assertThat(record.get(Field.LOCALITY).asFloat(), is(Locality));
|
||||
assertThat(record.get(Field.LOCALITY).asFloat(), is(locality));
|
||||
assertThat(record.get(Field.START_KEY).asString(), is(startKey));
|
||||
assertThat(record.get(Field.COMPACTING_CELL_COUNT).asLong(), is(compactingCellCount));
|
||||
assertThat(record.get(Field.COMPACTED_CELL_COUNT).asLong(), is(compactedCellCount));
|
||||
|
|
|
@ -30,11 +30,11 @@ import org.junit.experimental.categories.Category;
|
|||
|
||||
|
||||
@Category(SmallTests.class)
|
||||
public class FieldValueTest {
|
||||
public class TestFieldValue {
|
||||
|
||||
@ClassRule
|
||||
public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(FieldValueTest.class);
|
||||
HBaseClassTestRule.forClass(TestFieldValue.class);
|
||||
|
||||
@Test
|
||||
public void testParseAndAsSomethingMethod() {
|
|
@ -32,10 +32,10 @@ import org.junit.ClassRule;
|
|||
import org.junit.experimental.categories.Category;
|
||||
|
||||
@Category(SmallTests.class)
|
||||
public class ClientModeTest extends ModeTestBase {
|
||||
public class TestClientMode extends TestModeBase {
|
||||
|
||||
@ClassRule public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(ClientModeTest.class);
|
||||
HBaseClassTestRule.forClass(TestClientMode.class);
|
||||
|
||||
@Override protected Mode getMode() {
|
||||
return Mode.CLIENT;
|
|
@ -23,7 +23,7 @@ import org.apache.hadoop.hbase.hbtop.TestUtils;
|
|||
import org.junit.Test;
|
||||
|
||||
|
||||
public abstract class ModeTestBase {
|
||||
public abstract class TestModeBase {
|
||||
|
||||
@Test
|
||||
public void testGetRecords() {
|
|
@ -32,11 +32,11 @@ import org.junit.experimental.categories.Category;
|
|||
|
||||
|
||||
@Category(SmallTests.class)
|
||||
public class NamespaceModeTest extends ModeTestBase {
|
||||
public class TestNamespaceMode extends TestModeBase {
|
||||
|
||||
@ClassRule
|
||||
public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(NamespaceModeTest.class);
|
||||
HBaseClassTestRule.forClass(TestNamespaceMode.class);
|
||||
|
||||
@Override
|
||||
protected Mode getMode() {
|
|
@ -31,11 +31,11 @@ import org.junit.experimental.categories.Category;
|
|||
|
||||
|
||||
@Category(SmallTests.class)
|
||||
public class RegionModeTest extends ModeTestBase {
|
||||
public class TestRegionMode extends TestModeBase {
|
||||
|
||||
@ClassRule
|
||||
public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(RegionModeTest.class);
|
||||
HBaseClassTestRule.forClass(TestRegionMode.class);
|
||||
|
||||
@Override
|
||||
protected Mode getMode() {
|
|
@ -32,11 +32,11 @@ import org.junit.experimental.categories.Category;
|
|||
|
||||
|
||||
@Category(SmallTests.class)
|
||||
public class RegionServerModeTest extends ModeTestBase {
|
||||
public class TestRegionServerMode extends TestModeBase {
|
||||
|
||||
@ClassRule
|
||||
public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(RegionServerModeTest.class);
|
||||
HBaseClassTestRule.forClass(TestRegionServerMode.class);
|
||||
|
||||
@Override
|
||||
protected Mode getMode() {
|
|
@ -28,11 +28,11 @@ import org.junit.experimental.categories.Category;
|
|||
|
||||
|
||||
@Category(SmallTests.class)
|
||||
public class RequestCountPerSecondTest {
|
||||
public class TestRequestCountPerSecond {
|
||||
|
||||
@ClassRule
|
||||
public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(RequestCountPerSecondTest.class);
|
||||
HBaseClassTestRule.forClass(TestRequestCountPerSecond.class);
|
||||
|
||||
@Test
|
||||
public void test() {
|
|
@ -32,11 +32,11 @@ import org.junit.experimental.categories.Category;
|
|||
|
||||
|
||||
@Category(SmallTests.class)
|
||||
public class TableModeTest extends ModeTestBase {
|
||||
public class TestTableMode extends TestModeBase {
|
||||
|
||||
@ClassRule
|
||||
public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(TableModeTest.class);
|
||||
HBaseClassTestRule.forClass(TestTableMode.class);
|
||||
|
||||
@Override
|
||||
protected Mode getMode() {
|
|
@ -32,11 +32,11 @@ import org.junit.ClassRule;
|
|||
import org.junit.experimental.categories.Category;
|
||||
|
||||
@Category(SmallTests.class)
|
||||
public class UserModeTest extends ModeTestBase {
|
||||
public class TestUserMode extends TestModeBase {
|
||||
|
||||
@ClassRule
|
||||
public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(UserModeTest.class);
|
||||
HBaseClassTestRule.forClass(TestUserMode.class);
|
||||
|
||||
@Override
|
||||
protected Mode getMode() {
|
|
@ -47,11 +47,11 @@ import org.mockito.runners.MockitoJUnitRunner;
|
|||
|
||||
@Category(SmallTests.class)
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class FieldScreenPresenterTest {
|
||||
public class TestFieldScreenPresenter {
|
||||
|
||||
@ClassRule
|
||||
public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(FieldScreenPresenterTest.class);
|
||||
HBaseClassTestRule.forClass(TestFieldScreenPresenter.class);
|
||||
|
||||
@Mock
|
||||
private FieldScreenView fieldScreenView;
|
|
@ -37,11 +37,11 @@ import org.mockito.runners.MockitoJUnitRunner;
|
|||
|
||||
@Category(SmallTests.class)
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class HelpScreenPresenterTest {
|
||||
public class TestHelpScreenPresenter {
|
||||
|
||||
@ClassRule
|
||||
public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(HelpScreenPresenterTest.class);
|
||||
HBaseClassTestRule.forClass(TestHelpScreenPresenter.class);
|
||||
|
||||
private static final long TEST_REFRESH_DELAY = 5;
|
||||
|
|
@ -40,11 +40,11 @@ import org.mockito.runners.MockitoJUnitRunner;
|
|||
|
||||
@Category(SmallTests.class)
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class ModeScreenPresenterTest {
|
||||
public class TestModeScreenPresenter {
|
||||
|
||||
@ClassRule
|
||||
public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(ModeScreenPresenterTest.class);
|
||||
HBaseClassTestRule.forClass(TestModeScreenPresenter.class);
|
||||
|
||||
@Mock
|
||||
private ModeScreenView modeScreenView;
|
|
@ -42,11 +42,11 @@ import org.mockito.runners.MockitoJUnitRunner;
|
|||
|
||||
@Category(SmallTests.class)
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class FilterDisplayModeScreenPresenterTest {
|
||||
public class TestFilterDisplayModeScreenPresenter {
|
||||
|
||||
@ClassRule
|
||||
public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(FilterDisplayModeScreenPresenterTest.class);
|
||||
HBaseClassTestRule.forClass(TestFilterDisplayModeScreenPresenter.class);
|
||||
|
||||
@Mock
|
||||
private FilterDisplayModeScreenView filterDisplayModeScreenView;
|
|
@ -43,11 +43,11 @@ import org.mockito.runners.MockitoJUnitRunner;
|
|||
|
||||
@Category(SmallTests.class)
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class InputModeScreenPresenterTest {
|
||||
public class TestInputModeScreenPresenter {
|
||||
|
||||
@ClassRule
|
||||
public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(InputModeScreenPresenterTest.class);
|
||||
HBaseClassTestRule.forClass(TestInputModeScreenPresenter.class);
|
||||
|
||||
private static final String TEST_INPUT_MESSAGE = "test input message";
|
||||
|
|
@ -35,11 +35,11 @@ import org.mockito.runners.MockitoJUnitRunner;
|
|||
|
||||
@Category(SmallTests.class)
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class MessageModeScreenPresenterTest {
|
||||
public class TestMessageModeScreenPresenter {
|
||||
|
||||
@ClassRule
|
||||
public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(MessageModeScreenPresenterTest.class);
|
||||
HBaseClassTestRule.forClass(TestMessageModeScreenPresenter.class);
|
||||
|
||||
private static final String TEST_MESSAGE = "test message";
|
||||
|
|
@ -28,11 +28,11 @@ import org.junit.experimental.categories.Category;
|
|||
|
||||
|
||||
@Category(SmallTests.class)
|
||||
public class PagingTest {
|
||||
public class TestPaging {
|
||||
|
||||
@ClassRule
|
||||
public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(PagingTest.class);
|
||||
HBaseClassTestRule.forClass(TestPaging.class);
|
||||
|
||||
@Test
|
||||
public void testArrowUpAndArrowDown() {
|
|
@ -47,11 +47,11 @@ import org.mockito.runners.MockitoJUnitRunner;
|
|||
|
||||
@Category(SmallTests.class)
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class TopScreenModelTest {
|
||||
public class TestTopScreenModel {
|
||||
|
||||
@ClassRule
|
||||
public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(TopScreenModelTest.class);
|
||||
HBaseClassTestRule.forClass(TestTopScreenModel.class);
|
||||
|
||||
@Mock
|
||||
private Admin admin;
|
|
@ -45,11 +45,11 @@ import org.mockito.runners.MockitoJUnitRunner;
|
|||
|
||||
@Category(SmallTests.class)
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class TopScreenPresenterTest {
|
||||
public class TestTopScreenPresenter {
|
||||
|
||||
@ClassRule
|
||||
public static final HBaseClassTestRule CLASS_RULE =
|
||||
HBaseClassTestRule.forClass(TopScreenPresenterTest.class);
|
||||
HBaseClassTestRule.forClass(TestTopScreenPresenter.class);
|
||||
|
||||
private static final List<FieldInfo> TEST_FIELD_INFOS = Arrays.asList(
|
||||
new FieldInfo(Field.REGION, 10, true),
|
|
@ -15,15 +15,17 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.hbase.hbtop.terminal;
|
||||
package org.apache.hadoop.hbase.hbtop.terminal.impl;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.apache.hadoop.hbase.hbtop.terminal.impl.TerminalImpl;
|
||||
|
||||
import org.apache.hadoop.hbase.hbtop.terminal.KeyPress;
|
||||
import org.apache.hadoop.hbase.hbtop.terminal.Terminal;
|
||||
|
||||
|
||||
public final class CursorTest {
|
||||
public final class TestCursor {
|
||||
|
||||
private CursorTest() {
|
||||
private TestCursor() {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
|
@ -15,15 +15,17 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.hbase.hbtop.terminal;
|
||||
package org.apache.hadoop.hbase.hbtop.terminal.impl;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.apache.hadoop.hbase.hbtop.terminal.impl.TerminalImpl;
|
||||
|
||||
import org.apache.hadoop.hbase.hbtop.terminal.KeyPress;
|
||||
import org.apache.hadoop.hbase.hbtop.terminal.Terminal;
|
||||
|
||||
|
||||
public final class KeyPressTest {
|
||||
public final class TestKeyPress {
|
||||
|
||||
private KeyPressTest() {
|
||||
private TestKeyPress() {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
|
@ -15,15 +15,18 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.apache.hadoop.hbase.hbtop.terminal;
|
||||
package org.apache.hadoop.hbase.hbtop.terminal.impl;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import org.apache.hadoop.hbase.hbtop.terminal.impl.TerminalImpl;
|
||||
|
||||
import org.apache.hadoop.hbase.hbtop.terminal.KeyPress;
|
||||
import org.apache.hadoop.hbase.hbtop.terminal.Terminal;
|
||||
import org.apache.hadoop.hbase.hbtop.terminal.TerminalPrinter;
|
||||
|
||||
|
||||
public final class TerminalPrinterTest {
|
||||
public final class TestTerminalPrinter {
|
||||
|
||||
private TerminalPrinterTest() {
|
||||
private TestTerminalPrinter() {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
Loading…
Reference in New Issue