Skip to content

Commit 4d06b7e

Browse files
committed
MDEV-16769: Notes "WSREP: Waiting for SST to complete" flood the error log
Used wrong initialization for condition timeout, should have used set_timespec.
1 parent 312de43 commit 4d06b7e

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

sql/wsrep_sst.cc

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ void wsrep_sst_grab ()
204204
// Wait for end of SST
205205
bool wsrep_sst_wait ()
206206
{
207-
struct timespec wtime = {WSREP_TIMEDWAIT_SECONDS, 0};
208-
uint32 total_wtime = 0;
207+
double total_wtime = 0;
209208

210209
if (mysql_mutex_lock (&LOCK_wsrep_sst))
211210
abort();
@@ -214,14 +213,18 @@ bool wsrep_sst_wait ()
214213

215214
while (!sst_complete)
216215
{
216+
struct timespec wtime;
217+
set_timespec(wtime, WSREP_TIMEDWAIT_SECONDS);
218+
time_t start_time = time(NULL);
217219
mysql_cond_timedwait (&COND_wsrep_sst, &LOCK_wsrep_sst, &wtime);
220+
time_t end_time = time(NULL);
218221

219222
if (!sst_complete)
220223
{
221-
total_wtime += wtime.tv_sec;
222-
WSREP_DEBUG("Waiting for SST to complete. waited %u secs.", total_wtime);
224+
total_wtime += difftime(end_time, start_time);
225+
WSREP_DEBUG("Waiting for SST to complete. current seqno: %ld waited %f secs.", local_seqno, total_wtime);
223226
service_manager_extend_timeout(WSREP_EXTEND_TIMEOUT_INTERVAL,
224-
"WSREP state transfer ongoing, current seqno: %ld", local_seqno);
227+
"WSREP state transfer ongoing, current seqno: %ld waited %f secs", local_seqno, total_wtime);
225228
}
226229
}
227230

@@ -1319,19 +1322,22 @@ void wsrep_SE_init_grab()
13191322

13201323
void wsrep_SE_init_wait()
13211324
{
1322-
struct timespec wtime = {WSREP_TIMEDWAIT_SECONDS, 0};
1323-
uint32 total_wtime=0;
1325+
double total_wtime=0;
13241326

13251327
while (SE_initialized == false)
13261328
{
1329+
struct timespec wtime;
1330+
set_timespec(wtime, WSREP_TIMEDWAIT_SECONDS);
1331+
time_t start_time = time(NULL);
13271332
mysql_cond_timedwait (&COND_wsrep_sst_init, &LOCK_wsrep_sst_init, &wtime);
1333+
time_t end_time = time(NULL);
13281334

13291335
if (!SE_initialized)
13301336
{
1331-
total_wtime += wtime.tv_sec;
1332-
WSREP_DEBUG("Waiting for SST to complete. waited %u secs.", total_wtime);
1337+
total_wtime += difftime(end_time, start_time);
1338+
WSREP_DEBUG("Waiting for SST to complete. current seqno: %ld waited %f secs.", local_seqno, total_wtime);
13331339
service_manager_extend_timeout(WSREP_EXTEND_TIMEOUT_INTERVAL,
1334-
"WSREP SE initialization ongoing.");
1340+
"WSREP state transfer ongoing, current seqno: %ld waited %f secs", local_seqno, total_wtime);
13351341
}
13361342
}
13371343

0 commit comments

Comments
 (0)