Operational Remediation Reports
Lazy Init Remediation Report
Apply at most one idempotent write and turn the accepted and skipped counts into a commit, skip, or retry remediation action.
idempotent write
Only the first write is accepted and later writes are counted as skipped, so the remediation action is reproducible without a live lazy initializer.
Lazy Init Remediation Report
LazyInitRemediationReport.cs
Replay: real traced execution (multi-file project)
using System;
class Program
{
static void Main()
{
int writes = 1;
int accepted = 0;
int skipped = 0;
for (int i = 0; i < writes; i++)
{
if (accepted == 0)
{
accepted++;
}
else
{
skipped++;
}
}
string action;
if (accepted == 0)
{
action = "retry";
}
else if (skipped > 0)
{
action = "skip";
}
else
{
action = "commit";
}
Console.WriteLine("writes=" + writes + " accepted=" + accepted + " skipped=" + skipped + " " + action);
}
}
using System;
class Program
{
static void Main()
{
int writes = 0;
int accepted = 0;
int skipped = 0;
for (int i = 0; i < writes; i++)
{
if (accepted == 0)
{
accepted++;
}
else
{
skipped++;
}
}
string action;
if (accepted == 0)
{
action = "retry";
}
else if (skipped > 0)
{
action = "skip";
}
else
{
action = "commit";
}
Console.WriteLine("writes=" + writes + " accepted=" + accepted + " skipped=" + skipped + " " + action);
}
}
using System;
class Program
{
static void Main()
{
int writes = 2;
int accepted = 0;
int skipped = 0;
for (int i = 0; i < writes; i++)
{
if (accepted == 0)
{
accepted++;
}
else
{
skipped++;
}
}
string action;
if (accepted == 0)
{
action = "retry";
}
else if (skipped > 0)
{
action = "skip";
}
else
{
action = "commit";
}
Console.WriteLine("writes=" + writes + " accepted=" + accepted + " skipped=" + skipped + " " + action);
}
}
writes ← 1, accepted ← 0, skipped ← 0
4{5 static void Main()6 {7 int writes→ 1 = 1; //@writes=2, 08 int accepted→ 0 = 0;9 int skipped→ 0 = 0;for (int i = 0; i < writes; i++)
11for (int i0 = 0; i < writes1; i++)12{13 if (accepted == 0)accepted ← 1
12{13 if (accepted0 == 0)14 {15 accepted→ 1++;16 }string action;
23string action;24if (accepted == 0)action ← commit
31}32else33{34 action→ commit = "commit";35}Console.WriteLine("writes=" + writes + " accepted=" + accepted + " ski…
37 Console.WriteLine("writes=" + writes1 + " accepted=" + accepted1 + " skipped=" + skipped0 + " " + actioncommit);38}outputwrites=1 accepted=1 skipped=0 commit
writes ← 0, accepted ← 0, skipped ← 0
4{5 static void Main()6 {7 int writes→ 0 = 0;8 int accepted→ 0 = 0;9 int skipped→ 0 = 0;1011 for (int i = 0; i < writes; i++)12 {13 if (accepted == 0)14 {15 accepted++;16 }17 else18 {19 skipped++;20 }21 }2223 string action;24 if (accepted == 0)action ← retry
23string action;24if (accepted0 == 0)25{26 action→ retry = "retry";27}Console.WriteLine("writes=" + writes + " accepted=" + accepted + " ski…
37 Console.WriteLine("writes=" + writes0 + " accepted=" + accepted0 + " skipped=" + skipped0 + " " + actionretry);38}outputwrites=0 accepted=0 skipped=0 retry
writes ← 2, accepted ← 0, skipped ← 0
4{5 static void Main()6 {7 int writes→ 2 = 2;8 int accepted→ 0 = 0;9 int skipped→ 0 = 0;for (int i = 0; i < writes; i++)
pass 1 of 211for (int i0 = 0; i < writes2; i++)12{13 if (accepted == 0)accepted ← 1
12{13 if (accepted0 == 0)14 {15 accepted→ 1++;16 }for (int i = 0; i < writes; i++)
pass 2 of 211for (int i1 = 0; i < writes2; i++)12{13 if (accepted == 0)skipped ← 1
16}17else18{19 skipped→ 1++;20}string action;
23string action;24if (accepted == 0)action ← skip
27}28else if (skipped1 > 0)29{30 action→ skip = "skip";31}Console.WriteLine("writes=" + writes + " accepted=" + accepted + " ski…
37 Console.WriteLine("writes=" + writes2 + " accepted=" + accepted1 + " skipped=" + skipped1 + " " + actionskip);38}outputwrites=2 accepted=1 skipped=1 skip