Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,21 @@ package kafka.server

import java.io.File

import kafka.common.{InconsistentBrokerMetadataException, InconsistentClusterIdException}

import scala.collection.Seq
import scala.concurrent._
import ExecutionContext.Implicits._
import scala.concurrent.duration._
import ExecutionContext.Implicits._

import kafka.common.{InconsistentBrokerMetadataException, InconsistentClusterIdException}
import kafka.utils.TestUtils
import kafka.zk.ZooKeeperTestHarness

import org.junit.Assert._
import org.junit.{After, Before, Test}
import org.scalatest.Assertions.assertThrows
import org.apache.kafka.test.TestUtils.isValidClusterId

import scala.collection.Seq

class ServerGenerateClusterIdTest extends ZooKeeperTestHarness {
var config1: KafkaConfig = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,11 @@ public void before() throws Exception {

streamsConfiguration.put(StreamsConfig.APPLICATION_ID_CONFIG, applicationId);
streamsConfiguration.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers());
streamsConfiguration.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");
streamsConfiguration.put(StreamsConfig.STATE_DIR_CONFIG, TestUtils.tempDirectory("state-" + applicationId).getPath());
streamsConfiguration.put(StreamsConfig.DEFAULT_KEY_SERDE_CLASS_CONFIG, Serdes.String().getClass());
streamsConfiguration.put(StreamsConfig.DEFAULT_VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass());
streamsConfiguration.put(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG, 100);
streamsConfiguration.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");

stringComparator = Comparator.comparing((KeyValue<String, String> o) -> o.key).thenComparing(o -> o.value);
stringLongComparator = Comparator.comparing((KeyValue<String, Long> o) -> o.key).thenComparingLong(o -> o.value);
Expand Down Expand Up @@ -631,7 +631,11 @@ public void shouldAllowConcurrentAccesses() throws Exception {
final String storeName = "word-count-store";
final String windowStoreName = "windowed-word-count-store";

final ProducerRunnable producerRunnable = new ProducerRunnable(streamConcurrent, inputValues, numIterations);
// send one round of records first to populate the stores
ProducerRunnable producerRunnable = new ProducerRunnable(streamThree, inputValues, 1);
producerRunnable.run();

producerRunnable = new ProducerRunnable(streamConcurrent, inputValues, numIterations);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be numIterations - 1

final Thread producerThread = new Thread(producerRunnable);
kafkaStreams = createCountStream(
streamConcurrent,
Expand Down Expand Up @@ -1262,6 +1266,7 @@ public void run() {
}
incrementIteration();
}
producer.flush();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The producer is create using try-with-resource clause thus, the producer should be flushed on the implicit close() anyway? Thus, I don't think explicit flushing would help?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, will fix.

}
}
}
Expand Down