Skip to content

Commit 6c960ec

Browse files
committed
Add timing to test logging
1 parent 7d44617 commit 6c960ec

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationIT.java

+34-3
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
package org.apache.accumulo.test.functional;
2020

21+
import static java.util.concurrent.TimeUnit.MILLISECONDS;
22+
2123
import java.time.Duration;
2224
import java.util.HashMap;
2325
import java.util.Map;
@@ -26,7 +28,9 @@
2628
import org.apache.accumulo.core.client.AccumuloClient;
2729
import org.apache.accumulo.core.client.admin.NewTableConfiguration;
2830
import org.apache.accumulo.core.client.admin.TabletAvailability;
31+
import org.apache.accumulo.core.client.admin.servers.ServerId;
2932
import org.apache.accumulo.core.conf.Property;
33+
import org.apache.accumulo.core.util.Timer;
3034
import org.apache.accumulo.harness.AccumuloClusterHarness;
3135
import org.apache.accumulo.minicluster.ServerType;
3236
import org.apache.accumulo.test.VerifyIngest;
@@ -58,16 +62,30 @@ protected Duration defaultTimeout() {
5862
@BeforeEach
5963
public void alterConfig() throws Exception {
6064
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
65+
final int initialTserverCount =
66+
client.instanceOperations().getServers(ServerId.Type.TABLET_SERVER).size();
67+
log.info("Tserver count: {}", initialTserverCount);
68+
Timer timer = Timer.startNew();
6169
getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
70+
Wait.waitFor(
71+
() -> client.instanceOperations().getServers(ServerId.Type.TABLET_SERVER).isEmpty(),
72+
120_000);
73+
log.info("Took {} ms to stop all tservers", timer.elapsed(MILLISECONDS));
74+
timer.restart();
6275
getClusterControl().startAllServers(ServerType.TABLET_SERVER);
76+
Wait.waitFor(() -> client.instanceOperations().getServers(ServerId.Type.TABLET_SERVER).size()
77+
< initialTserverCount, 120_000);
78+
log.info("Took {} ms to start all tservers", timer.elapsed(MILLISECONDS));
6379

6480
FileSystem fs = cluster.getFileSystem();
6581
testDir = new Path(cluster.getTemporaryPath(), "testmf");
6682
fs.deleteOnExit(testDir);
83+
84+
timer.restart();
6785
FunctionalTestUtils.createRFiles(client, fs, testDir.toString(), ROWS, SPLITS, 8);
86+
long elapsed = timer.elapsed(MILLISECONDS);
6887
FileStatus[] stats = fs.listStatus(testDir);
69-
70-
log.info("Number of generated files: {}", stats.length);
88+
log.info("Generated {} files in {} ms", stats.length, elapsed);
7189
}
7290
}
7391

@@ -82,24 +100,35 @@ public void resetConfig() throws Exception {
82100

83101
@Test
84102
public void testBulkSplitOptimization() throws Exception {
103+
log.info("Starting BulkSplitOptimizationIT test");
85104
try (AccumuloClient c = Accumulo.newClient().from(getClientProps()).build()) {
105+
86106
final String tableName = getUniqueNames(1)[0];
87107
Map<String,String> tableProps = new HashMap<>();
88108
tableProps.put(Property.TABLE_MAJC_RATIO.getKey(), "1000");
89109
tableProps.put(Property.TABLE_FILE_MAX.getKey(), "1000");
90110
tableProps.put(Property.TABLE_SPLIT_THRESHOLD.getKey(), "1G");
111+
112+
log.info("Creating table {}", tableName);
113+
Timer timer = Timer.startNew();
91114
c.tableOperations().create(tableName, new NewTableConfiguration().setProperties(tableProps)
92115
.withInitialTabletAvailability(TabletAvailability.HOSTED));
116+
log.info("Created table in {} ms. Starting bulk import", timer.elapsed(MILLISECONDS));
93117

94-
log.info("Starting bulk import");
118+
timer.restart();
95119
c.tableOperations().importDirectory(testDir.toString()).to(tableName).load();
120+
log.info("Imported into table {} in {} ms", tableName, timer.elapsed(MILLISECONDS));
96121

122+
timer.restart();
97123
FunctionalTestUtils.checkSplits(c, tableName, 0, 0);
98124
FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 100, 100);
125+
log.info("Checked splits and rfiles in {} ms", timer.elapsed(MILLISECONDS));
99126

100127
log.info("Lowering split threshold to 100K to initiate splits");
101128
c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "100K");
102129

130+
timer.restart();
131+
103132
// wait until over split threshold -- should be 78 splits
104133
Wait.waitFor(() -> {
105134
try {
@@ -114,6 +143,8 @@ public void testBulkSplitOptimization() throws Exception {
114143
return true;
115144
});
116145

146+
log.info("Took {} ms for split count to reach expected range", timer.elapsed(MILLISECONDS));
147+
117148
VerifyParams params = new VerifyParams(getClientProps(), tableName, ROWS);
118149
params.timestamp = 1;
119150
params.dataSize = 50;

0 commit comments

Comments
 (0)