GeoDR preparation - EventHubs Offset is a string, not an integer encoded as a string#6461
Merged
LarryOsterman merged 2 commits intoAzure:mainfrom Mar 27, 2025
Merged
Conversation
Collaborator
|
API change check API changes are not detected in this pull request. |
antkmsft
approved these changes
Mar 12, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Treat Offset fields in Event Hubs as strings, not integers.
With the upcoming GeoDR functionality in Event Hubs, the Offset field needs to contain string data to handle BCDR recovery scenarios.
This change updates the Event Hubs client to respect the on-the-wire encoding of the Offset field rather than attempting to treat the Offset field as an integer type. It also only allows encoding the Offset field as a string, any other encoding is ignored.
GitHub Copilot Summary
This pull request includes multiple changes to the Azure Event Hubs SDK, focusing on modifying the
Offsettype from numeric to string across various components. The changes span multiple files and include updates to the implementation, tests, and constants.Changes to Offset Type:
sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/src/blob_checkpoint_store.cpp: UpdatedUpdateCheckpointImplandCreateCheckpointBlobMetadatato handleOffsetas a string instead of converting it to a numeric type. [1] [2]sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/models/checkpoint_store_models.hpp: ChangedOffsettype fromAzure::Nullable<int64_t>toAzure::Nullable<std::string>in theCheckpointmodel.sdk/eventhubs/azure-messaging-eventhubs/inc/azure/messaging/eventhubs/models/event_data.hpp: ModifiedOffsettype fromAzure::Nullable<std::uint64_t>toAzure::Nullable<std::string>in theEventDatamodel.sdk/eventhubs/azure-messaging-eventhubs/src/event_data.cpp: Adjusted the handling ofOffsetto treat it as a string and updated the annotation key fromOffsetNumberAnnotationtoOffsetAnnotation.sdk/eventhubs/azure-messaging-eventhubs/src/private/eventhubs_constants.hpp: RenamedOffsetNumberAnnotationtoOffsetAnnotationto reflect the change in type.Test Updates:
sdk/eventhubs/azure-messaging-eventhubs-checkpointstore-blob/test/ut/blob_checkpoint_store_test.cpp: Updated test cases to use string values forOffsetinstead of numeric values. [1] [2] [3]sdk/eventhubs/azure-messaging-eventhubs/test/ut/event_data_test.cpp: Modified tests to expectOffsetas a string and removed tests that checked numeric offsets. [1] [2] [3]sdk/eventhubs/azure-messaging-eventhubs/test/ut/round_trip_test.cpp: Changed thestartOffsettype to string in the round trip test.These changes ensure that the
Offsettype is consistently treated as a string across the Azure Event Hubs SDK, simplifying the handling of offsets and aligning with the expected data format.