-
Notifications
You must be signed in to change notification settings - Fork 624
Fix latency-compensated query missing patch mutations. #621
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
Conversation
@@ -182,6 +184,14 @@ private MaybeDocument getDocument(DocumentKey key, List<MutationBatch> inBatches | |||
remoteDocumentCache.getAllDocumentsMatchingQuery(query); | |||
|
|||
List<MutationBatch> matchingBatches = mutationQueue.getAllMutationBatchesAffectingQuery(query); | |||
// It is possible that a PatchMutation can make a document match a query, even if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a useful comment but it interrupts the flow of this otherwise large method. Consider moving this to be a doc comment on your new method (which doesn't otherwise have comments).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -210,4 +215,33 @@ private MaybeDocument getDocument(DocumentKey key, List<MutationBatch> inBatches | |||
|
|||
return results; | |||
} | |||
|
|||
/** | |||
* It is possible that a PatchMutation can make a document match a query, even if the version in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ultranit: some class/function names are backtick-escaped, and some aren't. Consider doing backticks for consistency (PatchMutation
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't backtick in javadoc. There's no markdown support. Use <code>
/</code>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Looking at other comments in the file, they use {@code foo}.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
/** | ||
* It is possible that a PatchMutation can make a document match a query, even if the version in | ||
* the RemoteDocumentCache is not a match yet (waiting for server to ack). To handle this, we find |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ultranit: backtick RemoteDocumentCache
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
/** | ||
* It is possible that a PatchMutation can make a document match a query, even if the version in | ||
* the RemoteDocumentCache is not a match yet (waiting for server to ack). To handle this, we find | ||
* all document keys affected by the PatchMutations that are not in `result` yet, and back fill |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ultranit: backtick PatchMutation
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
* the RemoteDocumentCache is not a match yet (waiting for server to ack). To handle this, we find | ||
* all document keys affected by the PatchMutations that are not in `result` yet, and back fill | ||
* them via `remoteDocumentCache.getAll`, otherwise those `PatchMutations` will be ignored because | ||
* no base document can be found, and lead to missing result for the query. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ultranit: s/result/results
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
*/ | ||
private ImmutableSortedMap<DocumentKey, Document> addMissingBaseDocuments( | ||
List<MutationBatch> matchingBatches, ImmutableSortedMap<DocumentKey, Document> existingDocs) { | ||
HashSet<DocumentKey> missedDocKeys = new HashSet<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: s/missedDocKeys/missingDocKeys.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
} | ||
|
||
ImmutableSortedMap<DocumentKey, Document> mergedDocs = existingDocs; | ||
Map<DocumentKey, MaybeDocument> missedDoc = remoteDocumentCache.getAll(missedDocKeys); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: s/missedDoc/missingDocs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
} | ||
|
||
ImmutableSortedMap<DocumentKey, Document> mergedDocs = existingDocs; | ||
Map<DocumentKey, MaybeDocument> missingDoc = remoteDocumentCache.getAll(missingDocKeys); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to nitpick, but it should be missingDocs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thank you!
No description provided.