|
9 | 9 | using System.Net; |
10 | 10 | using System.Net.Security; |
11 | 11 | using System.Net.Sockets; |
| 12 | +using System.Runtime.CompilerServices; |
12 | 13 | using System.Security.Cryptography.X509Certificates; |
13 | 14 | using System.Text; |
14 | 15 | using System.Threading; |
15 | 16 | using System.Threading.Tasks; |
16 | 17 | using Garnet.client; |
17 | 18 | using Garnet.common; |
| 19 | +using Garnet.server; |
18 | 20 | using Garnet.server.TLS; |
19 | 21 | using GarnetClusterManagement; |
20 | 22 | using Microsoft.Extensions.Logging; |
@@ -2983,8 +2985,22 @@ public void WaitForReplicaAofSync(int primaryIndex, int secondaryIndex, ILogger |
2983 | 2985 | BackOff(cancellationToken: context.cts.Token, msg: $"[{endpoints[primaryIndex]}]: {primaryMainStoreVersion},{primaryReplicationOffset} != [{endpoints[secondaryIndex]}]: {replicaMainStoreVersion},{secondaryReplicationOffset1}"); |
2984 | 2986 | } |
2985 | 2987 | 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(); |
2986 | 2999 | } |
2987 | 3000 |
|
| 3001 | + [UnsafeAccessor(UnsafeAccessorKind.Field, Name = "storeWrapper")] |
| 3002 | + private static extern ref StoreWrapper GetStoreWrapper(GarnetServer server); |
| 3003 | + |
2988 | 3004 | public void WaitForConnectedReplicaCount(int primaryIndex, long minCount, ILogger logger = null) |
2989 | 3005 | { |
2990 | 3006 | while (true) |
|
0 commit comments