You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "mjsax (via GitHub)" <gi...@apache.org> on 2026/03/19 23:50:37 UTC
[PR] MINOR: simplify window-byte-store-supplier [kafka]
mjsax opened a new pull request, #21829:
URL: https://github.com/apache/kafka/pull/21829
This PR removes an unnecessary "duplicated" constructor for RocksDbWindowBytesStoreSupplier, and unifies the caller stack to re-use more shared code.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: simplify window-byte-store-supplier [kafka]
Posted by "DL1231 (via GitHub)" <gi...@apache.org>.
DL1231 commented on code in PR #21829:
URL: https://github.com/apache/kafka/pull/21829#discussion_r2963614121
##########
streams/src/main/java/org/apache/kafka/streams/state/Stores.java:
##########
@@ -378,38 +364,21 @@ private static WindowBytesStoreSupplier persistentWindowStore(final String name,
final long defaultSegmentInterval = Math.max(retentionMs / 2, 60_000L);
- return persistentWindowStore(name, retentionMs, windowSizeMs, retainDuplicates, defaultSegmentInterval, timestampedStore);
- }
-
- private static WindowBytesStoreSupplier persistentWindowStore(final String name,
- final long retentionPeriod,
- final long windowSize,
- final boolean retainDuplicates,
- final long segmentInterval,
- final boolean timestampedStore) {
- Objects.requireNonNull(name, "name cannot be null");
- if (retentionPeriod < 0L) {
+ if (retentionMs < 0L) {
throw new IllegalArgumentException("retentionPeriod cannot be negative");
}
- if (windowSize < 0L) {
+ if (windowSizeMs < 0L) {
throw new IllegalArgumentException("windowSize cannot be negative");
}
- if (segmentInterval < 1L) {
- throw new IllegalArgumentException("segmentInterval cannot be zero or negative");
- }
- if (windowSize > retentionPeriod) {
Review Comment:
`windowSize > retentionPeriod` validation was dropped.
Note that `RocksDbIndexedTimeOrderedWindowBytesStoreSupplier.create()` still keeps this exact validation (line 66-69), so it seems like an unintentional omission.
##########
streams/src/main/java/org/apache/kafka/streams/state/Stores.java:
##########
@@ -348,28 +348,14 @@ public static WindowBytesStoreSupplier persistentTimestampedWindowStoreWithHeade
final Duration retentionPeriod,
final Duration windowSize,
final boolean retainDuplicates) throws IllegalArgumentException {
- Objects.requireNonNull(name, "name cannot be null");
- final String rpMsgPrefix = prepareMillisCheckFailMsgPrefix(retentionPeriod, "retentionPeriod");
- final long retentionMs = validateMillisecondDuration(retentionPeriod, rpMsgPrefix);
- final String wsMsgPrefix = prepareMillisCheckFailMsgPrefix(windowSize, "windowSize");
- final long windowSizeMs = validateMillisecondDuration(windowSize, wsMsgPrefix);
-
- final long defaultSegmentInterval = Math.max(retentionMs / 2, 60_000L);
-
- return new RocksDbWindowBytesStoreSupplier(
- name,
- retentionMs,
- defaultSegmentInterval,
- windowSizeMs,
- retainDuplicates,
- RocksDbWindowBytesStoreSupplier.WindowStoreTypes.TIMESTAMPED_WINDOW_STORE_WITH_HEADERS);
+ return persistentWindowStore(name, retentionPeriod, windowSize, retainDuplicates, RocksDbWindowBytesStoreSupplier.WindowStoreTypes.TIMESTAMPED_WINDOW_STORE_WITH_HEADERS);
}
private static WindowBytesStoreSupplier persistentWindowStore(final String name,
final Duration retentionPeriod,
final Duration windowSize,
final boolean retainDuplicates,
- final boolean timestampedStore) {
+ final RocksDbWindowBytesStoreSupplier.WindowStoreTypes timestampedStoreType) {
Review Comment:
nit: windowStoreType
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: simplify window-byte-store-supplier [kafka]
Posted by "mjsax (via GitHub)" <gi...@apache.org>.
mjsax commented on PR #21829:
URL: https://github.com/apache/kafka/pull/21829#issuecomment-4171530774
Merged to `trunk` and cherry-picked to `4.3` branch.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: simplify window-byte-store-supplier [kafka]
Posted by "mjsax (via GitHub)" <gi...@apache.org>.
mjsax merged PR #21829:
URL: https://github.com/apache/kafka/pull/21829
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: simplify window-byte-store-supplier [kafka]
Posted by "mjsax (via GitHub)" <gi...@apache.org>.
mjsax commented on code in PR #21829:
URL: https://github.com/apache/kafka/pull/21829#discussion_r2967971980
##########
streams/src/main/java/org/apache/kafka/streams/state/Stores.java:
##########
@@ -378,38 +364,21 @@ private static WindowBytesStoreSupplier persistentWindowStore(final String name,
final long defaultSegmentInterval = Math.max(retentionMs / 2, 60_000L);
- return persistentWindowStore(name, retentionMs, windowSizeMs, retainDuplicates, defaultSegmentInterval, timestampedStore);
- }
-
- private static WindowBytesStoreSupplier persistentWindowStore(final String name,
- final long retentionPeriod,
- final long windowSize,
- final boolean retainDuplicates,
- final long segmentInterval,
- final boolean timestampedStore) {
- Objects.requireNonNull(name, "name cannot be null");
- if (retentionPeriod < 0L) {
+ if (retentionMs < 0L) {
throw new IllegalArgumentException("retentionPeriod cannot be negative");
}
- if (windowSize < 0L) {
+ if (windowSizeMs < 0L) {
throw new IllegalArgumentException("windowSize cannot be negative");
}
- if (segmentInterval < 1L) {
- throw new IllegalArgumentException("segmentInterval cannot be zero or negative");
- }
- if (windowSize > retentionPeriod) {
Review Comment:
Ups. Deleted too much -- only wanted to delete the `segmentInterval` check.
##########
streams/src/main/java/org/apache/kafka/streams/state/Stores.java:
##########
@@ -378,38 +364,21 @@ private static WindowBytesStoreSupplier persistentWindowStore(final String name,
final long defaultSegmentInterval = Math.max(retentionMs / 2, 60_000L);
- return persistentWindowStore(name, retentionMs, windowSizeMs, retainDuplicates, defaultSegmentInterval, timestampedStore);
- }
-
- private static WindowBytesStoreSupplier persistentWindowStore(final String name,
- final long retentionPeriod,
- final long windowSize,
- final boolean retainDuplicates,
- final long segmentInterval,
- final boolean timestampedStore) {
- Objects.requireNonNull(name, "name cannot be null");
- if (retentionPeriod < 0L) {
+ if (retentionMs < 0L) {
throw new IllegalArgumentException("retentionPeriod cannot be negative");
}
- if (windowSize < 0L) {
+ if (windowSizeMs < 0L) {
throw new IllegalArgumentException("windowSize cannot be negative");
}
- if (segmentInterval < 1L) {
- throw new IllegalArgumentException("segmentInterval cannot be zero or negative");
Review Comment:
We compute `segmentInterval` ourselves -- cannot be smaller than `1L`.
##########
streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDbIndexedTimeOrderedWindowBytesStoreSupplier.java:
##########
@@ -60,28 +62,40 @@ public static RocksDbIndexedTimeOrderedWindowBytesStoreSupplier create(final Str
if (windowSizeMs < 0L) {
throw new IllegalArgumentException("windowSize cannot be negative");
}
- if (defaultSegmentInterval < 1L) {
- throw new IllegalArgumentException("segmentInterval cannot be zero or negative");
Review Comment:
This check can never execute as we compute `defaultSegmentInterval` above ourselves.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org