From 2a98759a5186d8c6555b3a9aa369169e04da1d89 Mon Sep 17 00:00:00 2001 From: Georgy Shelkovy Date: Wed, 11 Mar 2026 13:53:30 +0500 Subject: [PATCH 1/5] unique list --- src/storage/storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/storage.c b/src/storage/storage.c index 6214c62b82..dd686a0be4 100644 --- a/src/storage/storage.c +++ b/src/storage/storage.c @@ -444,7 +444,7 @@ storageList(const Storage *const this, const String *const pathExp, const Storag result = strLstNew(); while (storageItrMore(storageItr)) - strLstAdd(result, storageItrNext(storageItr).name); + strLstAddIfMissing(result, storageItrNext(storageItr).name); strLstMove(result, memContextPrior()); } From 8deb9ec13394fa7624f6bccac42514b63faab1a4 Mon Sep 17 00:00:00 2001 From: Georgy Shelkovy Date: Wed, 11 Mar 2026 14:20:49 +0500 Subject: [PATCH 2/5] mv --- src/command/archive/find.c | 7 ++++++- src/storage/storage.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/command/archive/find.c b/src/command/archive/find.c index dbfb26b97b..daf0ad43f4 100644 --- a/src/command/archive/find.c +++ b/src/command/archive/find.c @@ -141,17 +141,22 @@ walSegmentFind(WalSegmentFind *const this, const String *const walSegment) StringList *const matchList = strLstNew(); for (unsigned int matchIdx = 0; matchIdx < match; matchIdx++) - strLstAdd(matchList, strLstGet(this->list, matchIdx)); + strLstAddIfMissing(matchList, strLstGet(this->list, matchIdx)); + + match = strLstSize(matchList); // Clear list for next find strLstFree(this->list); this->list = NULL; + if (match > 1) + { THROW_FMT( ArchiveDuplicateError, "duplicates found in archive for WAL segment %s: %s\n" "HINT: are multiple primaries archiving to this stanza?", strZ(walSegment), strZ(strLstJoin(matchList, ", "))); + } } // On match copy file name of WAL segment found into the prior context diff --git a/src/storage/storage.c b/src/storage/storage.c index dd686a0be4..6214c62b82 100644 --- a/src/storage/storage.c +++ b/src/storage/storage.c @@ -444,7 +444,7 @@ storageList(const Storage *const this, const String *const pathExp, const Storag result = strLstNew(); while (storageItrMore(storageItr)) - strLstAddIfMissing(result, storageItrNext(storageItr).name); + strLstAdd(result, storageItrNext(storageItr).name); strLstMove(result, memContextPrior()); } From 1c396fa7b39080c821f8f062c9eed16b4fef5ce7 Mon Sep 17 00:00:00 2001 From: Georgy Shelkovy Date: Wed, 11 Mar 2026 14:22:01 +0500 Subject: [PATCH 3/5] mv --- src/command/archive/find.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/command/archive/find.c b/src/command/archive/find.c index daf0ad43f4..6d5510181b 100644 --- a/src/command/archive/find.c +++ b/src/command/archive/find.c @@ -145,12 +145,12 @@ walSegmentFind(WalSegmentFind *const this, const String *const walSegment) match = strLstSize(matchList); + if (match > 1) + { // Clear list for next find strLstFree(this->list); this->list = NULL; - if (match > 1) - { THROW_FMT( ArchiveDuplicateError, "duplicates found in archive for WAL segment %s: %s\n" From b298adc86fb8e806b9593b3fa7915df52de73102 Mon Sep 17 00:00:00 2001 From: Georgy Shelkovy Date: Wed, 11 Mar 2026 14:24:55 +0500 Subject: [PATCH 4/5] format --- src/command/archive/find.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/command/archive/find.c b/src/command/archive/find.c index 6d5510181b..95a4e32004 100644 --- a/src/command/archive/find.c +++ b/src/command/archive/find.c @@ -147,16 +147,16 @@ walSegmentFind(WalSegmentFind *const this, const String *const walSegment) if (match > 1) { - // Clear list for next find - strLstFree(this->list); - this->list = NULL; - - THROW_FMT( - ArchiveDuplicateError, - "duplicates found in archive for WAL segment %s: %s\n" - "HINT: are multiple primaries archiving to this stanza?", - strZ(walSegment), strZ(strLstJoin(matchList, ", "))); - } + // Clear list for next find + strLstFree(this->list); + this->list = NULL; + + THROW_FMT( + ArchiveDuplicateError, + "duplicates found in archive for WAL segment %s: %s\n" + "HINT: are multiple primaries archiving to this stanza?", + strZ(walSegment), strZ(strLstJoin(matchList, ", "))); + } } // On match copy file name of WAL segment found into the prior context From 50c67e1d312d06aaedb4687f88100197a90be8e9 Mon Sep 17 00:00:00 2001 From: Georgy Shelkovy Date: Wed, 11 Mar 2026 14:28:12 +0500 Subject: [PATCH 5/5] mv --- src/command/archive/find.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/command/archive/find.c b/src/command/archive/find.c index 95a4e32004..852a93ce66 100644 --- a/src/command/archive/find.c +++ b/src/command/archive/find.c @@ -156,7 +156,7 @@ walSegmentFind(WalSegmentFind *const this, const String *const walSegment) "duplicates found in archive for WAL segment %s: %s\n" "HINT: are multiple primaries archiving to this stanza?", strZ(walSegment), strZ(strLstJoin(matchList, ", "))); - } + } } // On match copy file name of WAL segment found into the prior context