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

Internal ReadFeed: Adds pagination library adoption #1947

Merged
merged 22 commits into from
Nov 2, 2020

Conversation

bchong95
Copy link
Contributor

Internal ReadFeed: Adds pagination library adoption

Description

Adds adoption of the pagination to finish unifying the feed story.

Related PRs:

From here on out all feed operations should call into a common library, which makes wiring things very easy.

@@ -83,24 +84,40 @@ public DocumentContainer(IMonadicDocumentContainer monadicDocumentContainer)
cancellationToken),
cancellationToken);

public Task<TryCatch<DocumentContainerPage>> MonadicReadFeedAsync(
public Task<TryCatch<ReadFeedPage>> MonadicReadFeedAsync(
Copy link
Contributor

Choose a reason for hiding this comment

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

Please run the MockedItemBenchmark.ReadFeed benchmark

@@ -190,6 +191,7 @@ public async Task ReadFeedIteratorCore_OfT_ReadAll_StopResume()
}

[TestMethod]
[Ignore]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these tests being ignored?

if ((overlappingRanges == null) || (overlappingRanges.Count != 1))
{
// Simulate a split exception, since we don't have a partition key range id to route to.
CosmosException goneException = new CosmosException(
Copy link
Member

Choose a reason for hiding this comment

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

Is this to force the cache refresh?

Copy link
Member

@ealsur ealsur Nov 2, 2020

Choose a reason for hiding this comment

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

Should we instead force a cache refresh here? Instead of throwing the exception up and hoping it gets caught and handled?

{
if (!(readFeedState.ContinuationToken is CosmosNull))
{
request.Headers.ContinuationToken = (readFeedState.ContinuationToken as CosmosString).Value;
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to guard against any potential nullref by checking if the continuation is a CosmosString in the upper if?

if (!(readFeedState.ContinuationToken is CosmosNull) && readFeedState.Continuation is CosmosString continuation)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will add polymorphism to the type.


In reply to: 516222386 [](ancestors = 516222386)

@sboshra sboshra merged commit a0d24da into master Nov 2, 2020
@sboshra sboshra deleted the users/brchon/ReadFeedUsePaginationLib branch November 2, 2020 20:15
continuation: continuationToken,
feedRangeInternal: feedRange,
options: requestOptions);
CosmosDiagnosticsContext readFeedDiagnostics = CosmosDiagnosticsContext.Create(requestOptions);
Copy link
Member

Choose a reason for hiding this comment

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

Where is the feedRange used now?

@@ -49,6 +49,7 @@ public async Task Cleanup()
}

[TestMethod]
[Ignore]
Copy link
Member

Choose a reason for hiding this comment

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

This test was to check that we could parallelize ReadFeed through FeedRanges, why was it ignored? Are we not allowing that scenario now?

@@ -351,19 +384,6 @@ await feedIterator.ReadNextAsync(this.cancellationToken))
Assert.AreEqual(batchSize, totalCount);
}

[TestMethod]
public async Task CannotMixTokensFromOtherContainers()
Copy link
Member

Choose a reason for hiding this comment

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

Why are we dropping the check for Rid? It would avoid users accidentally using a continuation that was not generated for the collection and getting incorrect results

Assert.AreEqual(Documents.Routing.PartitionKeyInternal.MaximumExclusiveEffectivePartitionKey, feedTokenEPKRange.Range.Max);
Assert.AreEqual(continuation, feedRangeCompositeContinuation.CompositeContinuationTokens.Peek().Token);
Assert.IsFalse(feedRangeCompositeContinuation.IsDone);
Assert.AreEqual(numItems, count);
Copy link
Member

Choose a reason for hiding this comment

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

This is just checking that the iterator can handle splits, not that the handling was not done through the pipeline (which was the original intent of the test before). To check that no handler was doing the split handling and that it was correctly handled on the iterator (so it checked the number of transport calls)


internal static class StreamExtensions
{
public static string ReadAsString(this Stream stream)
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't used anywhere?

@ghost
Copy link

ghost commented Dec 15, 2021

Closing due to in-activity, pease feel free to re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants