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

Change Feed Processor with Datetime.MinValue and Multi master accounts #954

Merged
merged 10 commits into from
Nov 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static ChangeFeedPartitionKeyResultSetIteratorCore BuildResultSetIterator
}
else if (startFromBeginning)
{
requestOptions.StartTime = DateTime.MinValue;
requestOptions.StartTime = ChangeFeedRequestOptions.DateTimeStartFromBeginning;
}

return new ChangeFeedPartitionKeyResultSetIteratorCore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace Microsoft.Azure.Cosmos
internal class ChangeFeedRequestOptions : RequestOptions
{
internal const string IfNoneMatchAllHeaderValue = "*";
internal static readonly DateTime DateTimeStartFromBeginning = DateTime.MinValue.ToUniversalTime();
kirankumarkolli marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Specifies a particular point in time to start to read the change feed.
Expand All @@ -37,7 +38,8 @@ internal override void PopulateRequestOptions(RequestMessage request)
{
request.Headers.IfNoneMatch = ChangeFeedRequestOptions.IfNoneMatchAllHeaderValue;
}
else if (this.StartTime != null)
else if (this.StartTime != null
&& this.StartTime != ChangeFeedRequestOptions.DateTimeStartFromBeginning)
{
request.Headers.Add(HttpConstants.HttpHeaders.IfModifiedSince, this.StartTime.Value.ToUniversalTime().ToString("r", CultureInfo.InvariantCulture));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,18 @@ public void ChangeFeedRequestOptions_DefaultValues()
Assert.IsNull(request.Headers[Documents.HttpConstants.HttpHeaders.IfModifiedSince]);
}

[TestMethod]
public void ChangeFeedRequestOptions_StartFromBeginning()
{
RequestMessage request = new RequestMessage();
ChangeFeedRequestOptions requestOptions = new ChangeFeedRequestOptions() { StartTime = DateTime.MinValue.ToUniversalTime() };

requestOptions.PopulateRequestOptions(request);

Assert.IsNull(request.Headers.IfNoneMatch);
Assert.IsNull(request.Headers[Documents.HttpConstants.HttpHeaders.IfModifiedSince]);
}

[TestMethod]
public void ChangeFeedRequestOptions_MaxItemSizeIsSet()
{
Expand Down
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- [#944](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/944) Change Feed Processor won't use user serializer for internal operations
- [#988](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/988) Fixed query mutating due to retry of gone / name cache is stale.
- [#954](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/954) Support "Start from Beginning" for Change Feed Processor in multi master accounts
- [#999](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/999) Fixed grabbing extra page, updated continuation token on exception path, and non ascii character in order by continuation token.
- [#1013](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/1013) Gateway OperationCanceledException are now returned as request timeouts
- [#1023](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/1023) Fixed ThroughputResponse.IsReplacePending header mapping
Expand Down