Skip to content

Commit

Permalink
RavenDB-23534 - delete the notifications for the database using the t…
Browse files Browse the repository at this point in the history
…x merger
  • Loading branch information
grisha-kotler committed Feb 11, 2025
1 parent a079c6f commit c24f180
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/Raven.Server/NotificationCenter/NotificationsStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -439,13 +439,8 @@ public void DeleteStorageFor(string database)
throw new ArgumentNullException(nameof(database));

var tableName = GetTableName(database);

using (var tx = Environment.WriteTransaction())
{
tx.DeleteTable(tableName);

tx.Commit();
}
var command = new DeleteTableForNotificationsCommand(tableName);
serverStore.Engine.TxMerger.EnqueueSync(command);
}

public void DeleteStorageFor<T>(TransactionOperationContext<T> ctx, string database) where T : RavenTransaction
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using Raven.Server.Documents.TransactionMerger.Commands;
using Raven.Server.ServerWide.Context;

namespace Raven.Server.Rachis.Commands;

public class DeleteTableForNotificationsCommand : MergedTransactionCommand<ClusterOperationContext, ClusterTransaction>
{
private readonly string _tableName;

public DeleteTableForNotificationsCommand(string tableName)
{
_tableName = tableName;
}

protected override long ExecuteCmd(ClusterOperationContext context)
{
context.Transaction.InnerTransaction.DeleteTable(_tableName);
return 1;
}

public override IReplayableCommandDto<ClusterOperationContext, ClusterTransaction, MergedTransactionCommand<ClusterOperationContext, ClusterTransaction>> ToDto(ClusterOperationContext context)
{
throw new NotImplementedException();
}
}

0 comments on commit c24f180

Please sign in to comment.