@@ -163,6 +163,7 @@ protected async Task BecomeLeaderSucceedsWhenEpochIsAsExpected(Task<IFunctionSto
163163
164164 var store = await storeTask ;
165165 var paramJson = PARAM . ToJson ( ) ;
166+ var owner = ReplicaId . NewId ( ) ;
166167
167168 await store . CreateFunction (
168169 functionId ,
@@ -180,13 +181,15 @@ await store
180181 . RestartExecution (
181182 functionId ,
182183 expectedEpoch : 0 ,
183- leaseExpiration
184+ leaseExpiration ,
185+ owner
184186 ) . ShouldNotBeNullAsync ( ) ;
185187
186188 var storedFunction = await store . GetFunction ( functionId ) ;
187189 storedFunction . ShouldNotBeNull ( ) ;
188190 storedFunction . Epoch . ShouldBe ( 1 ) ;
189191 storedFunction . Expires . ShouldBe ( leaseExpiration ) ;
192+ storedFunction . OwnerId . ShouldBe ( owner ) ;
190193 }
191194
192195 public abstract Task BecomeLeaderFailsWhenEpochIsNotAsExpected ( ) ;
@@ -213,13 +216,15 @@ await store
213216 . RestartExecution (
214217 functionId ,
215218 expectedEpoch : 1 ,
216- leaseExpiration : DateTime . UtcNow . Ticks
219+ leaseExpiration : DateTime . UtcNow . Ticks ,
220+ owner : ReplicaId . NewId ( )
217221 ) . ShouldBeNullAsync ( ) ;
218222
219223 var storedFunction = await store . GetFunction ( functionId ) ;
220224 storedFunction . ShouldNotBeNull ( ) ;
221225 storedFunction . Epoch . ShouldBe ( 0 ) ;
222226 storedFunction . Expires . ShouldBe ( leaseExpiration ) ;
227+ storedFunction . OwnerId . ShouldBeNull ( ) ;
223228 }
224229
225230 public abstract Task CreatingTheSameFunctionTwiceReturnsFalse ( ) ;
@@ -482,7 +487,7 @@ await store.CreateFunction(
482487 owner : null
483488 ) . ShouldBeTrueAsync ( ) ;
484489
485- await store . RestartExecution ( functionId , expectedEpoch : 0 , DateTime . UtcNow . Ticks ) . ShouldNotBeNullAsync ( ) ;
490+ await store . RestartExecution ( functionId , expectedEpoch : 0 , DateTime . UtcNow . Ticks , owner : ReplicaId . NewId ( ) ) . ShouldNotBeNullAsync ( ) ;
486491
487492 var sf = await store . GetFunction ( functionId ) ;
488493 sf . ShouldNotBeNull ( ) ;
@@ -506,7 +511,7 @@ await store.CreateFunction(
506511 owner : null
507512 ) . ShouldBeTrueAsync ( ) ;
508513
509- await store . RestartExecution ( functionId , expectedEpoch : 1 , leaseExpiration : DateTime . UtcNow . Ticks ) . ShouldBeNullAsync ( ) ;
514+ await store . RestartExecution ( functionId , expectedEpoch : 1 , leaseExpiration : DateTime . UtcNow . Ticks , owner : ReplicaId . NewId ( ) ) . ShouldBeNullAsync ( ) ;
510515
511516 var sf = await store . GetFunction ( functionId ) ;
512517 sf . ShouldNotBeNull ( ) ;
@@ -763,12 +768,14 @@ await store.CreateFunction(
763768 await store . RestartExecution (
764769 functionId ,
765770 expectedEpoch : 0 ,
766- leaseExpiration : DateTime . UtcNow . Ticks
771+ leaseExpiration : DateTime . UtcNow . Ticks ,
772+ owner : ReplicaId . NewId ( )
767773 ) . ShouldNotBeNullAsync ( ) ;
768774 await store . RestartExecution (
769775 functionId ,
770776 expectedEpoch : 0 ,
771- leaseExpiration : DateTime . UtcNow . Ticks
777+ leaseExpiration : DateTime . UtcNow . Ticks ,
778+ owner : ReplicaId . NewId ( )
772779 ) . ShouldBeNullAsync ( ) ;
773780 }
774781
@@ -796,7 +803,8 @@ await store.CreateFunction(
796803 await store . RestartExecution (
797804 functionId ,
798805 expectedEpoch : 0 ,
799- leaseExpiration : DateTime . UtcNow . Ticks
806+ leaseExpiration : DateTime . UtcNow . Ticks ,
807+ owner : ReplicaId . NewId ( )
800808 ) . ShouldNotBeNullAsync ( ) ;
801809
802810 await store . Interrupted ( functionId ) . ShouldBeAsync ( false ) ;
@@ -1462,7 +1470,7 @@ await store.CreateFunction(
14621470 parent : null ,
14631471 owner : null
14641472 ) . ShouldBeTrueAsync ( ) ;
1465- await store . RestartExecution ( id2 , expectedEpoch : 0 , leaseExpiration : 0 ) ;
1473+ await store . RestartExecution ( id2 , expectedEpoch : 0 , leaseExpiration : 0 , owner : ReplicaId . NewId ( ) ) ;
14661474 await store . CreateFunction (
14671475 id3 ,
14681476 humanInstanceId : "SomeInstanceId3" ,
@@ -1858,7 +1866,8 @@ await store.EffectsStore.SetEffectResult(
18581866 . RestartExecution (
18591867 functionId ,
18601868 expectedEpoch : 0 ,
1861- leaseExpiration
1869+ leaseExpiration ,
1870+ owner : ReplicaId . NewId ( )
18621871 ) . ShouldNotBeNullAsync ( ) ;
18631872
18641873 sf . StoredId . ShouldBe ( functionId ) ;
@@ -1876,6 +1885,7 @@ protected async Task RestartExecutionWorksWithEmptyEffectsAndMessages(Task<IFunc
18761885
18771886 var store = await storeTask ;
18781887 var paramJson = PARAM . ToJson ( ) ;
1888+ var owner = ReplicaId . NewId ( ) ;
18791889
18801890 await store . CreateFunction (
18811891 functionId ,
@@ -1893,12 +1903,14 @@ await store.CreateFunction(
18931903 . RestartExecution (
18941904 functionId ,
18951905 expectedEpoch : 0 ,
1896- leaseExpiration
1906+ leaseExpiration ,
1907+ owner
18971908 ) . ShouldNotBeNullAsync ( ) ;
18981909
18991910 sf . StoredId . ShouldBe ( functionId ) ;
19001911 effects . Count . ShouldBe ( 0 ) ;
19011912 messages . Count . ShouldBe ( 0 ) ;
1913+ sf . OwnerId . ShouldBe ( owner ) ;
19021914 }
19031915
19041916 public abstract Task FunctionOwnedByReplicaIsPostponedAfterRescheduleFunctionsInvocation ( ) ;
0 commit comments