xiangfu0 commented on code in PR #20085:
URL: https://github.com/apache/pinot/pull/20085#discussion_r4465827511
##########
pinot-core/src/test/java/org/apache/pinot/core/data/manager/realtime/RealtimeSegmentDataManagerTest.java:
##########
@@ -102,10 +106,44 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
// TODO Re-write this test using the stream abstraction
public class RealtimeSegmentDataManagerTest {
+ @Test
+ public void testReadinessGateRechecksUnlessTheConsumerHasBeenStopped()
Review Comment:
Because the first readiness check returns false, `PartitionConsumer.run()`
sleeps the real `READY_TO_CONSUME_DATA_CHECK_INTERVAL_MS` (5 s) in both loop
iterations, adding about 10 s of wall time to the Core worker. It isn't flaky,
but it works against the goal of shortening that shard. Could this path be
tested without the real sleep?
##########
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/DimensionTableIntegrationTest.java:
##########
@@ -111,50 +161,127 @@ protected long getCountStarResult() {
return 1000;
}
- @BeforeClass
- public void setUp()
+ @Override
+ protected void setUpTable()
throws Exception {
- LOGGER.warn("Setting up integration test class: {}",
getClass().getSimpleName());
- TestUtils.ensureDirectoriesExistAndEmpty(_tempDir, _segmentDir, _tarDir);
+ // Dimension managers are JVM-wide singletons. Preserve the original
one-server placement without changing
+ // existing server tags or starting another server in the shared cluster.
+ assertTrue(getSharedHelixResourceManager().getHelixAdmin()
+ .getInstancesInClusterWithTag(getHelixClusterName(),
SERVER_TAG).isEmpty());
+ String serverInstance = getSharedServerStarters().get(0).getInstanceId();
+ getSharedHelixResourceManager().getHelixAdmin()
+ .addInstanceTag(getHelixClusterName(), serverInstance, SERVER_TAG);
+ _taggedServerInstance = serverInstance;
- startZk();
- startController();
- startBroker();
- startServer();
-
- TestUtils.ensureDirectoriesExistAndEmpty(_tempDir, _segmentDir, _tarDir);
Schema schema = createSchema();
addSchema(schema);
List<File> avroFiles = createAvroFiles();
TableConfig tableConfig = createOfflineTableConfig();
addTableConfig(tableConfig);
- ClusterIntegrationTestUtils.buildSegmentsFromAvro(avroFiles, tableConfig,
schema, 0, _segmentDir, _tarDir);
- uploadSegments(getTableName(), _tarDir);
+ // Give duplicate primary keys an equal creation time so loading both
segments exercises segment-name ordering.
+ _segmentCreationTime = System.currentTimeMillis();
+ List<File> segmentTarFiles = new ArrayList<>();
+ for (int i = 0; i < avroFiles.size(); i++) {
+ SegmentGeneratorConfig config = new SegmentGeneratorConfig(tableConfig,
schema);
+ config.setFormat(FileFormat.AVRO);
+ config.setInputFilePath(avroFiles.get(i).getPath());
+ config.setOutDir(_segmentDir.getPath());
+ config.setTableName(tableConfig.getTableName());
+ config.setSegmentNamePostfix(i + " %");
Review Comment:
This migration also changes what the test covers: segment names now contain
a space and `%`, one segment goes through the METADATA upload path, and both
segments share a creation time. That may be worthwhile, but it goes beyond
moving the fixture. Could you mention it in the PR description, or move it to a
follow-up, so the fixture move can be reviewed on its own?
##########
pinot-tools/src/test/java/org/apache/pinot/tools/admin/command/AdminCommandCleanupTest.java:
##########
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.tools.admin.command;
+
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+
+
+/// Verifies cleanup is safe before execution and preserves reusable command
configuration.
+public class AdminCommandCleanupTest {
Review Comment:
`DeleteSchemaCommand.cleanup()` and `StartBrokerCommand.cleanup()` have
empty bodies, so these tests only check that `toString` and the getters are
stable. The same applies to most commands in
`TestCommandHelp.testHelpOnlyCommandsCanBeCleanedUpAndReused`. Consider
dropping them, or pointing them at a command with real cleanup logic.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]