@@ -69,6 +69,7 @@ static public MsSQLTestDatabase in(final BaseImage imageName, final ContainerMod
69
69
70
70
public MsSQLTestDatabase (final MSSQLServerContainer <?> container ) {
71
71
super (container );
72
+ LOGGER .info ("SGX creating new database. databaseId=" + this .databaseId + ", databaseName=" + getDatabaseName ());
72
73
}
73
74
74
75
public MsSQLTestDatabase withCdc () {
@@ -104,39 +105,39 @@ public MsSQLTestDatabase withShortenedCapturePollingInterval() {
104
105
105
106
private void waitForAgentState (final boolean running ) {
106
107
final String expectedValue = running ? "Running." : "Stopped." ;
107
- LOGGER .debug ( "Waiting for SQLServerAgent state to change to '{}'." , expectedValue );
108
+ LOGGER .info ( formatLogLine ( "Waiting for SQLServerAgent state to change to '{}'." ) , expectedValue );
108
109
for (int i = 0 ; i < MAX_RETRIES ; i ++) {
109
110
try {
110
111
final var r = query (ctx -> ctx .fetch ("EXEC master.dbo.xp_servicecontrol 'QueryState', N'SQLServerAGENT';" ).get (0 ));
111
112
if (expectedValue .equalsIgnoreCase (r .getValue (0 ).toString ())) {
112
- LOGGER .debug ( "SQLServerAgent state is '{}', as expected." , expectedValue );
113
+ LOGGER .info ( formatLogLine ( "SQLServerAgent state is '{}', as expected." ) , expectedValue );
113
114
return ;
114
115
}
115
- LOGGER .debug ( "Retrying, SQLServerAgent state {} does not match expected '{}'." , r , expectedValue );
116
+ LOGGER .info ( formatLogLine ( "Retrying, SQLServerAgent state {} does not match expected '{}'." ) , r , expectedValue );
116
117
} catch (final SQLException e ) {
117
- LOGGER .debug ( "Retrying agent state query after catching exception {}." , e .getMessage ());
118
+ LOGGER .info ( formatLogLine ( "Retrying agent state query after catching exception {}." ) , e .getMessage ());
118
119
}
119
120
try {
120
121
Thread .sleep (1_000 ); // Wait one second between retries.
121
122
} catch (final InterruptedException e ) {
122
123
throw new RuntimeException (e );
123
124
}
124
125
}
125
- throw new RuntimeException ("Exhausted retry attempts while polling for agent state" );
126
+ throw new RuntimeException (formatLogLine ( "Exhausted retry attempts while polling for agent state" ) );
126
127
}
127
128
128
129
public MsSQLTestDatabase withWaitUntilMaxLsnAvailable () {
129
- LOGGER .debug ( "Waiting for max LSN to become available for database {}." , getDatabaseName ());
130
+ LOGGER .info ( formatLogLine ( "Waiting for max LSN to become available for database {}." ) , getDatabaseName ());
130
131
for (int i = 0 ; i < MAX_RETRIES ; i ++) {
131
132
try {
132
133
final var maxLSN = query (ctx -> ctx .fetch ("SELECT sys.fn_cdc_get_max_lsn();" ).get (0 ).get (0 , byte [].class ));
133
134
if (maxLSN != null ) {
134
- LOGGER .debug ( "Max LSN available for database {}: {}" , getDatabaseName (), Lsn .valueOf (maxLSN ));
135
+ LOGGER .info ( formatLogLine ( "Max LSN available for database {}: {}" ) , getDatabaseName (), Lsn .valueOf (maxLSN ));
135
136
return self ();
136
137
}
137
- LOGGER .debug ( "Retrying, max LSN still not available for database {}." , getDatabaseName ());
138
+ LOGGER .info ( formatLogLine ( "Retrying, max LSN still not available for database {}." ) , getDatabaseName ());
138
139
} catch (final SQLException e ) {
139
- LOGGER .warn ( "Retrying max LSN query after catching exception {}" , e .getMessage ());
140
+ LOGGER .info ( formatLogLine ( "Retrying max LSN query after catching exception {}" ) , e .getMessage ());
140
141
}
141
142
try {
142
143
Thread .sleep (1_000 ); // Wait one second between retries.
0 commit comments