You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "tedyu (via GitHub)" <gi...@apache.org> on 2024/07/05 18:42:13 UTC

[PR] Use clear method to speed up removal [kafka]

tedyu opened a new pull request, #16535:
URL: https://github.com/apache/kafka/pull/16535

   In `maybeUpdateCachedStateAndOffsets`, we obtain the subMap according to `firstKeyToRemove` and `lastKeyToRemove`.
   Then we iterate over the keys of subMap to remove the entries.
   
   This PR makes the removal faster via `clear` method of the `subMap`.
   
   Existing test cases pass.
   
   ### Committer Checklist (excluded from commit message)
   - [ ] Verify design and implementation 
   - [ ] Verify test coverage and CI build status
   - [ ] Verify documentation (including upgrade notes)
   


-- 
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: Use clear method to speed up removal [kafka]

Posted by "tedyu (via GitHub)" <gi...@apache.org>.
tedyu closed pull request #16535: MINOR: Use clear method to speed up removal
URL: https://github.com/apache/kafka/pull/16535


-- 
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: Use clear method to speed up removal [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 commented on PR #16535:
URL: https://github.com/apache/kafka/pull/16535#issuecomment-2573263921

   > Also can we please update the branch as the test cases need to run.
   
   Also, it would be great to merge trunk to run QA again


-- 
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: Use clear method to speed up removal [kafka]

Posted by "apoorvmittal10 (via GitHub)" <gi...@apache.org>.
apoorvmittal10 commented on PR #16535:
URL: https://github.com/apache/kafka/pull/16535#issuecomment-2573318280

   > I opened #18400 since there were conflicts in the old branch.
   
   That's fine by `git fetch upstream` and `git merge upstream/trunk` would have done the job. Given the upstream is set to apache/kafka.


-- 
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] Use clear method to speed up removal [kafka]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #16535:
URL: https://github.com/apache/kafka/pull/16535#issuecomment-2571488960

   This PR is being marked as stale since it has not had any activity in 90 days. If you
   would like to keep this PR alive, please leave a comment asking for a review. If the PR has 
   merge conflicts, update it with the latest from the base branch.
   <p>
   If you are having difficulty finding a reviewer, please reach out on the 
   [mailing list](https://kafka.apache.org/contact).
   <p>
   If this PR is no longer valid or desired, please feel free to close it. If no activity
   occurs in the next 30 days, it will be automatically closed.


-- 
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: Use clear method to speed up removal [kafka]

Posted by "apoorvmittal10 (via GitHub)" <gi...@apache.org>.
apoorvmittal10 commented on PR #16535:
URL: https://github.com/apache/kafka/pull/16535#issuecomment-2573257186

   > @apoorvmittal10 @chia7712 Can this be merged ?
   > 
   > Thanks
   
   Do you thinking inlining the change will be helpful? Also can we please update the branch as the test cases need to run.


-- 
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] Use clear method to speed up removal [kafka]

Posted by "tedyu (via GitHub)" <gi...@apache.org>.
tedyu commented on PR #16535:
URL: https://github.com/apache/kafka/pull/16535#issuecomment-2214564497

   @apoorvmittal10 
   Can you take a look ?


-- 
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] Use clear method to speed up removal [kafka]

Posted by "apoorvmittal10 (via GitHub)" <gi...@apache.org>.
apoorvmittal10 commented on code in PR #16535:
URL: https://github.com/apache/kafka/pull/16535#discussion_r1904129203


##########
core/src/main/java/kafka/server/share/SharePartition.java:
##########
@@ -1421,9 +1421,7 @@ be removed once all the messages (0-99) are acknowledged (ACCEPT or REJECT).
 
             if (lastKeyToRemove != -1) {
                 NavigableMap<Long, InFlightBatch> subMap = cachedState.subMap(firstKeyToRemove, true, lastKeyToRemove, true);
-                for (Long key : subMap.keySet()) {
-                    cachedState.remove(key);
-                }
+                subMap.clear();

Review Comment:
   nit: the change could be inline:
   
   ```
   cachedState.subMap(firstKeyToRemove, true, lastKeyToRemove, true).clear()



-- 
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: Use clear method to speed up removal [kafka]

Posted by "tedyu (via GitHub)" <gi...@apache.org>.
tedyu commented on PR #16535:
URL: https://github.com/apache/kafka/pull/16535#issuecomment-2573314287

   I opened https://github.com/apache/kafka/pull/18400 since there were conflicts in the old 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] Use clear method to speed up removal [kafka]

Posted by "tedyu (via GitHub)" <gi...@apache.org>.
tedyu commented on PR #16535:
URL: https://github.com/apache/kafka/pull/16535#issuecomment-2211278879

   @apoorvmittal10 @AndrewJSchofield 
   Can you review this PR ?


-- 
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: Use clear method to speed up removal [kafka]

Posted by "tedyu (via GitHub)" <gi...@apache.org>.
tedyu commented on PR #16535:
URL: https://github.com/apache/kafka/pull/16535#issuecomment-2573214437

   @apoorvmittal10 @chia7712 
   Can this be merged ?
   
   Thanks


-- 
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