From 05c02c8132b7c496e948c7659a77e1f2ac1648ef Mon Sep 17 00:00:00 2001 From: aviv Date: Wed, 8 May 2024 13:58:18 +0300 Subject: [PATCH] RavenDB-20325 : cleanup --- src/Raven.Server/Documents/Handlers/TimeSeriesHandler.cs | 4 +--- src/Raven.Server/Smuggler/Documents/CsvStreamSource.cs | 2 +- .../Smuggler/Documents/Data/ISmugglerDestination.cs | 2 +- src/Raven.Server/Smuggler/Documents/DatabaseDestination.cs | 2 +- src/Raven.Server/Smuggler/Documents/DatabaseSmuggler.cs | 2 +- src/Raven.Server/Smuggler/Documents/DatabaseSource.cs | 5 ----- src/Raven.Server/Smuggler/Documents/SmugglerDocumentType.cs | 1 + src/Raven.Server/Smuggler/Documents/StreamDestination.cs | 6 +++--- 8 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/Raven.Server/Documents/Handlers/TimeSeriesHandler.cs b/src/Raven.Server/Documents/Handlers/TimeSeriesHandler.cs index 9fa887fc1181..8c9e235aa718 100644 --- a/src/Raven.Server/Documents/Handlers/TimeSeriesHandler.cs +++ b/src/Raven.Server/Documents/Handlers/TimeSeriesHandler.cs @@ -1213,7 +1213,6 @@ protected override long ExecuteCmd(DocumentsOperationContext context) foreach (var (docId, items) in _deletedRanges) { - //var collectionName = _database.DocumentsStorage.ExtractCollectionName(context, items[0].Collection); foreach (var item in items) { using (item) @@ -1278,11 +1277,10 @@ public bool AddToDictionary(TimeSeriesItem item) public bool AddToDeletedRanges(TimeSeriesDeletedRangeItem item) { bool newItem = false; - //TimeSeriesValuesSegment.ParseTimeSeriesKey(item.Key.Buffer, item.Size, _context, out var docId, out _); if (_deletedRanges.TryGetValue(item.DocId, out var deletedRangesList) == false) { - _deletedRanges[item.DocId] = deletedRangesList = new List(); + _deletedRanges[item.DocId] = deletedRangesList = []; newItem = true; } diff --git a/src/Raven.Server/Smuggler/Documents/CsvStreamSource.cs b/src/Raven.Server/Smuggler/Documents/CsvStreamSource.cs index c7f318eaefca..e39d30a4297e 100644 --- a/src/Raven.Server/Smuggler/Documents/CsvStreamSource.cs +++ b/src/Raven.Server/Smuggler/Documents/CsvStreamSource.cs @@ -446,7 +446,7 @@ public SmugglerSourceType GetSourceType() public IAsyncEnumerable GetTimeSeriesDeletedRangesAsync(ITimeSeriesActions action, List collectionsToExport) { - throw new NotImplementedException(); + return AsyncEnumerable.Empty(); } public void Dispose() diff --git a/src/Raven.Server/Smuggler/Documents/Data/ISmugglerDestination.cs b/src/Raven.Server/Smuggler/Documents/Data/ISmugglerDestination.cs index b34c069e816e..0ae028cdb2a7 100644 --- a/src/Raven.Server/Smuggler/Documents/Data/ISmugglerDestination.cs +++ b/src/Raven.Server/Smuggler/Documents/Data/ISmugglerDestination.cs @@ -127,7 +127,7 @@ public interface ITimeSeriesActions : IAsyncDisposable, INewItemActions { ValueTask WriteTimeSeriesAsync(TimeSeriesItem ts); - ValueTask WriteTimeSeriesDeletedRangeAsync(TimeSeriesDeletedRangeItem ts); + ValueTask WriteDeletedRangeAsync(TimeSeriesDeletedRangeItem ts); void RegisterForDisposal(IDisposable data); diff --git a/src/Raven.Server/Smuggler/Documents/DatabaseDestination.cs b/src/Raven.Server/Smuggler/Documents/DatabaseDestination.cs index cc7f33946cf8..e53639035a60 100644 --- a/src/Raven.Server/Smuggler/Documents/DatabaseDestination.cs +++ b/src/Raven.Server/Smuggler/Documents/DatabaseDestination.cs @@ -2404,7 +2404,7 @@ public async ValueTask WriteTimeSeriesAsync(TimeSeriesItem ts) await HandleBatchOfTimeSeriesIfNecessaryAsync(); } - public async ValueTask WriteTimeSeriesDeletedRangeAsync(TimeSeriesDeletedRangeItem deletedRange) + public async ValueTask WriteDeletedRangeAsync(TimeSeriesDeletedRangeItem deletedRange) { AddToBatch(deletedRange); await HandleBatchOfTimeSeriesIfNecessaryAsync(); diff --git a/src/Raven.Server/Smuggler/Documents/DatabaseSmuggler.cs b/src/Raven.Server/Smuggler/Documents/DatabaseSmuggler.cs index 3b975dad9efb..aaa61a81ae60 100644 --- a/src/Raven.Server/Smuggler/Documents/DatabaseSmuggler.cs +++ b/src/Raven.Server/Smuggler/Documents/DatabaseSmuggler.cs @@ -1249,7 +1249,7 @@ static bool ShouldSkip(TimeSeriesItem ts, SmugglerPatcher patcher, bool isFullBa AddInfoToSmugglerResult(result, $"Time Series deleted ranges entries {result.TimeSeriesDeletedRanges}"); if (ShouldSkip(deletedRange, _patcher) == false) - await actions.WriteTimeSeriesDeletedRangeAsync(deletedRange); + await actions.WriteDeletedRangeAsync(deletedRange); else result.TimeSeriesDeletedRanges.SkippedCount++; diff --git a/src/Raven.Server/Smuggler/Documents/DatabaseSource.cs b/src/Raven.Server/Smuggler/Documents/DatabaseSource.cs index eb8702a46a6e..e4122391812e 100644 --- a/src/Raven.Server/Smuggler/Documents/DatabaseSource.cs +++ b/src/Raven.Server/Smuggler/Documents/DatabaseSource.cs @@ -57,14 +57,9 @@ public class DatabaseSource : ISmugglerSource DatabaseItemType.CompareExchangeTombstones, DatabaseItemType.CounterGroups, DatabaseItemType.Subscriptions, - - DatabaseItemType.TimeSeriesDeletedRanges, - - DatabaseItemType.TimeSeries, DatabaseItemType.ReplicationHubCertificates, - //DatabaseItemType.TimeSeriesDeletedRanges, DatabaseItemType.None }; diff --git a/src/Raven.Server/Smuggler/Documents/SmugglerDocumentType.cs b/src/Raven.Server/Smuggler/Documents/SmugglerDocumentType.cs index 6cee680321f3..74f6ea5387ec 100644 --- a/src/Raven.Server/Smuggler/Documents/SmugglerDocumentType.cs +++ b/src/Raven.Server/Smuggler/Documents/SmugglerDocumentType.cs @@ -110,6 +110,7 @@ public void Dispose() DocId?.Dispose(); Name?.Dispose(); Collection?.Dispose(); + ChangeVector?.Dispose(); } } } diff --git a/src/Raven.Server/Smuggler/Documents/StreamDestination.cs b/src/Raven.Server/Smuggler/Documents/StreamDestination.cs index c0a836700e44..fbbb416a5645 100644 --- a/src/Raven.Server/Smuggler/Documents/StreamDestination.cs +++ b/src/Raven.Server/Smuggler/Documents/StreamDestination.cs @@ -1142,7 +1142,7 @@ public async ValueTask WriteTimeSeriesAsync(TimeSeriesItem item) } } - public async ValueTask WriteTimeSeriesDeletedRangeAsync(TimeSeriesDeletedRangeItem deletedRangeItem) + public async ValueTask WriteDeletedRangeAsync(TimeSeriesDeletedRangeItem deletedRangeItem) { using (deletedRangeItem) { @@ -1170,11 +1170,11 @@ public async ValueTask WriteTimeSeriesDeletedRangeAsync(TimeSeriesDeletedRangeIt Writer.WriteComma(); Writer.WritePropertyName(nameof(TimeSeriesDeletedRangeItem.From)); - Writer.WriteDateTime(deletedRangeItem.From, true); + Writer.WriteDateTime(deletedRangeItem.From, isUtc: true); Writer.WriteComma(); Writer.WritePropertyName(nameof(TimeSeriesDeletedRangeItem.To)); - Writer.WriteDateTime(deletedRangeItem.To, true); + Writer.WriteDateTime(deletedRangeItem.To, isUtc: true); Writer.WriteEndObject();