Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[azure-sdk-for-java/sdk/eventhubs/azure-messaging-eventhubs] Filter fails if related to the last sequenceNumber of the partition #29502

Open
3 tasks done
fanchuo opened this issue Jun 16, 2022 · 3 comments
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Hubs needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Track 1

Comments

@fanchuo
Copy link

fanchuo commented Jun 16, 2022

Describe the bug
In eventhub, startPosition filter fails if related to the last sequenceNumber of my partition. As far as I understand, it might be server-side issue.

To Reproduce
I work with some eventhub topic on which the traffic is really low. It contains 4 partitions but only partition 0 contains data, here are the SequenceNumber/EnqueuedTime contained

1271 - 2022-06-07T06:48:31.138Z
1272 - 2022-06-07T06:48:31.138Z
1273 - 2022-06-07T06:48:31.138Z
1274 - 2022-06-07T06:48:31.138Z
1275 - 2022-06-07T06:48:31.138Z
1276 - 2022-06-14T14:20:47.254Z

I use the code snippet to execute several scenarii.
First I focus on filtering sequenceNumber=1275
Here are the results:

EventPosition.fromSequenceNumber(sequenceNumber=1275, inclusiveFlag=false)
1276 - 2022-06-14T14:20:47.254Z

EventPosition.fromSequenceNumber(sequenceNumber=1275, inclusiveFlag=true)
1275 - 2022-06-07T06:48:31.138Z
1276 - 2022-06-14T14:20:47.254Z

This was conform to what I expected so far, let's try with sequenceNumber=1276

EventPosition.fromSequenceNumber(sequenceNumber=1276, inclusiveFlag=false)
1272 - 2022-06-07T06:48:31.138Z
1273 - 2022-06-07T06:48:31.138Z
1274 - 2022-06-07T06:48:31.138Z
1275 - 2022-06-07T06:48:31.138Z
1276 - 2022-06-14T14:20:47.254Z

EventPosition.fromSequenceNumber(sequenceNumber=1276, inclusiveFlag=true)
1271 - 2022-06-07T06:48:31.138Z
1272 - 2022-06-07T06:48:31.138Z
1273 - 2022-06-07T06:48:31.138Z
1274 - 2022-06-07T06:48:31.138Z
1275 - 2022-06-07T06:48:31.138Z
1276 - 2022-06-14T14:20:47.254Z

Code Snippet

import com.microsoft.azure.eventhubs.*;

import java.util.Iterator;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

public class EventHubFilterFails {
    public static void main(String[] args) throws Exception {
        String connectionString = "Some secret";
        String consumerGroup = "$default";
        String partitionId = "0";
        long seqNo = 1276L;
        boolean inclusiveFlag = true;
        EventPosition eventPosition = EventPosition.fromSequenceNumber(seqNo, inclusiveFlag);
        ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();

        EventHubClient client = EventHubClient.createFromConnectionStringSync(
                connectionString,
                executor);

        ReceiverOptions receiverOptions = new ReceiverOptions();
        receiverOptions.setReceiverRuntimeMetricEnabled(true);
        receiverOptions.setPrefetchCount(500);
        receiverOptions.setIdentifier("test-filters");
        PartitionReceiver receiver =
                client.createEpochReceiver(consumerGroup, partitionId, eventPosition, 0L, receiverOptions).join();

        while (true) {
            Iterator<EventData> it = receiver.receiveSync(1).iterator();
            while (it.hasNext()) {
                EventData msg = it.next();
                EventData.SystemProperties sp = msg.getSystemProperties();
                System.out.println(sp.getSequenceNumber() + " - " + sp.getEnqueuedTime());
            }
        }

    }
}

Expected behavior
For executions with sequenceNumber=1276, I would have expected:

EventPosition.fromSequenceNumber(sequenceNumber=1276, inclusiveFlag=false)
<EMPTY>

EventPosition.fromSequenceNumber(sequenceNumber=1276, inclusiveFlag=true)
1276 - 2022-06-14T14:20:47.254Z

Setup:

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Bug Description Added
  • Repro Steps Added
  • Setup information Added
@ghost ghost added needs-triage This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jun 16, 2022
@joshfree joshfree added Event Hubs Client This issue points to a problem in the data-plane of the library. labels Jun 16, 2022
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Jun 16, 2022
@joshfree
Copy link
Member

Thanks for filing this github issue, @fanchuo. @liukun-msft could you please take a look?

/cc @Azure/azsdk-sb-java

@liukun-msft
Copy link
Contributor

Sure, I will check this.

@ghost ghost added the needs-team-attention This issue needs attention from Azure service team or SDK team label Jun 17, 2022
@anuchandy
Copy link
Member

Hi @JamesBirdsall, Could you please help triaging this track1 EH question?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Hubs needs-team-attention This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Track 1
Projects
None yet
Development

No branches or pull requests

5 participants