@@ -89,9 +89,6 @@ public bool Exists()
8989 /// </summary>
9090 public void Delete ( )
9191 {
92- // Deleting the database while it is initializing will leave it in a state where system redo threads are stuck.
93- // This leaves the database in a state that a SQL Server service restart prior to deletion.
94- _listener . ForEachAgInstance ( WaitForInitialization ) ;
9592 _listener . AvailabilityGroup . Remove ( Name ) ;
9693 _listener . ForEachAgInstance ( s => s . Database ( Name ) ? . Drop ( ) ) ;
9794 }
@@ -156,7 +153,7 @@ public void DropLogin(LoginProperties login)
156153
157154 public void DropAllLogins ( )
158155 {
159- foreach ( var loginProp in AssociatedLogins ( ) ) DropLogin ( loginProp ) ;
156+ _listener . ForEachAgInstance ( s => s . Database ( Name ) ? . DropAssociatedLogins ( ) ) ;
160157 }
161158
162159 public void AddLogin ( LoginProperties login )
@@ -187,18 +184,6 @@ public void FullBackup()
187184 _listener . Primary . FullBackup ( Name , _backupPathSqlQuery ) ;
188185 }
189186
190- private void WaitForInitialization ( Server server , AvailabilityGroup availabilityGroup )
191- {
192- var policy = Policy
193- . Handle < TimeoutException > ( )
194- . WaitAndRetry ( 4 , retryAttempt => TimeSpan . FromMilliseconds ( Math . Pow ( 10 , retryAttempt ) ) ) ;
195-
196- policy . Execute ( ( ) => {
197- if ( availabilityGroup . IsInitializing ( Name ) )
198- throw new TimeoutException ( $ "{ server . Name } is initializing. Wait period expired.") ;
199- } ) ;
200- }
201-
202187 public void FinalizePrimary ( )
203188 {
204189 _listener . ForEachAgInstance ( FinalizePrimary ) ;
0 commit comments