[
https://issues.apache.org/jira/browse/FLINK-9423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16488705#comment-16488705
]
ASF GitHub Bot commented on FLINK-9423:
---------------------------------------
Github user sihuazhou commented on a diff in the pull request:
https://github.com/apache/flink/pull/6062#discussion_r190517094
--- Diff:
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/InternalTimerHeap.java
---
@@ -458,24 +458,33 @@ private int globalKeyGroupToLocalIndex(int keyGroup) {
return keyGroup - keyGroupRange.getStartKeyGroup();
}
- private void checkCapacity(int requested) {
+ private void growIfRequired(int requiredSize) {
int oldArraySize = queue.length;
- if (requested >= oldArraySize) {
+ if (requiredSize >= oldArraySize) {
final int grow = (oldArraySize < 64) ? oldArraySize + 2
: oldArraySize >> 1;
- int newArraySize = oldArraySize + grow;
- if (newArraySize - MAX_ARRAY_SIZE > 0) {
- if (newArraySize < 0 || requested >
MAX_ARRAY_SIZE) {
- throw new OutOfMemoryError("Required
timer heap exceeds maximum size!");
- } else {
- newArraySize = MAX_ARRAY_SIZE;
- }
- }
- queue = Arrays.copyOf(queue, newArraySize);
+ resizeQueueArray(oldArraySize + grow);
}
// TODO implement shrinking as well?
}
+ private void resizeForBulkLoad(int maxTotalSize) {
+ if (maxTotalSize > queue.length) {
+ resizeQueueArray(maxTotalSize + (maxTotalSize / 8));
--- End diff --
`maxTotalSize / 8` -> `maxTotalSize >>> 3`
> Implement efficient deletes for heap based timer service
> --------------------------------------------------------
>
> Key: FLINK-9423
> URL: https://issues.apache.org/jira/browse/FLINK-9423
> Project: Flink
> Issue Type: Improvement
> Components: Streaming
> Affects Versions: 1.6.0
> Reporter: Stefan Richter
> Assignee: Stefan Richter
> Priority: Major
>
> The current data structures in the `HeapInternalTimerService` are not able to
> support efficient timer deletes, the complexity is currently O\(n\), where n
> is the number of registered timers.
>
> We can keep track of timer's positions in the priority queue and (in
> combination with the already existing set/map) have a more efficient
> algorithm for deletes.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)