pgbackrest.git / summary / log / commit / refs
commit 33ec5a3aacdfe0dd258463c0cbcd43f0d155152e
Author: David Steele <david@pgmasters.net>
Date: Sun Sep 29 13:05:55 2019 +0000
Sort lists where it might help performance.
Most of these lists should be quite small with the exception of the list in get.c, but it doesn't cost much to sort them and may help in corner cases we have not thought of.
src/command/archive/get/get.c | 2 ++
src/command/restore/restore.c | 8 ++++++++
2 files changed, 10 insertions(+)
diff --git a/src/command/archive/get/get.c b/src/command/archive/get/get.c
index 4324aefbc..3370ae0bd 100644
--- a/src/command/archive/get/get.c
+++ b/src/command/archive/get/get.c
@@ -88,6 +88,8 @@ queueNeed(const String *walSegment, bool found, uint64_t queueSize, size_t walSe
}
// Generate a list of the WAL that are needed by removing kept WAL from the ideal queue
+ strLstSort(keepQueue, sortOrderAsc);
+
for (unsigned int idealQueueIdx = 0; idealQueueIdx < strLstSize(idealQueue); idealQueueIdx++)
{
if (!strLstExists(keepQueue, strLstGet(idealQueue, idealQueueIdx)))
diff --git a/src/command/restore/restore.c b/src/command/restore/restore.c
index eaa19564d..ddb628445 100644
--- a/src/command/restore/restore.c
+++ b/src/command/restore/restore.c
@@ -285,6 +285,7 @@ restoreManifestMap(Manifest *manifest)
if (tablespaceMap != NULL)
{
const VariantList *tablespaceMapList = kvKeyList(tablespaceMap);
+ strLstSort(tablespaceRemapped, sortOrderAsc);
for (unsigned int tablespaceMapIdx = 0; tablespaceMapIdx < varLstSize(tablespaceMapList); tablespaceMapIdx++)
{
@@ -369,6 +370,7 @@ restoreManifestMap(Manifest *manifest)
if (linkMap != NULL)
{
const VariantList *linkMapList = kvKeyList(linkMap);
+ strLstSort(linkRemapped, sortOrderAsc);
for (unsigned int linkMapIdx = 0; linkMapIdx < varLstSize(linkMapList); linkMapIdx++)
{
@@ -796,6 +798,8 @@ restoreCleanBuild(Manifest *manifest)
}
}
+ strLstSort(cleanData->fileIgnore, sortOrderAsc);
+
// Check that the path exists. If not, there's no need to do any cleaning and we'll attempt to create it later.
// Don't log check for the same path twice. There can be multiple links to files in the same path, but logging it more
// than once makes the logs noisy and looks like a bug.
@@ -1035,6 +1039,8 @@ restoreSelectiveExpression(Manifest *manifest)
strLstAddIfMissing(dbList, strBase(strPath(file->name)));
}
+ strLstSort(dbList, sortOrderAsc);
+
// If no databases were found then this backup is not a valid cluster
if (strLstSize(dbList) == 0)
THROW(FormatError, "no databases found for selective restore\nHINT: is this a valid cluster?");
@@ -1159,6 +1165,8 @@ restoreRecoveryOption(unsigned int pgVersion)
kvPut(result, VARSTR(key), VARSTR(value));
}
+
+ strLstSort(recoveryOptionKey, sortOrderAsc);
}
// Write restore_command
[parent: a58635ac0285]