forked from apache/kafka
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KAFKA-17703: Moved DelayedActionsQueue outside DelayedShareFetch (apa…
…che#17380) Move ActionQueue outside DelayedShareFetch class to SharePartitionManager where SharePartitionManager has the ability to add a delayed action to the ActionQueue. Add TopicPartition as a key for delayed share fetch along with SharePartition (that is already present right now). This will be utilized later when we add the code to know if new data has been added to the topic partition. Reviewers: Apoorv Mittal <[email protected]>, Jun Rao <[email protected]>
- Loading branch information
1 parent
011c3aa
commit d1f3885
Showing
11 changed files
with
307 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
core/src/main/java/kafka/server/share/DelayedShareFetchGroupKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* 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 kafka.server.share; | ||
|
||
import kafka.server.DelayedOperationKey; | ||
|
||
import org.apache.kafka.common.Uuid; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* A key for delayed share fetch purgatory that refers to the share partition. | ||
*/ | ||
public class DelayedShareFetchGroupKey implements DelayedShareFetchKey, DelayedOperationKey { | ||
private final String groupId; | ||
private final Uuid topicId; | ||
private final int partition; | ||
|
||
DelayedShareFetchGroupKey(String groupId, Uuid topicId, int partition) { | ||
this.groupId = groupId; | ||
this.topicId = topicId; | ||
this.partition = partition; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
DelayedShareFetchGroupKey that = (DelayedShareFetchGroupKey) o; | ||
return topicId.equals(that.topicId) && partition == that.partition && groupId.equals(that.groupId); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(topicId, partition, groupId); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "DelayedShareFetchGroupKey(groupId=" + groupId + | ||
", topicId=" + topicId + | ||
", partition=" + partition + | ||
")"; | ||
} | ||
|
||
@Override | ||
public String keyLabel() { | ||
return String.format("groupId=%s, topicId=%s, partition=%s", groupId, topicId, partition); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
core/src/main/java/kafka/server/share/DelayedShareFetchPartitionKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* 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 kafka.server.share; | ||
|
||
import kafka.server.DelayedOperationKey; | ||
|
||
import org.apache.kafka.common.Uuid; | ||
|
||
import java.util.Objects; | ||
|
||
/** | ||
* A key for delayed share fetch purgatory that refers to the topic partition. | ||
*/ | ||
public class DelayedShareFetchPartitionKey implements DelayedShareFetchKey, DelayedOperationKey { | ||
private final Uuid topicId; | ||
private final int partition; | ||
|
||
DelayedShareFetchPartitionKey(Uuid topicId, int partition) { | ||
this.topicId = topicId; | ||
this.partition = partition; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
DelayedShareFetchPartitionKey that = (DelayedShareFetchPartitionKey) o; | ||
return topicId.equals(that.topicId) && partition == that.partition; | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(topicId, partition); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "DelayedShareFetchPartitionKey(topicId=" + topicId + | ||
", partition=" + partition + ")"; | ||
} | ||
|
||
@Override | ||
public String keyLabel() { | ||
return String.format("topicId=%s, partition=%s", topicId, partition); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.