-
Notifications
You must be signed in to change notification settings - Fork 820
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
RavenDB-14963 - All revisions view #18504
base: v6.0
Are you sure you want to change the base?
Conversation
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.
Looks good, most of the pieces are in place.
Can we also add few tests for this?
...eb/Studio/Sharding/Processors/ShardedStudioCollectionsHandlerProcessorForPreviewRevisions.cs
Outdated
Show resolved
Hide resolved
...Server/Web/Studio/Processors/AbstractStudioCollectionsHandlerProcessorForPreviewRevisions.cs
Outdated
Show resolved
Hide resolved
...Server/Web/Studio/Processors/AbstractStudioCollectionsHandlerProcessorForPreviewRevisions.cs
Outdated
Show resolved
Hide resolved
...Server/Web/Studio/Processors/AbstractStudioCollectionsHandlerProcessorForPreviewRevisions.cs
Outdated
Show resolved
Hide resolved
...Server/Web/Studio/Processors/AbstractStudioCollectionsHandlerProcessorForPreviewRevisions.cs
Outdated
Show resolved
Hide resolved
...eb/Studio/Sharding/Processors/ShardedStudioCollectionsHandlerProcessorForPreviewRevisions.cs
Outdated
Show resolved
Hide resolved
src/Raven.Server/Documents/Sharding/ShardedDatabaseContext.Streaming.cs
Outdated
Show resolved
Hide resolved
...Server/Web/Studio/Processors/AbstractStudioCollectionsHandlerProcessorForPreviewRevisions.cs
Outdated
Show resolved
Hide resolved
...eb/Studio/Sharding/Processors/ShardedStudioCollectionsHandlerProcessorForPreviewRevisions.cs
Show resolved
Hide resolved
...eb/Studio/Sharding/Processors/ShardedStudioCollectionsHandlerProcessorForPreviewRevisions.cs
Outdated
Show resolved
Hide resolved
var first = true; | ||
foreach (var revision in revisions) | ||
{ | ||
if (first) | ||
first = false; | ||
else | ||
writer.WriteComma(); | ||
|
||
writer.WriteStartObject(); | ||
|
||
writer.WritePropertyName(nameof(Document.Id)); | ||
writer.WriteString(revision.Id); | ||
writer.WriteComma(); | ||
|
||
writer.WritePropertyName(nameof(Document.Etag)); | ||
writer.WriteInteger(revision.Etag); | ||
writer.WriteComma(); | ||
|
||
writer.WritePropertyName(nameof(Document.LastModified)); | ||
writer.WriteDateTime(revision.LastModified, true); | ||
writer.WriteComma(); | ||
|
||
writer.WritePropertyName(nameof(Document.ChangeVector)); | ||
writer.WriteString(revision.ChangeVector); | ||
writer.WriteComma(); | ||
|
||
writer.WritePropertyName(nameof(Document.Flags)); | ||
writer.WriteString(revision.Flags.ToString()); | ||
|
||
writer.WriteEndObject(); | ||
} | ||
|
||
writer.WriteEndArray(); |
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.
Would be nice we could unify this code with the sharded one...
for that I guess we will need to project the revision to something like
(Id, Etag, LastModified, ChangeVector, Flags)
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.
handle rest of the comments first and ping about this one at the end
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.
Talked about it and decided to pass
...Server/Web/Studio/Processors/AbstractStudioCollectionsHandlerProcessorForPreviewRevisions.cs
Outdated
Show resolved
Hide resolved
69f4d61
to
6fe675b
Compare
using System; | ||
using System.Collections.Generic; |
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.
revert
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.
cannot remove the using System.Collections.Generic;
} | ||
|
||
if (etag != null) | ||
HttpContext.Response.Headers["ETag"] = "\"" + etag + "\""; |
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.
use Constants.Headers.Etag here
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
writer.WriteComma(); | ||
|
||
writer.WritePropertyName(nameof(PreviewRevisionsResult.Results)); | ||
await WriteItems(context, writer); |
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.
WriteItemsAsync
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
@@ -21,5 +22,13 @@ public async Task Delete() | |||
using (var processor = new ShardedStudioCollectionHandlerProcessorForDeleteCollection(this)) | |||
await processor.ExecuteAsync(); | |||
} | |||
|
|||
[RavenShardedAction("/databases/*/studio/revisions/preview", "GET")] | |||
|
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.
formatting
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
22ee945
to
e055e88
Compare
public IEnumerable<Document> GetRevisionsInReverseEtagOrder(DocumentsOperationContext context, int skip, int take) | ||
{ | ||
return GetRevisionsInReverseEtagOrderInternal(context, | ||
table: new Table(RevisionsSchema, context.Transaction.InnerTransaction), |
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.
We have CompressedRevisionsSchema
as well. Don't we need to distinguish here based on _database.DocumentsCompression.CompressRevisions
?
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
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.
public IEnumerable<Document> GetRevisionsInReverseEtagOrderForCollection(DocumentsOperationContext context, string collection, int skip, int take) | ||
{ | ||
var collectionName = _documentsStorage.ExtractCollectionName(context, collection); | ||
var table = EnsureRevisionTableCreated(context.Transaction.InnerTransaction, collectionName); |
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.
Here EnsureRevisionTableCreated
does the _database.DocumentsCompression.CompressRevisions
check under the covers
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
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.
We should do this compression check only on write.
The CompressedRevisionsSchema and the RevisionsSchema are basically the same, except the Compressed
property.
We use this property only on write.
On read we look at the page metadata, to see whether it (the page) is compressed or not.
so I reverted those changes.
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.
ok
ca41a69
to
e4bb76a
Compare
e4bb76a
to
e13a918
Compare
e13a918
to
fc4554f
Compare
return table.GetNumberOfEntriesFor(RevisionsSchema.FixedSizeIndexes[CollectionRevisionsEtagsSlice]); | ||
} | ||
|
||
internal Table GetOrCreateTable(Transaction tx, CollectionName collection) |
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.
why not to use EnsureRevisionTableCreated
instead ?
{ | ||
Collection = RequestHandler.GetStringQueryString("collection", required: false); | ||
|
||
if (NotModified(context, out var etag)) |
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.
how can this be before InitializeAsync
? how would the sharded database know it is not modified?
Issue link
https://issues.hibernatingrhinos.com/issue/RavenDB-14963/All-revisions-view
Additional description
Add All revisions view EP
Type of change
How risky is the change?
Backward compatibility
Is it platform specific issue?
Documentation update
Documentation Required
tag.Testing by Contributor
private
)Testing by RavenDB QA team
QA Required
tag.Is there any existing behavior change of other features due to this change?
UI work
Studio Required
tag.