Skip to content

Commit 424d5ae

Browse files
wait for vector set replay to quiesce when waiting for replica sync to catch up
1 parent 045714e commit 424d5ae

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

test/Garnet.test.cluster/ClusterTestUtils.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99
using System.Net;
1010
using System.Net.Security;
1111
using System.Net.Sockets;
12+
using System.Runtime.CompilerServices;
1213
using System.Security.Cryptography.X509Certificates;
1314
using System.Text;
1415
using System.Threading;
1516
using System.Threading.Tasks;
1617
using Garnet.client;
1718
using Garnet.common;
19+
using Garnet.server;
1820
using Garnet.server.TLS;
1921
using GarnetClusterManagement;
2022
using Microsoft.Extensions.Logging;
@@ -2983,8 +2985,22 @@ public void WaitForReplicaAofSync(int primaryIndex, int secondaryIndex, ILogger
29832985
BackOff(cancellationToken: context.cts.Token, msg: $"[{endpoints[primaryIndex]}]: {primaryMainStoreVersion},{primaryReplicationOffset} != [{endpoints[secondaryIndex]}]: {replicaMainStoreVersion},{secondaryReplicationOffset1}");
29842986
}
29852987
logger?.LogInformation("[{primaryEndpoint}]{primaryReplicationOffset} ?? [{endpoints[secondaryEndpoint}]{secondaryReplicationOffset1}", endpoints[primaryIndex], primaryReplicationOffset, endpoints[secondaryIndex], secondaryReplicationOffset1);
2988+
2989+
WaitForVectorSetReplayQuiescence(secondaryIndex, logger);
2990+
}
2991+
2992+
public void WaitForVectorSetReplayQuiescence(int index, ILogger logger = null)
2993+
{
2994+
var server = this.context.nodes[index];
2995+
var storeWrapper = GetStoreWrapper(server);
2996+
var vectorManager = storeWrapper.DefaultDatabase.VectorManager;
2997+
2998+
vectorManager?.WaitForVectorOperationsToComplete();
29862999
}
29873000

3001+
[UnsafeAccessor(UnsafeAccessorKind.Field, Name = "storeWrapper")]
3002+
private static extern ref StoreWrapper GetStoreWrapper(GarnetServer server);
3003+
29883004
public void WaitForConnectedReplicaCount(int primaryIndex, long minCount, ILogger logger = null)
29893005
{
29903006
while (true)

0 commit comments

Comments
 (0)