Operational Remediation Reports
Lazy Value Remediation Report
Apply at most one idempotent write and turn the accepted and skipped counts into a commit, skip, or retry remediation action.
Lazy Value Remediation Report
LazyValueRemediationReport.scala
object Main {
def main(args: Array[String]): Unit = {
val writes =
var accepted = 0
var skipped = 0
for (i <- 1 to writes) {
if (accepted == 0) {
accepted = accepted + 1
} else {
skipped = skipped + 1
}
}
var action = "retry"
if (accepted >= 1) {
action = "commit"
}
if (skipped >= 1) {
action = "skip"
}
println("writes=" + writes + " accepted=" + accepted + " skipped=" + skipped + " " + action)
}
}
object Main {
def main(args: Array[String]): Unit = {
val writes =
var accepted = 0
var skipped = 0
for (i <- 1 to writes) {
if (accepted == 0) {
accepted = accepted + 1
} else {
skipped = skipped + 1
}
}
var action = "retry"
if (accepted >= 1) {
action = "commit"
}
if (skipped >= 1) {
action = "skip"
}
println("writes=" + writes + " accepted=" + accepted + " skipped=" + skipped + " " + action)
}
}
object Main {
def main(args: Array[String]): Unit = {
val writes =
var accepted = 0
var skipped = 0
for (i <- 1 to writes) {
if (accepted == 0) {
accepted = accepted + 1
} else {
skipped = skipped + 1
}
}
var action = "retry"
if (accepted >= 1) {
action = "commit"
}
if (skipped >= 1) {
action = "skip"
}
println("writes=" + writes + " accepted=" + accepted + " skipped=" + skipped + " " + 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.