[Gs-commits] Grayskull Repository branch, master, updated. git-migration-425-g4605806
A ref change was pushed to the repository containing the project "Grayskull Repository". The branch, master has been updated via 4605806bd39237d6e7f6c5cc4146d8bf2cb8acd6 (commit) from 8e69354fb0066f5040497cfafd762bc1c130d3b2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4605806bd39237d6e7f6c5cc4146d8bf2cb8acd6 Author: Justin Wozniak <[email protected]> Date: Fri Feb 26 12:02:30 2010 -0800 Also validate Copies performed at the end of the simulation. Cleaned up some possible confusion with names of current and next Fault. ----------------------------------------------------------------------- Summary of changes: sim/gobs/src/gobs/sim/Fault.java | 12 ++++++- sim/gobs/src/gobs/sim/KClosest.java | 5 ++- sim/gobs/src/gobs/sim/Metric.java | 1 - sim/gobs/src/gobs/sim/Nearest.java | 2 - sim/gobs/src/gobs/sim/Placement.java | 3 +- sim/gobs/src/gobs/sim/Rebuild.java | 36 +++++++++++++------ sim/gobs/src/gobs/sim/Simulator.java | 64 ++++++++++++++++++++------------- 7 files changed, 80 insertions(+), 43 deletions(-) Diff of changes: diff --git a/sim/gobs/src/gobs/sim/Fault.java b/sim/gobs/src/gobs/sim/Fault.java index 4451f06..8c73e6e 100644 --- a/sim/gobs/src/gobs/sim/Fault.java +++ b/sim/gobs/src/gobs/sim/Fault.java @@ -10,8 +10,13 @@ class Fault /** If set, data was lost as a result of this Fault. */ - static boolean dataLost = false; + boolean dataLost = false; + /** + The Rebuild that responded to this Fault. + */ + Rebuild rebuild; + Fault(Simulator simulator) { super(simulator); @@ -21,6 +26,11 @@ class Fault dataLost = true; } + void rebuild(Rebuild rebuild) + { + this.rebuild = rebuild; + } + String log() { return "Fault(" + Time.toString(finish) + ")"; diff --git a/sim/gobs/src/gobs/sim/KClosest.java b/sim/gobs/src/gobs/sim/KClosest.java index 6df8113..69466d6 100644 --- a/sim/gobs/src/gobs/sim/KClosest.java +++ b/sim/gobs/src/gobs/sim/KClosest.java @@ -150,7 +150,8 @@ abstract class KClosest public boolean share(Node node1, Node node2) { - boolean b = node1.neighbors.contains(node2); - return b; + // boolean b = node1.neighbors.contains(node2); + // return b; + return true; } } diff --git a/sim/gobs/src/gobs/sim/Metric.java b/sim/gobs/src/gobs/sim/Metric.java index 3b4b7cd..a784e2a 100644 --- a/sim/gobs/src/gobs/sim/Metric.java +++ b/sim/gobs/src/gobs/sim/Metric.java @@ -63,7 +63,6 @@ public abstract class Metric } simulator.print("rebuilds", "regimen: " + object); Sites sites = sites(object, system); - SecondaryObject secondary; // The node that should have the primary in the current system Node primaryNode = sites.primary(); // The node that currently holds the primary diff --git a/sim/gobs/src/gobs/sim/Nearest.java b/sim/gobs/src/gobs/sim/Nearest.java index e134d21..c84823d 100644 --- a/sim/gobs/src/gobs/sim/Nearest.java +++ b/sim/gobs/src/gobs/sim/Nearest.java @@ -2,8 +2,6 @@ package gobs.sim; import java.math.BigInteger; -import java.util.*; - import gobs.util.Tools; /** diff --git a/sim/gobs/src/gobs/sim/Placement.java b/sim/gobs/src/gobs/sim/Placement.java index 4ed7f26..88693fa 100644 --- a/sim/gobs/src/gobs/sim/Placement.java +++ b/sim/gobs/src/gobs/sim/Placement.java @@ -89,7 +89,8 @@ public abstract class Placement */ void copy(Copy copy) { - simulator.printNodeObjects(simulator.nodes); + if (simulator.enabled("debug.copies")) + simulator.printNodeObjects(simulator.nodes); simulator.print("rebuilds", "perform: " + copy); copy.destination.add(copy.object); } diff --git a/sim/gobs/src/gobs/sim/Rebuild.java b/sim/gobs/src/gobs/sim/Rebuild.java index ac98516..99aa8af 100644 --- a/sim/gobs/src/gobs/sim/Rebuild.java +++ b/sim/gobs/src/gobs/sim/Rebuild.java @@ -1,8 +1,6 @@ package gobs.sim; -// import java.text.DecimalFormat; -import java.math.BigInteger; import java.util.*; import gobs.util.*; @@ -49,11 +47,16 @@ public class Rebuild */ Repair repair; + /** + The fault that caused this Rebuild. + */ + Fault fault; + /** The fault that will occur after this Rebuild has started. May or may not interrupt this Rebuild. */ - Fault fault; + Fault next; /** Copies caused by this Rebuild. @@ -67,13 +70,16 @@ public class Rebuild /** @param fault The fault that may interrupt this Rebuild. + @param repair The Repair that repairs {@link fault}. */ - Rebuild(Simulator simulator, Fault fault, Repair repair) + Rebuild(Simulator simulator, Fault fault, Fault next, Repair repair) { this.simulator = simulator; - this.fault = fault; + this.fault = fault; + this.next = next; this.repair = repair; - simulator.inflight.add(fault); + fault.rebuild(this); + simulator.inflight.add(next); simulator.inflight.add(repair); } @@ -161,13 +167,23 @@ public class Rebuild */ void completeCopy(Copy copy) { - simulator.placer.copy(copy); + List<Copy> extras = performCopy(copy); copy.source.stopStreamFrom(copy); copy.destination.stopStreamTo(copy); - List<Copy> extras = validate(copy.object, copy.destination); add(extras); - } + } + /** + Perform the Copy and validate it. + Return any new work to do. + */ + List<Copy> performCopy(Copy copy) + { + simulator.placer.copy(copy); + List<Copy> extras = validate(copy.object, copy.destination); + return extras; + } + /** Ensure that the replica count is restored. Remove extraneous replicas or return a new Copy if needed. @@ -179,8 +195,6 @@ public class Rebuild { List<Copy> result = new ArrayList<Copy>(); - int replicas = object.replicas; - List<Node> stores = simulator.scanStorage(object, node.neighbors); Sites holders = simulator.placer.sites(object, stores); Sites sites = simulator.placer.sites(object); diff --git a/sim/gobs/src/gobs/sim/Simulator.java b/sim/gobs/src/gobs/sim/Simulator.java index 0f6919d..b2473dc 100644 --- a/sim/gobs/src/gobs/sim/Simulator.java +++ b/sim/gobs/src/gobs/sim/Simulator.java @@ -278,7 +278,7 @@ public class Simulator computeStatistics(); double t = new Date().getTime() - launch.getTime(); - System.out.println("SIMULATOR_TIME: " + Time.toString(t)); + System.out.println("SIMULATOR_TIME: " + Time.toString(t/1000)); Simulator.current = null; } @@ -661,10 +661,12 @@ public class Simulator void induceFaults() { System.out.println("faults: " + totalFaults); - Fault fault = new Fault(this); - advanceTo(fault.finish); + Fault fault = null; + Fault next = new Fault(this); + advanceTo(next.finish); while (! complete()) { + fault = next; System.out.println("fault: " + faultCount); Node failed = induceFault(fault); if (nodes.size() == 0) @@ -673,15 +675,9 @@ public class Simulator todo.addAll(fixes); Collection<Gob> damaged = failed.collection(); placer.drop(failed); - fault = rebuild(failed, damaged); + next = rebuild(fault, failed, damaged); } - System.out.println("END: " + Time.toString(time)); - if (bool("print.rebuilds")) - System.out.println("flushing copies:"); - performCopies(inflight); - performCopies(todo); - if (bool("print.nodes")) - printNodeObjects(nodes); + finish(fault); } double pullFault() @@ -693,28 +689,29 @@ public class Simulator Perform a Rebuild. @return The next Fault to occur. */ - Fault rebuild(Node failed, Collection<Gob> damaged) + Fault rebuild(Fault fault, Node failed, Collection<Gob> damaged) { - Fault fault = startRebuild(failed); + Fault next = startRebuild(fault, failed); List<Copy> work = planCopies(damaged); currentRebuild.rebuild(work); completeRebuild(); - return fault; + + return next; } /** Setup a Rebuild. @return The next Fault to occur. */ - Fault startRebuild(Node failed) + Fault startRebuild(Fault fault, Node failed) { - // Schedule the next fault: - Fault fault = new Fault(this); Repair repair = new Repair(this, failed, time, fault.dataLost); - Rebuild rebuild = new Rebuild(this, fault, repair); + // Schedule the next fault: + Fault next = new Fault(this); + Rebuild rebuild = new Rebuild(this, fault, next, repair); repair.setRebuild(rebuild); currentRebuild = rebuild; - return fault; + return next; } /** @@ -795,12 +792,12 @@ public class Simulator } /** - Actually perform copies that completed during the Rebuild. + Actually perform copies that completed during a Rebuild. Clears completed entries from set. @param copies Index of {@link Placement#regimen} output @param done Set of Objects that were copied */ - void performCopies(Set<? extends Event> set) + void performCopies(Fault fault, Set<? extends Event> set) { Iterator<? extends Event> it = set.iterator(); while (it.hasNext()) @@ -809,10 +806,9 @@ public class Simulator if (event instanceof Copy) { Copy copy = (Copy) event; - if (! copy.destination.contains(copy.object.id)) - placer.copy((Copy) event); - else - System.out.println("copy unnecessary: " + copy); + List<Copy> extras = fault.rebuild.performCopy(copy); + for (Copy extra : extras) + print("rebuilds", "extra: " + extra); it.remove(); } } @@ -828,6 +824,24 @@ public class Simulator printNodeObjects(nodes); } + /** + Wrap up after the induceFaults() loop. + Perform any outstanding copies + in {@link inflight} or {@link todo}. + @param last The final fault. This and its corresponding + Rebuild will be charged with any remaining work. + */ + void finish(Fault last) + { + System.out.println("END: " + Time.toString(time)); + if (bool("print.rebuilds")) + System.out.println("flushing copies:"); + performCopies(last, inflight); + performCopies(last, todo); + if (bool("print.nodes")) + printNodeObjects(nodes); + } + /** Set the rebuild rate. */ hooks/post-receive -- Grayskull Repository
participants (1)
-
noreply@mcs.anl.gov