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

[Event Hubs] Geo DR - preview #43935

Merged
merged 16 commits into from May 11, 2024

Conversation

m-redding
Copy link
Member

@m-redding m-redding commented May 8, 2024

Contributes to #39367

The concepts being updated here are the following:

  • EventData.Offset and EventData.SequenceNumber are now equivalent
  • EventData.GlobalOffset now maps to the offset value in the amqp message, but stores it as a string rather than a long

The primary changes in this PR are the following:

  • Hide EventData.Offset and add EventData.GlobalOffset, hide old constructor and add new one
  • Hide EventData.LastPartitionOffset and add EventData.LastPartitionGlobalOffset, hide old constructor and add new one
  • Hide EventPosition.FromOffset and add EventPosition.FromGlobalOffset, hide old constructor and add new one
  • Hide LastEnqueuedEventProperties.Offset and add LastEnqueuedEventProperties.GlobalOffset, hide old constructor and add new one
  • Add CheckpointPosition.GlobalOffset and new constructor
  • Everything in the AMQP layer needs to treat offset as sequence number, and global offset as offset.

The secondary changes are anything that is using the now-hidden properties and methods.

Included are updates to documentation and samples.

public static EventPosition FromOffset(long offset,
bool isInclusive = true)
{
return new EventPosition
{
Offset = offset.ToString(CultureInfo.InvariantCulture),
SequenceNumber = offset.ToString(CultureInfo.InvariantCulture),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this implementation makes sense. I'm fine with ToString telling them about the sequence number when they call this.

/// <param name="lastSequenceNumber">The sequence number observed the last event to be enqueued in the partition.</param>
/// <param name="lastOffset">The sequence number observed the last event to be enqueued in the partition.</param>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I changed my mind about this one from my last PR. I was thinking it just was too confusing to have the constructor just totally ignore a parameter.

I was thinking instead:

  • offset -> GetSequenceNumber in EventData, (In theory - will trickle up)
  • All references to the old offset properties in our internal implementation are switched to either global offset or sequence number

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant the typo that you fixed. I'm reasonably sure that's my bad.

This constructor is used only for testing, I believe, probably because it predates the model factory concept. I can't think of another reason why we needed a public constructor. Am I overlooking anything?

I wonder if we should just confirm that you can create from the model factory and make the new constructor internal?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I don't believe it would be used for any other reason. I will update this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we don't have insight into the service behavior for "I used a sequence number to position a geo-dr namespace reader", I think you made the right call by not adding in the warnings when reading non-geodr checkpoints.

@@ -106,10 +106,10 @@ static BlobCheckpointStoreInternal()
string consumerGroup,
string clientIdentifier,
string sequenceNumber,
string replicationSegment,
string globalOffset,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically a breaking change and not ideal - but replication segment is just a placeholder value in the current SDK. Alternatively could just tack global offset on the end and leave replication segment

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a reasonable change. The type signature is the same. It does break anyone using the name, but since the data was never actually populated, I think it's reasonable and low risk.

@m-redding m-redding marked this pull request as ready for review May 10, 2024 21:55
@m-redding m-redding merged commit 462e525 into Azure:eventhubs-geodr-preview May 11, 2024
29 of 38 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants