Пример #1
0
 // Token: 0x06001A40 RID: 6720 RVA: 0x0006E5C8 File Offset: 0x0006C7C8
 public static SeederClient Create(Server server, string databaseName, Server sourceServer)
 {
     if (server == null)
     {
         throw new ArgumentException("server cannot be null.", "server");
     }
     return(SeederClient.Create(server.Fqdn, databaseName, (sourceServer == null) ? null : sourceServer.Fqdn, server.AdminDisplayVersion));
 }
        private static Exception ReseedCatalog(CatalogAutoReseedWorkflow workflow)
        {
            Exception result = null;

            using (SeederClient seederClient = SeederClient.Create(workflow.Context.TargetServerName.Fqdn, workflow.Context.Database.Name, null, workflow.Context.TargetServer.AdminDisplayVersion))
            {
                bool flag = false;
                for (int i = 0; i <= 1; i++)
                {
                    result = null;
                    try
                    {
                        if (flag)
                        {
                            seederClient.EndDbSeed(workflow.Context.Database.Guid);
                        }
                        AutoReseedWorkflow.Tracer.TraceDebug((long)workflow.GetHashCode(), "CatalogAutoReseedWorkflow: Attempt({0}) to reseed catalog for database copy '{1}\\{2}' from {3}.", new object[]
                        {
                            i,
                            workflow.Context.Database.Name,
                            workflow.Context.TargetServerName,
                            string.IsNullOrEmpty(workflow.sourceName) ? "Active" : workflow.sourceName
                        });
                        SeederRpcFlags reseedRPCReason = CatalogAutoReseedWorkflow.GetReseedRPCReason(workflow.catalogReseedReason);
                        seederClient.PrepareDbSeedAndBegin(workflow.Context.Database.Guid, false, false, false, false, false, true, string.Empty, null, workflow.sourceName, null, null, reseedRPCReason);
                        break;
                    }
                    catch (SeederInstanceAlreadyInProgressException ex)
                    {
                        result = ex;
                        break;
                    }
                    catch (SeederInstanceAlreadyFailedException ex2)
                    {
                        result = ex2;
                        flag   = true;
                    }
                    catch (SeederServerException ex3)
                    {
                        result = ex3;
                    }
                    catch (SeederServerTransientException ex4)
                    {
                        result = ex4;
                    }
                    if (!string.IsNullOrEmpty(workflow.sourceName))
                    {
                        workflow.sourceName = string.Empty;
                    }
                }
            }
            return(result);
        }
        // Token: 0x06001A36 RID: 6710 RVA: 0x0006E2CC File Offset: 0x0006C4CC
        private void TryReseedCopy(CopyStatusClientCachedEntry status)
        {
            Exception ex          = null;
            string    dbname      = status.CopyStatus.DBName;
            string    netbiosName = status.ServerContacted.NetbiosName;

            try
            {
                FullServerReseeder.Tracer.TraceDebug <string, string>((long)this.GetHashCode(), "FullServerReseeder: Next, attempting to reseed database copy '{0}\\{1}'.", dbname, netbiosName);
                ReplayCrimsonEvents.FullServerCopyReseeding.Log <string, string, Guid>(dbname, netbiosName, status.DbGuid);
                this.m_reseedsAttempted.Add(status.DbGuid, status);
                using (SeederClient seederClient = SeederClient.Create(AmServerName.LocalComputerName.Fqdn, dbname, null, this.m_localServer.AdminDisplayVersion))
                {
                    if (this.m_args.SeedCiFiles)
                    {
                        try
                        {
                            FullServerReseeder.Tracer.TraceDebug <string, string>((long)this.GetHashCode(), "FullServerReseeder: Trying to cancel/end a previously running seed for database copy '{0}\\{1}'", dbname, netbiosName);
                            seederClient.CancelDbSeed(status.DbGuid);
                            seederClient.EndDbSeed(status.DbGuid);
                        }
                        catch (SeederInstanceNotFoundException arg)
                        {
                            FullServerReseeder.Tracer.TraceDebug <string, Guid, SeederInstanceNotFoundException>((long)this.GetHashCode(), "FullServerReseeder: CancelDbSeed() or EndDbSeed() failed for database '{0}' ({1}). Error: {2}", dbname, status.DbGuid, arg);
                        }
                    }
                    seederClient.PrepareDbSeedAndBegin(status.DbGuid, this.m_args.DeleteExistingFiles, this.m_args.SafeDeleteExistingFiles, this.m_args.AutoSuspend, this.m_args.ManualResume, this.m_args.SeedDatabase, this.m_args.SeedCiFiles, string.Empty, null, string.Empty, this.m_args.CompressOverride, this.m_args.EncryptOverride, this.m_args.Flags | SeederRpcFlags.SkipSettingReseedAutoReseedState);
                }
            }
            catch (SeederServerException ex2)
            {
                ex = ex2;
            }
            catch (SeederServerTransientException ex3)
            {
                ex = ex3;
            }
            if (ex != null)
            {
                FullServerReseeder.Tracer.TraceError <string, string, Exception>((long)this.GetHashCode(), "FullServerReseeder: Reseeding database copy '{0}\\{1}' failed. Error: {2}", dbname, netbiosName, ex);
                ReplayCrimsonEvents.FullServerCopyReseedFailed.Log <string, string, Guid, string>(dbname, netbiosName, status.DbGuid, ex.Message);
            }
        }
Пример #4
0
 // Token: 0x06001964 RID: 6500 RVA: 0x0006A0D8 File Offset: 0x000682D8
 private static void BeginSeedRpc(FailedSuspendedCopyAutoReseedWorkflow wf)
 {
     using (SeederClient seederClient = SeederClient.Create(wf.Context.TargetServerName.Fqdn, wf.Context.Database.Name, null, wf.Context.TargetServer.AdminDisplayVersion))
     {
         try
         {
             seederClient.CancelDbSeed(wf.Context.Database.Guid);
             seederClient.EndDbSeed(wf.Context.Database.Guid);
             wf.TraceDebug("Prior seed instance has been Cancelled.", new object[0]);
         }
         catch (SeederInstanceNotFoundException ex)
         {
             wf.TraceDebug("Prior seed instance cleanup failed with: {0}", new object[]
             {
                 ex
             });
         }
         seederClient.PrepareDbSeedAndBegin(wf.Context.Database.Guid, false, true, false, false, true, true, string.Empty, null, string.Empty, null, null, SeederRpcFlags.SkipSettingReseedAutoReseedState);
     }
 }