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

Commit10238fa

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 parentcc07e06 commit10238fa

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
@@ -1370,26 +1370,16 @@ throttle(size_t increment)
13701370
if (wait_result&WL_LATCH_SET)
13711371
CHECK_FOR_INTERRUPTS();
13721372
}
1373-
else
1374-
{
1375-
/*
1376-
* The actual transfer rate is below the limit. A negative value
1377-
* would distort the adjustment of throttled_last.
1378-
*/
1379-
wait_result=0;
1380-
sleep=0;
1381-
}
13821373

13831374
/*
1384-
*Only awhole multiple of throttling_sample was processed. The rest will
1385-
* be done during the next call of this function.
1375+
*As we work with integers, onlywhole multiple of throttling_sample was
1376+
*processed. The rest willbe done during the next call of this function.
13861377
*/
13871378
throttling_counter %=throttling_sample;
13881379

1389-
/* Once the (possible) sleep has ended, new period starts. */
1390-
if (wait_result&WL_TIMEOUT)
1391-
throttled_last+=elapsed+sleep;
1392-
elseif (sleep>0)
1393-
/* Sleep was necessary but might have been interrupted. */
1394-
throttled_last=GetCurrentIntegerTimestamp();
1380+
/*
1381+
* Time interval for the remaining amount and possible next increments
1382+
* starts now.
1383+
*/
1384+
throttled_last=GetCurrentIntegerTimestamp();
13951385
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp