Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1c8ad59

Browse files
committed
Fix base backup rate limiting in presence of slow i/o
When source i/o on disk was too slow compared to the rate limitingspecified, the system could end up with a negative value for sleep thatit never got out of, which caused rate limiting to effectively beturned off.Discussion:https://postgr.es/m/CABUevEy_-e0YvL4ayoX8bH_Ja9w%2BBHoP6jUgdxZuG2nEj3uAfQ%40mail.gmail.comAnalysis by me, patch by Antonin Houska
1 parent512f27c commit1c8ad59

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

‎src/backend/replication/basebackup.c

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,26 +1303,16 @@ throttle(size_t increment)
13031303
if (wait_result&WL_LATCH_SET)
13041304
CHECK_FOR_INTERRUPTS();
13051305
}
1306-
else
1307-
{
1308-
/*
1309-
* The actual transfer rate is below the limit. A negative value
1310-
* would distort the adjustment of throttled_last.
1311-
*/
1312-
wait_result=0;
1313-
sleep=0;
1314-
}
13151306

13161307
/*
1317-
*Only awhole multiple of throttling_sample was processed. The rest will
1318-
* be done during the next call of this function.
1308+
*As we work with integers, onlywhole multiple of throttling_sample was
1309+
*processed. The rest willbe done during the next call of this function.
13191310
*/
13201311
throttling_counter %=throttling_sample;
13211312

1322-
/* Once the (possible) sleep has ended, new period starts. */
1323-
if (wait_result&WL_TIMEOUT)
1324-
throttled_last+=elapsed+sleep;
1325-
elseif (sleep>0)
1326-
/* Sleep was necessary but might have been interrupted. */
1327-
throttled_last=GetCurrentIntegerTimestamp();
1313+
/*
1314+
* Time interval for the remaining amount and possible next increments
1315+
* starts now.
1316+
*/
1317+
throttled_last=GetCurrentIntegerTimestamp();
13281318
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp