-
Notifications
You must be signed in to change notification settings - Fork 15k
KAFKA-7080: replace numSegments with segmentInterval #5257
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,16 +112,6 @@ public void untilShouldSetMaintainDuration() { | |
| assertEquals(windowSize, windowSpec.until(windowSize).maintainMs()); | ||
| } | ||
|
|
||
| @Test | ||
| public void shouldUseWindowSizeForMaintainDurationWhenSizeLargerThanDefaultMaintainMs() { | ||
| final long size = Windows.DEFAULT_MAINTAIN_DURATION_MS; | ||
|
|
||
| final JoinWindows windowSpec = JoinWindows.of(size); | ||
| final long windowSize = windowSpec.size(); | ||
|
|
||
| assertEquals(windowSize, windowSpec.maintainMs()); | ||
| } | ||
|
|
||
|
||
| @Test | ||
| public void retentionTimeMustNoBeSmallerThanWindowSize() { | ||
| final JoinWindows windowSpec = JoinWindows.of(anySize); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,10 +32,10 @@ | |
| import org.apache.kafka.common.serialization.Serde; | ||
| import org.apache.kafka.common.serialization.Serdes; | ||
| import org.apache.kafka.common.utils.Utils; | ||
| import org.apache.kafka.streams.kstream.Consumed; | ||
| import org.apache.kafka.streams.KafkaStreams; | ||
| import org.apache.kafka.streams.StreamsBuilder; | ||
| import org.apache.kafka.streams.StreamsConfig; | ||
| import org.apache.kafka.streams.kstream.Consumed; | ||
| import org.apache.kafka.streams.kstream.ForeachAction; | ||
| import org.apache.kafka.streams.kstream.JoinWindows; | ||
| import org.apache.kafka.streams.kstream.KStream; | ||
|
|
@@ -469,13 +469,18 @@ private void processStreamWithWindowStore(final String topic) { | |
| setStreamProperties("simple-benchmark-streams-with-store"); | ||
|
|
||
| final StreamsBuilder builder = new StreamsBuilder(); | ||
| final StoreBuilder<WindowStore<Integer, byte[]>> storeBuilder | ||
| = Stores.windowStoreBuilder(Stores.persistentWindowStore("store", | ||
|
|
||
| final StoreBuilder<WindowStore<Integer, byte[]>> storeBuilder = Stores.windowStoreBuilder( | ||
| Stores.persistentWindowStore( | ||
| "store", | ||
| AGGREGATE_WINDOW_SIZE * 3, | ||
| 3, | ||
| AGGREGATE_WINDOW_SIZE, | ||
| false), | ||
| INTEGER_SERDE, BYTE_SERDE); | ||
| false, | ||
| 60_000L | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the arithmetic solution of the previous formula |
||
| ), | ||
| INTEGER_SERDE, | ||
| BYTE_SERDE | ||
| ); | ||
| builder.addStateStore(storeBuilder.withCachingEnabled()); | ||
|
|
||
| final KStream<Integer, byte[]> source = builder.stream(topic); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -532,7 +532,15 @@ public void shouldAddInternalTopicConfigForWindowStores() { | |
| builder.setApplicationId("appId"); | ||
| builder.addSource(null, "source", null, null, null, "topic"); | ||
| builder.addProcessor("processor", new MockProcessorSupplier(), "source"); | ||
| builder.addStateStore(Stores.windowStoreBuilder(Stores.persistentWindowStore("store", 30000, 3, 10000, false), Serdes.String(), Serdes.String()), "processor"); | ||
|
|
||
| builder.addStateStore( | ||
| Stores.windowStoreBuilder( | ||
| Stores.persistentWindowStore("store", 30_000L, 10_000L, false), | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in cases like this where we didn't actually care how many segments or what segment interval, I substituted in the new |
||
| Serdes.String(), | ||
| Serdes.String() | ||
| ), | ||
| "processor" | ||
| ); | ||
| final Map<Integer, InternalTopologyBuilder.TopicsInfo> topicGroups = builder.topicGroups(); | ||
| final InternalTopologyBuilder.TopicsInfo topicsInfo = topicGroups.values().iterator().next(); | ||
| final InternalTopicConfig topicConfig = topicsInfo.stateChangelogTopics.get("appId-store-changelog"); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixes a lurking potential bug: using a mutable field in equals/hashcode.