@@ -85,27 +85,6 @@ private unsafe byte[] CreateCookie()
85
85
return cookie ;
86
86
}
87
87
88
- private unsafe int GetCookieData ( HybridLogRecoveryInfo hlri , out long checkpointCoveredAddress , out string primaryReplId )
89
- {
90
- checkpointCoveredAddress = - 1 ;
91
- primaryReplId = null ;
92
-
93
- var bytesRead = sizeof ( int ) ;
94
- fixed ( byte * ptr = hlri . cookie )
95
- {
96
- if ( hlri . cookie . Length < 4 ) throw new Exception ( $ "invalid metadata length: { hlri . cookie . Length } < 4") ;
97
- var cookieSize = * ( int * ) ptr ;
98
- bytesRead += cookieSize ;
99
-
100
- if ( hlri . cookie . Length < 12 ) throw new Exception ( $ "invalid metadata length: { hlri . cookie . Length } < 12") ;
101
- checkpointCoveredAddress = * ( long * ) ( ptr + 4 ) ;
102
-
103
- if ( hlri . cookie . Length < 52 ) throw new Exception( $ "invalid metadata length: { hlri . cookie . Length } < 52") ;
104
- primaryReplId = Encoding. ASCII . GetString ( ptr + 12 , 40 ) ;
105
- }
106
- return bytesRead ;
107
- }
108
-
109
88
private HybridLogRecoveryInfo ConverMetadata ( byte [ ] checkpointMetadata )
110
89
{
111
90
var success = true ;
@@ -200,7 +179,7 @@ public void CommiLogCheckpointSendFromPrimary(Guid logToken, byte[] checkpointMe
200
179
/// <param name="hlri"></param>
201
180
public override unsafe void CommitLogCheckpoint ( Guid logToken , HybridLogRecoveryInfo hlri )
202
181
{
203
- CommitCookie = CreateCookie ( ) ;
182
+ AddCookie ( CreateCookie ( ) ) ;
204
183
base . CommitLogCheckpoint ( logToken , hlri ) ;
205
184
}
206
185
@@ -212,7 +191,7 @@ public override unsafe void CommitLogCheckpoint(Guid logToken, HybridLogRecovery
212
191
/// <param name="deltaLog"></param>
213
192
public override unsafe void CommitLogIncrementalCheckpoint ( Guid logToken , HybridLogRecoveryInfo hlri , DeltaLog deltaLog )
214
193
{
215
- CommitCookie = CreateCookie ( ) ;
194
+ AddCookie ( CreateCookie ( ) ) ;
216
195
base . CommitLogIncrementalCheckpoint ( logToken , hlri , deltaLog ) ;
217
196
}
218
197
@@ -223,6 +202,27 @@ public unsafe (long, string) GetCheckpointCookieMetadata(Guid logToken, DeltaLog
223
202
var bytesRead = GetCookieData ( hlri , out var RecoveredSafeAofAddress , out var RecoveredReplicationId ) ;
224
203
Debug . Assert ( bytesRead == 52 ) ;
225
204
return ( RecoveredSafeAofAddress , RecoveredReplicationId ) ;
205
+
206
+ unsafe int GetCookieData ( HybridLogRecoveryInfo hlri , out long checkpointCoveredAddress , out string primaryReplId )
207
+ {
208
+ checkpointCoveredAddress = - 1 ;
209
+ primaryReplId = null ;
210
+
211
+ var bytesRead = sizeof ( int ) ;
212
+ fixed ( byte * ptr = hlri . cookie )
213
+ {
214
+ if ( hlri . cookie . Length < 4 ) throw new Exception ( $ "invalid metadata length: { hlri . cookie . Length } < 4") ;
215
+ var cookieSize = * ( int * ) ptr ;
216
+ bytesRead += cookieSize ;
217
+
218
+ if ( hlri . cookie . Length < 12 ) throw new Exception ( $ "invalid metadata length: { hlri . cookie . Length } < 12") ;
219
+ checkpointCoveredAddress = * ( long * ) ( ptr + 4 ) ;
220
+
221
+ if ( hlri . cookie . Length < 52 ) throw new Exception( $ "invalid metadata length: { hlri . cookie . Length } < 52") ;
222
+ primaryReplId = Encoding. ASCII . GetString ( ptr + 12 , 40 ) ;
223
+ }
224
+ return bytesRead ;
225
+ }
226
226
}
227
227
228
228
public override void GetLogCheckpointMetadataInfo ( ref HybridLogRecoveryInfo hlri , Guid logToken , DeltaLog deltaLog , bool scanDelta , long recoverTo )
0 commit comments