Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions src/command/archive/find.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));

// Clear list for next find
strLstFree(this->list);
this->list = NULL;
match = strLstSize(matchList);

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, ", ")));
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, ", ")));
}
}

// On match copy file name of WAL segment found into the prior context
Expand Down
Loading