You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by "Ashutosh-Panda2004 (via GitHub)" <gi...@apache.org> on 2026/09/29 17:46:29 UTC

[PR] Java SDK: add purgeStream and purgeTopic [iggy]

Ashutosh-Panda2004 opened a new pull request, #4351:
URL: https://github.com/apache/iggy/pull/4351

   Closes #4329.
   
   Added purgeStream and purgeTopic to the Java SDK, covering both the async and blocking clients (TCP and HTTP). Tests are in with the existing stream/topic tests, and the command codes follow the existing pattern.


-- 
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: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(java): add purgeStream and purgeTopic [iggy]

Posted by "Ashutosh-Panda2004 (via GitHub)" <gi...@apache.org>.
Ashutosh-Panda2004 commented on PR #4351:
URL: https://github.com/apache/iggy/pull/4351#issuecomment-6030878231

   Pushed the changes you asked for. The poll helpers are inlined in the shared base classes now, and I added shouldFailPurgeForNonExistingStream and shouldFailPurgeForNonExistingTopic to the same bases, so they run for the blocking TCP and HTTP clients. The PR description is also rewritten to the repo template. Thanks for the review.
   


-- 
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: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Java SDK: add purgeStream and purgeTopic [iggy]

Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio commented on PR #4351:
URL: https://github.com/apache/iggy/pull/4351#issuecomment-5895922829

   /skill team-review-slim 


-- 
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: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(java): add purgeStream and purgeTopic [iggy]

Posted by "mmodzelewski (via GitHub)" <gi...@apache.org>.
mmodzelewski commented on code in PR #4351:
URL: https://github.com/apache/iggy/pull/4351#discussion_r4165497119


##########
foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/IntegrationTest.java:
##########
@@ -117,4 +124,38 @@ protected void trackUser(Long userId) {
             createdUserIds.add(userId);
         }
     }
+
+    protected static PolledMessages pollMessages(

Review Comment:
   Warning: `spotlessJavaCheck` fails on this signature, so the Java lint job fails. Run `./gradlew spotlessApply` and commit the result.
   
   Also at line 145 and `TopicsClientBaseTest.java:81`.



##########
foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/StreamClientBaseTest.java:
##########
@@ -87,4 +95,31 @@ void shouldReturnEmptyForNonExistingStream() {
         // then
         assertThat(stream).isEmpty();
     }
+
+    @Test
+    void shouldPurgeStream() {

Review Comment:
   Nit: This test covers one topic and does not assert that the topic still exists after the purge. Add a second topic with messages and assert that both remain and are empty.



##########
foreign/java/java-sdk/src/main/java/org/apache/iggy/client/async/StreamsClient.java:
##########
@@ -149,4 +149,29 @@ default CompletableFuture<Void> deleteStream(Long streamId) {
      * @throws org.apache.iggy.exception.IggyException if the stream does not exist
      */
     CompletableFuture<Void> deleteStream(StreamId streamId);
+
+    /**
+     * Purges a stream, deleting all messages in all of its topics and partitions, by numeric ID.
+     *
+     * <p>This is a convenience overload that wraps the numeric ID into a {@link StreamId}.
+     *
+     * <p>Unlike {@link #deleteStream(StreamId)}, the stream itself and its topics are kept.
+     *
+     * @param streamId the numeric stream identifier
+     * @return a {@link CompletableFuture} that completes when the server accepts the purge
+     */
+    default CompletableFuture<Void> purgeStream(Long streamId) {
+        return purgeStream(StreamId.of(streamId));
+    }
+
+    /**
+     * Purges a stream, deleting all messages in all of its topics and partitions.

Review Comment:
   Nit: The Javadoc does not say that a purge restarts offsets at 0, clears stored consumer and consumer-group offsets, and cannot be undone. Add these effects.
   
   Also at `TopicsClient.java:207`.



##########
foreign/java/java-sdk/src/main/java/org/apache/iggy/client/async/TopicsClient.java:
##########
@@ -186,4 +186,32 @@ CompletableFuture<Void> updateTopic(
      * @throws org.apache.iggy.exception.IggyException if the topic does not exist
      */
     CompletableFuture<Void> deleteTopic(StreamId streamId, TopicId topicId);
+
+    /**
+     * Purges a topic, deleting all messages in all of its partitions, by numeric IDs.
+     *
+     * <p>This is a convenience overload that wraps the numeric IDs into a {@link StreamId} and
+     * a {@link TopicId}.
+     *
+     * <p>Unlike {@link #deleteTopic(StreamId, TopicId)}, the topic itself is kept.
+     *
+     * @param streamId the numeric stream identifier
+     * @param topicId  the numeric topic identifier
+     * @return a {@link CompletableFuture} that completes when the server accepts the purge
+     */
+    default CompletableFuture<Void> purgeTopic(Long streamId, Long topicId) {
+        return purgeTopic(StreamId.of(streamId), TopicId.of(topicId));
+    }
+
+    /**
+     * Purges a topic, deleting all messages in all of its partitions.
+     *
+     * <p>Unlike {@link #deleteTopic(StreamId, TopicId)}, the topic itself is kept.
+     *
+     * @param streamId the stream identifier containing the topic
+     * @param topicId  the topic identifier to purge
+     * @return a {@link CompletableFuture} that completes when the server accepts the purge

Review Comment:
   Warning: The server wipes the partitions after it acknowledges the purge, so old messages stay readable briefly and a send made right after the future completes can be lost. Document this window.
   
   Also at line 200 and `StreamsClient.java:161`, 173.



##########
foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/TopicsClientBaseTest.java:
##########
@@ -64,6 +67,29 @@ void shouldCreateAndDeleteTopic() {
         assertThat(topicsClient.getTopics(STREAM_NAME)).isEmpty();
     }
 
+    @Test
+    void shouldPurgeTopic() {
+        // given
+        var topicDetails = topicsClient.createTopic(
+                STREAM_NAME, 1L, CompressionAlgorithm.None, BigInteger.ZERO, BigInteger.ZERO, "test-topic");
+        var topicId = TopicId.of(topicDetails.id());
+        var messagesClient = client.messages();
+        messagesClient.sendMessages(
+                STREAM_NAME, topicId, Partitioning.partitionId(0L), List.of(Message.of("message to purge")));
+
+        // The send is acknowledged before this runs, so the message must already be visible.
+        assertThat(pollMessages(messagesClient, STREAM_NAME, topicId).messages()).hasSize(1);
+
+        // when
+        topicsClient.purgeTopic(STREAM_NAME, topicId);
+
+        // then
+        assertThat(topicsClient.getTopic(STREAM_NAME, topicId)).isPresent();
+        assertThat(pollUntilEmpty(messagesClient, STREAM_NAME, topicId))

Review Comment:
   Nit: No test sends a message after the purge. Send one here and assert that a poll returns it at offset 0.



##########
foreign/java/java-sdk/src/main/java/org/apache/iggy/client/async/tcp/StreamsTcpClient.java:
##########
@@ -111,4 +111,11 @@ public CompletableFuture<Void> deleteStream(StreamId streamId) {
 
         return connection().send(CommandCode.Stream.DELETE.getValue(), payload).thenAccept(ReferenceCounted::release);
     }
+
+    @Override
+    public CompletableFuture<Void> purgeStream(StreamId streamId) {
+        var payload = toBytes(streamId);
+
+        return connection().send(CommandCode.Stream.PURGE.getValue(), payload).thenAccept(ReferenceCounted::release);

Review Comment:
   Simplification: Use `connection().sendAndRelease(CommandCode.Stream.PURGE, payload)` instead of `send(...).thenAccept(ReferenceCounted::release)`.
   
   Also at `TopicsTcpClient.java:219`.



-- 
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: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Java SDK: add purgeStream and purgeTopic [iggy]

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

   <!-- iggy-pr-triage-welcome -->
   Thanks for the PR. It is labeled `S-waiting-on-review` and queued for review.
   
   Slash commands (own line, regular comment) move it around the queue:
   
   - `/ready` - back to `S-waiting-on-review` after addressing feedback
   - `/author` - flip to `S-waiting-on-author` while you finish changes
   - `/request-review @user-or-team` - request a reviewer
   - `/pin` - exempt the PR from the stale bot, `/unpin` to undo
   
   See [CONTRIBUTING.md](https://github.com/apache/iggy/blob/master/CONTRIBUTING.md#pr-triage-commands) for details.


-- 
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: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(java): add purgeStream and purgeTopic [iggy]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #4351:
URL: https://github.com/apache/iggy/pull/4351#issuecomment-5897090914

   ## [Codecov](https://app.codecov.io/gh/apache/iggy/pull/4351?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `84.61538%` with `4 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 87.78%. Comparing base ([`9fdb642`](https://app.codecov.io/gh/apache/iggy/commit/9fdb64274c6b36dbb058713e66fd82f3b68bdf83?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`59e764b`](https://app.codecov.io/gh/apache/iggy/commit/59e764b6180f9c1e06f80951b2217303bf7676f2?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 1 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/iggy/pull/4351?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [.../org/apache/iggy/client/blocking/TopicsClient.java](https://app.codecov.io/gh/apache/iggy/pull/4351?src=pr&el=tree&filepath=foreign%2Fjava%2Fjava-sdk%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Figgy%2Fclient%2Fblocking%2FTopicsClient.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9qYXZhL2phdmEtc2RrL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pZ2d5L2NsaWVudC9ibG9ja2luZy9Ub3BpY3NDbGllbnQuamF2YQ==) | 0.00% | [2 Missing :warning: ](https://app.codecov.io/gh/apache/iggy/pull/4351?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...va/org/apache/iggy/client/async/StreamsClient.java](https://app.codecov.io/gh/apache/iggy/pull/4351?src=pr&el=tree&filepath=foreign%2Fjava%2Fjava-sdk%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Figgy%2Fclient%2Fasync%2FStreamsClient.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9qYXZhL2phdmEtc2RrL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pZ2d5L2NsaWVudC9hc3luYy9TdHJlYW1zQ2xpZW50LmphdmE=) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/iggy/pull/4351?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...ava/org/apache/iggy/client/async/TopicsClient.java](https://app.codecov.io/gh/apache/iggy/pull/4351?src=pr&el=tree&filepath=foreign%2Fjava%2Fjava-sdk%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Figgy%2Fclient%2Fasync%2FTopicsClient.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9qYXZhL2phdmEtc2RrL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pZ2d5L2NsaWVudC9hc3luYy9Ub3BpY3NDbGllbnQuamF2YQ==) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/iggy/pull/4351?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff            @@
   ##             master    #4351   +/-   ##
   =========================================
     Coverage     87.77%   87.78%           
   - Complexity     1575     1584    +9     
   =========================================
     Files          1288     1288           
     Lines        227249   227274   +25     
     Branches     190686   190686           
   =========================================
   + Hits         199478   199504   +26     
   + Misses        23062    23061    -1     
     Partials       4709     4709           
   ```
   
   | [Components](https://app.codecov.io/gh/apache/iggy/pull/4351/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [Rust Core](https://app.codecov.io/gh/apache/iggy/pull/4351/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `88.87% <ø> (ø)` | |
   | [Java SDK](https://app.codecov.io/gh/apache/iggy/pull/4351/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `68.82% <84.61%> (+0.14%)` | :arrow_up: |
   | [C# SDK](https://app.codecov.io/gh/apache/iggy/pull/4351/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `77.40% <ø> (ø)` | |
   | [Python SDK](https://app.codecov.io/gh/apache/iggy/pull/4351/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `91.00% <ø> (ø)` | |
   | [PHP SDK](https://app.codecov.io/gh/apache/iggy/pull/4351/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `85.67% <ø> (ø)` | |
   | [Node SDK](https://app.codecov.io/gh/apache/iggy/pull/4351/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `96.58% <ø> (ø)` | |
   | [Go SDK](https://app.codecov.io/gh/apache/iggy/pull/4351/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `70.28% <ø> (ø)` | |
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/iggy/pull/4351?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [...apache/iggy/client/async/tcp/StreamsTcpClient.java](https://app.codecov.io/gh/apache/iggy/pull/4351?src=pr&el=tree&filepath=foreign%2Fjava%2Fjava-sdk%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Figgy%2Fclient%2Fasync%2Ftcp%2FStreamsTcpClient.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9qYXZhL2phdmEtc2RrL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pZ2d5L2NsaWVudC9hc3luYy90Y3AvU3RyZWFtc1RjcENsaWVudC5qYXZh) | `100.00% <100.00%> (ø)` | |
   | [.../apache/iggy/client/async/tcp/TopicsTcpClient.java](https://app.codecov.io/gh/apache/iggy/pull/4351?src=pr&el=tree&filepath=foreign%2Fjava%2Fjava-sdk%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Figgy%2Fclient%2Fasync%2Ftcp%2FTopicsTcpClient.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9qYXZhL2phdmEtc2RrL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pZ2d5L2NsaWVudC9hc3luYy90Y3AvVG9waWNzVGNwQ2xpZW50LmphdmE=) | `93.93% <100.00%> (+0.60%)` | :arrow_up: |
   | [...org/apache/iggy/client/blocking/StreamsClient.java](https://app.codecov.io/gh/apache/iggy/pull/4351?src=pr&el=tree&filepath=foreign%2Fjava%2Fjava-sdk%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Figgy%2Fclient%2Fblocking%2FStreamsClient.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9qYXZhL2phdmEtc2RrL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pZ2d5L2NsaWVudC9ibG9ja2luZy9TdHJlYW1zQ2xpZW50LmphdmE=) | `100.00% <100.00%> (ø)` | |
   | [...e/iggy/client/blocking/http/StreamsHttpClient.java](https://app.codecov.io/gh/apache/iggy/pull/4351?src=pr&el=tree&filepath=foreign%2Fjava%2Fjava-sdk%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Figgy%2Fclient%2Fblocking%2Fhttp%2FStreamsHttpClient.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9qYXZhL2phdmEtc2RrL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pZ2d5L2NsaWVudC9ibG9ja2luZy9odHRwL1N0cmVhbXNIdHRwQ2xpZW50LmphdmE=) | `93.10% <100.00%> (+0.79%)` | :arrow_up: |
   | [...he/iggy/client/blocking/http/TopicsHttpClient.java](https://app.codecov.io/gh/apache/iggy/pull/4351?src=pr&el=tree&filepath=foreign%2Fjava%2Fjava-sdk%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Figgy%2Fclient%2Fblocking%2Fhttp%2FTopicsHttpClient.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9qYXZhL2phdmEtc2RrL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pZ2d5L2NsaWVudC9ibG9ja2luZy9odHRwL1RvcGljc0h0dHBDbGllbnQuamF2YQ==) | `93.47% <100.00%> (+9.75%)` | :arrow_up: |
   | [...che/iggy/client/blocking/tcp/StreamsTcpClient.java](https://app.codecov.io/gh/apache/iggy/pull/4351?src=pr&el=tree&filepath=foreign%2Fjava%2Fjava-sdk%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Figgy%2Fclient%2Fblocking%2Ftcp%2FStreamsTcpClient.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9qYXZhL2phdmEtc2RrL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pZ2d5L2NsaWVudC9ibG9ja2luZy90Y3AvU3RyZWFtc1RjcENsaWVudC5qYXZh) | `100.00% <100.00%> (ø)` | |
   | [...ache/iggy/client/blocking/tcp/TopicsTcpClient.java](https://app.codecov.io/gh/apache/iggy/pull/4351?src=pr&el=tree&filepath=foreign%2Fjava%2Fjava-sdk%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Figgy%2Fclient%2Fblocking%2Ftcp%2FTopicsTcpClient.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9qYXZhL2phdmEtc2RrL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pZ2d5L2NsaWVudC9ibG9ja2luZy90Y3AvVG9waWNzVGNwQ2xpZW50LmphdmE=) | `100.00% <100.00%> (ø)` | |
   | [...c/main/java/org/apache/iggy/serde/CommandCode.java](https://app.codecov.io/gh/apache/iggy/pull/4351?src=pr&el=tree&filepath=foreign%2Fjava%2Fjava-sdk%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Figgy%2Fserde%2FCommandCode.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9qYXZhL2phdmEtc2RrL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pZ2d5L3NlcmRlL0NvbW1hbmRDb2RlLmphdmE=) | `100.00% <100.00%> (ø)` | |
   | [...va/org/apache/iggy/client/async/StreamsClient.java](https://app.codecov.io/gh/apache/iggy/pull/4351?src=pr&el=tree&filepath=foreign%2Fjava%2Fjava-sdk%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Figgy%2Fclient%2Fasync%2FStreamsClient.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9qYXZhL2phdmEtc2RrL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pZ2d5L2NsaWVudC9hc3luYy9TdHJlYW1zQ2xpZW50LmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...ava/org/apache/iggy/client/async/TopicsClient.java](https://app.codecov.io/gh/apache/iggy/pull/4351?src=pr&el=tree&filepath=foreign%2Fjava%2Fjava-sdk%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Figgy%2Fclient%2Fasync%2FTopicsClient.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-Zm9yZWlnbi9qYXZhL2phdmEtc2RrL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9pZ2d5L2NsaWVudC9hc3luYy9Ub3BpY3NDbGllbnQuamF2YQ==) | `50.00% <0.00%> (-16.67%)` | :arrow_down: |
   | ... and [1 more](https://app.codecov.io/gh/apache/iggy/pull/4351?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | |
   
   ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/apache/iggy/pull/4351/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(java): add purgeStream and purgeTopic [iggy]

Posted by "slbotbm (via GitHub)" <gi...@apache.org>.
slbotbm commented on code in PR #4351:
URL: https://github.com/apache/iggy/pull/4351#discussion_r4172175268


##########
foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/IntegrationTest.java:
##########
@@ -117,4 +124,36 @@ protected void trackUser(Long userId) {
             createdUserIds.add(userId);
         }
     }
+
+    protected static PolledMessages pollMessages(MessagesClient messagesClient, StreamId streamId, TopicId topicId) {
+        return messagesClient.pollMessages(
+                streamId,
+                topicId,
+                Optional.empty(),
+                Consumer.of(0L),
+                new PollingStrategy(PollingKind.Last, BigInteger.TEN),
+                10L,
+                false);
+    }
+
+    /**
+     * Polls until no messages remain or the timeout elapses. A purge is acknowledged once the
+     * server accepts it, but the messages can still be visible to a poll issued right after, so a
+     * single poll is not a reliable assertion that the purge took effect.
+     */
+    protected static boolean pollUntilEmpty(MessagesClient messagesClient, StreamId streamId, TopicId topicId) {
+        var deadline = System.currentTimeMillis() + 10_000;
+        do {
+            if (pollMessages(messagesClient, streamId, topicId).messages().isEmpty()) {
+                return true;
+            }
+            try {
+                Thread.sleep(200);
+            } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                return false;
+            }
+        } while (System.currentTimeMillis() < deadline);
+        return false;

Review Comment:
   It is alright to use llms to write code. But at least control it well and make it follow the repository's patterns. This looks like you one-shotted the implementation



##########
foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/IntegrationTest.java:
##########
@@ -117,4 +124,36 @@ protected void trackUser(Long userId) {
             createdUserIds.add(userId);
         }
     }
+
+    protected static PolledMessages pollMessages(MessagesClient messagesClient, StreamId streamId, TopicId topicId) {
+        return messagesClient.pollMessages(
+                streamId,
+                topicId,
+                Optional.empty(),
+                Consumer.of(0L),
+                new PollingStrategy(PollingKind.Last, BigInteger.TEN),
+                10L,
+                false);
+    }

Review Comment:
   Inline this. No need for separate function



##########
foreign/java/java-sdk/src/test/java/org/apache/iggy/client/blocking/IntegrationTest.java:
##########
@@ -117,4 +124,36 @@ protected void trackUser(Long userId) {
             createdUserIds.add(userId);
         }
     }
+
+    protected static PolledMessages pollMessages(MessagesClient messagesClient, StreamId streamId, TopicId topicId) {
+        return messagesClient.pollMessages(
+                streamId,
+                topicId,
+                Optional.empty(),
+                Consumer.of(0L),
+                new PollingStrategy(PollingKind.Last, BigInteger.TEN),
+                10L,
+                false);
+    }
+
+    /**
+     * Polls until no messages remain or the timeout elapses. A purge is acknowledged once the
+     * server accepts it, but the messages can still be visible to a poll issued right after, so a
+     * single poll is not a reliable assertion that the purge took effect.
+     */
+    protected static boolean pollUntilEmpty(MessagesClient messagesClient, StreamId streamId, TopicId topicId) {
+        var deadline = System.currentTimeMillis() + 10_000;
+        do {
+            if (pollMessages(messagesClient, streamId, topicId).messages().isEmpty()) {
+                return true;
+            }
+            try {
+                Thread.sleep(200);
+            } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                return false;
+            }
+        } while (System.currentTimeMillis() < deadline);
+        return false;

Review Comment:
   Inline this as well. 



-- 
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: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(java): add purgeStream and purgeTopic [iggy]

Posted by "Ashutosh-Panda2004 (via GitHub)" <gi...@apache.org>.
Ashutosh-Panda2004 closed pull request #4351: feat(java): add purgeStream and purgeTopic
URL: https://github.com/apache/iggy/pull/4351


-- 
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: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Java SDK: add purgeStream and purgeTopic [iggy]

Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio closed pull request #4351: Java SDK: add purgeStream and purgeTopic
URL: https://github.com/apache/iggy/pull/4351


-- 
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: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(java): add purgeStream and purgeTopic [iggy]

Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio commented on PR #4351:
URL: https://github.com/apache/iggy/pull/4351#issuecomment-6061377707

   hey, thanks for the work here and for going through two review rounds. sorry for the bad news: we decided to remove the purge API (PurgeStream / PurgeTopic) from the server and from all SDKs. keeping purge correct across replication and recovery complicates the code way too much, and it's not worth it.
   
   so we're closing this PRand https://github.com/apache/iggy/issues/4329. if you want to pick up something else in the java sdk, the open issues are a good place to start. i opened plenty today so i hope you can pickup something.


-- 
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: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(java): add purgeStream and purgeTopic [iggy]

Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio closed pull request #4351: feat(java): add purgeStream and purgeTopic
URL: https://github.com/apache/iggy/pull/4351


-- 
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: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Java SDK: add purgeStream and purgeTopic [iggy]

Posted by "hubcio (via GitHub)" <gi...@apache.org>.
hubcio commented on PR #4351:
URL: https://github.com/apache/iggy/pull/4351#issuecomment-5895731544

   read CONTRIBUTING.md


-- 
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: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] feat(java): add purgeStream and purgeTopic [iggy]

Posted by "Ashutosh-Panda2004 (via GitHub)" <gi...@apache.org>.
Ashutosh-Panda2004 commented on PR #4351:
URL: https://github.com/apache/iggy/pull/4351#issuecomment-5954926207

   Addressed all of these in 215a0091, sendAndRelease in both TCP clients, purge effects and the wipe window documented in the Javadoc, second topic covered in the stream purge test, post-purge send asserted at offset 0, and spotless applied.


-- 
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: commits-unsubscribe@iggy.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org