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

5.4 to 6.0 merge #18507

Merged
merged 21 commits into from May 14, 2024
Merged

5.4 to 6.0 merge #18507

merged 21 commits into from May 14, 2024

Conversation

arekpalinski
Copy link
Member

garayx and others added 19 commits May 10, 2024 13:34
-Move projections to use generic document instead of `Document`.
-Track referenceCount for releasing the memory
-Prevent leak in case of  compressed db
- Release all related memory to the projected document
…rectGetInternal as base method to retrieve document from cache.
- When PulseTransaction creates a new transaction, we need to clear the cache to avoid invalid pointers
- Move QueriedDocument to a dedicated file
- Optimise QueriedDocument list for single reference
- Rename variables within `QueriedDocument` to make them more meaningful
- Handling of non-existing documents in the cache for memory calls
…ded the document but suspend the current document object.
 - Created QueriedDocumentCache to move logic with QueriedDocument from LRU Dictionary
 - Unified disposal logic
 - Added assert messages
 - Explained OnPulse functionality in comment
- Asserts fix for map-reduce
-In case of fanout projection we need to increase reference counter to avoid disposing document.
-Avoid typeof(QueriedDocument) in QueryResultRetrieverBase
-Added implementation for increasing/linking documents to LruDictionaries to avoid type casts in QueryResultRetrieverBase.
# Conflicts:
#	src/Raven.Server/Documents/Document.cs
#	src/Raven.Server/Documents/DocumentsStorage.cs
#	src/Raven.Server/Documents/Indexes/Persistence/Corax/CoraxIndexQueryingScope.cs
#	src/Raven.Server/Documents/Indexes/Persistence/Corax/CoraxIndexReadOperation.cs
#	src/Raven.Server/Documents/Indexes/Persistence/IndexOperationBase.cs
#	src/Raven.Server/Documents/Indexes/Persistence/IndexReadOperationBase.cs
#	src/Raven.Server/Documents/Indexes/Persistence/Lucene/LuceneIndexReadOperation.cs
#	src/Raven.Server/Documents/Indexes/Persistence/QueryFilter.cs
#	src/Raven.Server/Documents/Queries/CollectionQueryEnumerable.cs
#	src/Raven.Server/Documents/Queries/Results/GraphQueryResultRetriever.cs
#	src/Raven.Server/Documents/Queries/Results/IQueryResultRetriever.cs
#	src/Raven.Server/Documents/Queries/Results/MapQueryResultRetriever.cs
#	src/Raven.Server/Documents/Queries/Results/MapReduceQueryResultRetriever.cs
#	src/Raven.Server/Documents/Queries/Results/QueryResultRetrieverBase.cs
#	src/Raven.Server/Documents/Queries/Results/TimeSeries/TimeSeriesRetriever.cs
#	src/Raven.Server/Documents/ResourceCache.cs
#	test/Tests.Infrastructure/RavenTestCategory.cs
@arekpalinski
Copy link
Member Author

test this in debug please

@arekpalinski
Copy link
Member Author

test this in debug please

public IEnumerable<Document> GetDocumentsStartingWith(DocumentsOperationContext context, string idPrefix, string startAfterId,
long start, long take, string collection, Reference<long> skippedResults, DocumentFields fields = DocumentFields.All, CancellationToken token = default)
=> GetDocumentsStartingWith(context, idPrefix, startAfterId, start, take, collection, skippedResults, fields, token);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
=> GetDocumentsStartingWith(context, idPrefix, startAfterId, start, take, collection, skippedResults, fields, token);
=> GetDocumentsStartingWith<Document>(context, idPrefix, startAfterId, start, take, collection, skippedResults, fields, token);

otherwise it's recursive call

Copy link
Member

Choose a reason for hiding this comment

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

BTW, we need to think about where this scenario might happen and add a test for it.

Copy link
Member

Choose a reason for hiding this comment

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

It was unused, I've removed it. The only call to GetDocumentsStartingWith is from CollectionQuery which is now changed to QueriedDocument.

public abstract class QueryResultRetrieverBase<TDocument> : QueryResultRetrieverCommon, IQueryResultRetriever<TDocument>
where TDocument : Document, new()
{
private const string CurrentRootDocumentMarker = "@root-doc";
Copy link
Member

Choose a reason for hiding this comment

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

I managed to create document with that id:
image

Maybe it's worth to add GUID to it? We use same tricks in Corax:

public const string BeforeAllKeys = "BeforeAllKeys-a8e5f221-613e-4eae-9962-2689e7c44506";
public const string AfterAllKeys = "AfterAllKeys-3622a0bb-1cf4-4200-b830-5e937d57ac99";

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's leave it as it was earlier (string.Empty) and not introduce a new marker here.

using Raven.Server.Documents.Queries.AST;

namespace Raven.Server.Documents.Sharding.Queries;

public sealed class ShardedQueryResultDocument : Document
public sealed class ShardedQueryResultDocument : QueriedDocument
Copy link
Member

Choose a reason for hiding this comment

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

ShardedQueryResultDocument is from QueriedDocument but ShardedMapReduceResultRetriever is using Document. Let's talk about it directly

@arekpalinski arekpalinski merged commit efc0942 into ravendb:v6.0 May 14, 2024
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants