1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2026-05-22 10:15:16 +02:00

Fix performance regression in storage list.

storageListP() returns a list of entries in a path and should not need to stat/head, etc. in order to get more detailed info. This was broken by 75623d4 which failed to set the level correctly.

Set the correct level and update tests.

There's no easy way to directly test for a regression here but the SFTP tests will fail if more detailed info is requested since it would require script changes.
This commit is contained in:
David Steele
2024-03-08 09:50:20 +13:00
committed by GitHub
parent 794c577130
commit e00bfe2d2c
5 changed files with 37 additions and 16 deletions
+13
View File
@@ -14,6 +14,19 @@
<p>Skip zero-length files for block incremental delta restore.</p> <p>Skip zero-length files for block incremental delta restore.</p>
</release-item> </release-item>
<release-item>
<github-issue id="2275"/>
<github-pull-request id="2276"/>
<release-item-contributor-list>
<release-item-ideator id="maksym.boguk"/>
<release-item-contributor id="david.steele"/>
<release-item-reviewer id="stephen.frost"/>
</release-item-contributor-list>
<p>Fix performance regression in storage list.</p>
</release-item>
</release-bug-list> </release-bug-list>
<release-improvement-list> <release-improvement-list>
+5
View File
@@ -670,6 +670,11 @@
<contributor-id type="github">mahomedh</contributor-id> <contributor-id type="github">mahomedh</contributor-id>
</contributor> </contributor>
<contributor id="maksym.boguk">
<contributor-name-display>Maksym Boguk</contributor-name-display>
<contributor-id type="github">MaximBoguk</contributor-id>
</contributor>
<contributor id="MannerMan"> <contributor id="MannerMan">
<contributor-name-display>Oscar</contributor-name-display> <contributor-name-display>Oscar</contributor-name-display>
<contributor-id type="github">MannerMan</contributor-id> <contributor-id type="github">MannerMan</contributor-id>
+2 -2
View File
@@ -378,8 +378,8 @@ storageList(const Storage *this, const String *pathExp, StorageListParam param)
MEM_CONTEXT_TEMP_BEGIN() MEM_CONTEXT_TEMP_BEGIN()
{ {
StorageIterator *const storageItr = storageNewItrP( StorageIterator *const storageItr = storageNewItrP(
this, pathExp, .errorOnMissing = param.errorOnMissing, .nullOnMissing = param.nullOnMissing, this, pathExp, .level = storageInfoLevelExists, .errorOnMissing = param.errorOnMissing,
.expression = param.expression); .nullOnMissing = param.nullOnMissing, .expression = param.expression);
if (storageItr != NULL) if (storageItr != NULL)
{ {
+17
View File
@@ -486,6 +486,23 @@ testRun(void)
storageTest->pub.interface.feature ^= 1 << storageFeatureInfoDetail; storageTest->pub.interface.feature ^= 1 << storageFeatureInfoDetail;
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("path basic info - no recurse");
storageTest->pub.interface.feature ^= 1 << storageFeatureInfoDetail;
TEST_STORAGE_LIST(
storageTest, "pg",
"zzz/\n"
"pipe*\n"
"path/\n"
"link> {d=../file}\n"
"file {s=8, t=1656433838}\n"
"./\n",
.levelForce = true, .includeDot = true, .noRecurse = true, .sortOrder = sortOrderDesc);
storageTest->pub.interface.feature ^= 1 << storageFeatureInfoDetail;
// ------------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("empty path - filter"); TEST_TITLE("empty path - filter");
-14
View File
@@ -3776,15 +3776,8 @@ testRun(void)
.resultInt = 8, .attrPerms = LIBSSH2_SFTP_S_IFREG | LIBSSH2_SFTP_S_IRWXU | LIBSSH2_SFTP_S_IRWXG, .resultInt = 8, .attrPerms = LIBSSH2_SFTP_S_IFREG | LIBSSH2_SFTP_S_IRWXU | LIBSSH2_SFTP_S_IRWXG,
.flags = LIBSSH2_SFTP_ATTR_PERMISSIONS | LIBSSH2_SFTP_ATTR_ACMODTIME | LIBSSH2_SFTP_ATTR_UIDGID, .flags = LIBSSH2_SFTP_ATTR_PERMISSIONS | LIBSSH2_SFTP_ATTR_ACMODTIME | LIBSSH2_SFTP_ATTR_UIDGID,
.mtime = 1656434296, .uid = TEST_USER_ID, .gid = TEST_GROUP_ID}, .mtime = 1656434296, .uid = TEST_USER_ID, .gid = TEST_GROUP_ID},
{.function = HRNLIBSSH2_SFTP_STAT_EX, .param = "[\"" TEST_PATH "/.aaa.txt\",1]", .fileName = STRDEF(".aaa.txt"),
.resultInt = LIBSSH2_ERROR_NONE,
.attrPerms = LIBSSH2_SFTP_S_IFREG | LIBSSH2_SFTP_S_IRWXU | LIBSSH2_SFTP_S_IRWXG,
.flags = LIBSSH2_SFTP_ATTR_PERMISSIONS | LIBSSH2_SFTP_ATTR_ACMODTIME | LIBSSH2_SFTP_ATTR_UIDGID,
.mtime = 1656434296, .uid = TEST_USER_ID, .gid = TEST_GROUP_ID},
{.function = HRNLIBSSH2_SFTP_READDIR_EX, .param = "[\".aaa.txt\",4095,null,0]", .fileName = STRDEF("noperm"), {.function = HRNLIBSSH2_SFTP_READDIR_EX, .param = "[\".aaa.txt\",4095,null,0]", .fileName = STRDEF("noperm"),
.resultInt = 6, .uid = 0, .gid = 0}, .resultInt = 6, .uid = 0, .gid = 0},
{.function = HRNLIBSSH2_SFTP_STAT_EX, .param = "[\"" TEST_PATH "/noperm\",1]", .fileName = STRDEF("noperm"),
.resultInt = LIBSSH2_ERROR_NONE, .uid = 0, .gid = 0},
{.function = HRNLIBSSH2_SFTP_READDIR_EX, .param = "[\"noperm\",4095,null,0]", .fileName = STRDEF(""), {.function = HRNLIBSSH2_SFTP_READDIR_EX, .param = "[\"noperm\",4095,null,0]", .fileName = STRDEF(""),
.resultInt = LIBSSH2_ERROR_NONE, .uid = 0, .gid = 0}, .resultInt = LIBSSH2_ERROR_NONE, .uid = 0, .gid = 0},
{.function = HRNLIBSSH2_SFTP_CLOSE_HANDLE, .resultInt = LIBSSH2_ERROR_NONE}, {.function = HRNLIBSSH2_SFTP_CLOSE_HANDLE, .resultInt = LIBSSH2_ERROR_NONE},
@@ -3801,15 +3794,8 @@ testRun(void)
.resultInt = 7, .attrPerms = LIBSSH2_SFTP_S_IFREG | LIBSSH2_SFTP_S_IRWXU | LIBSSH2_SFTP_S_IRWXG, .resultInt = 7, .attrPerms = LIBSSH2_SFTP_S_IFREG | LIBSSH2_SFTP_S_IRWXU | LIBSSH2_SFTP_S_IRWXG,
.flags = LIBSSH2_SFTP_ATTR_PERMISSIONS | LIBSSH2_SFTP_ATTR_ACMODTIME | LIBSSH2_SFTP_ATTR_UIDGID, .flags = LIBSSH2_SFTP_ATTR_PERMISSIONS | LIBSSH2_SFTP_ATTR_ACMODTIME | LIBSSH2_SFTP_ATTR_UIDGID,
.mtime = 1656434296, .uid = TEST_USER_ID, .gid = TEST_GROUP_ID}, .mtime = 1656434296, .uid = TEST_USER_ID, .gid = TEST_GROUP_ID},
{.function = HRNLIBSSH2_SFTP_STAT_EX, .param = "[\"" TEST_PATH "/bbb.txt\",1]", .fileName = STRDEF("bbb.txt"),
.resultInt = LIBSSH2_ERROR_NONE,
.attrPerms = LIBSSH2_SFTP_S_IFREG | LIBSSH2_SFTP_S_IRWXU | LIBSSH2_SFTP_S_IRWXG,
.flags = LIBSSH2_SFTP_ATTR_PERMISSIONS | LIBSSH2_SFTP_ATTR_ACMODTIME | LIBSSH2_SFTP_ATTR_UIDGID,
.mtime = 1656434296, .uid = TEST_USER_ID, .gid = TEST_GROUP_ID},
{.function = HRNLIBSSH2_SFTP_READDIR_EX, .param = "[\"bbb.txt\",4095,null,0]", .fileName = STRDEF("noperm"), {.function = HRNLIBSSH2_SFTP_READDIR_EX, .param = "[\"bbb.txt\",4095,null,0]", .fileName = STRDEF("noperm"),
.resultInt = 6, .uid = 0, .gid = 0}, .resultInt = 6, .uid = 0, .gid = 0},
{.function = HRNLIBSSH2_SFTP_STAT_EX, .param = "[\"" TEST_PATH "/noperm\",1]", .fileName = STRDEF("noperm"),
.resultInt = LIBSSH2_ERROR_NONE, .uid = 0, .gid = 0},
{.function = HRNLIBSSH2_SFTP_READDIR_EX, .param = "[\"noperm\",4095,null,0]", .fileName = STRDEF(""), {.function = HRNLIBSSH2_SFTP_READDIR_EX, .param = "[\"noperm\",4095,null,0]", .fileName = STRDEF(""),
.resultInt = LIBSSH2_ERROR_NONE, .uid = 0, .gid = 0}, .resultInt = LIBSSH2_ERROR_NONE, .uid = 0, .gid = 0},
{.function = HRNLIBSSH2_SFTP_CLOSE_HANDLE, .resultInt = LIBSSH2_ERROR_EAGAIN}, {.function = HRNLIBSSH2_SFTP_CLOSE_HANDLE, .resultInt = LIBSSH2_ERROR_EAGAIN},