Beispiel #1
0
        public static RecoveryCheck CheckMissingRCS(SDSStack.Entry sds)
        {
            RecoveryCheck rs = new RecoveryCheck();

            rs.predecessorIsConsistent = stack.FindGeneration(sds.Generation - 1).IsFullyConsistent;
            //sds.IntermediateSDS.inputConsistent;
            rs.thisIsConsistent = sds.IsFullyConsistent;

            foreach (var other in Simulation.Neighbors)
            {
                var inbound = sds.InboundRCS[other.LinearIndex];
                if (inbound != null && inbound.IsFullyConsistent)
                {
                    continue;
                }
                //try get from database:
                SerialRCS rcs = DB.TryGetInbound(other.InboundRCSStackID.Generation(sds.Generation));
                //SerialRCSStack rcsStack = BaseDB.TryGet(other.InboundRCSStackID);
                if (rcs != null)
                {
                    sds.InboundRCS[other.LinearIndex] = rcs.Deserialize();
                    rs.rcsRestoredFromDB++;
                    continue;
                }
                rs.missingRCS++;

                //try to get from neighbor:
                if (other.IsResponsive)
                {
                    rs.rcsAvailableFromNeighbor++;                      //optimisitic guess
                }
            }
            return(rs);
        }
Beispiel #2
0
        public static async Task PutAsync(SerialRCS serialRCS)
        {
            if (RCSStore == null)
            {
                return;                 //tests
            }
            try
            {
                Log.Minor("Storing serial RCS in DB: " + serialRCS.ID);
                await PutAsync(RCSStore, serialRCS, false, null);

                Log.Minor("Stored serial RCS in DB: " + serialRCS.ID);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                Log.Error("Failed to store serial SDS in DB: " + serialRCS.ID);
            }
        }