NS Marriage Bonds 1836 show Samuel Ellis of Yarmouth, widower, contracting to marry Susanna Perry, widow.
Brown, Yarmouth Genealogies, p. 102:
Ellis, Capt. Samuel. s/o Ebenezer 1st, m. (1) 1797, June 23, Hannah Bartlett, d/o Lemuel, and
(2) Susanna (Magray) Perry, widow of Levi. Capt. Samuel died 28 December 1860.
Ibid, p. 86:
Susanna Magray, b. ca. 1773, d/o Capt. John Magray and Elizabeth Allen, m. (1) Levi Perry, s/o Moses, and (2) Samuel Ellis, s/o Ebenezer 1st. She died 12 November 1855.
Ibid, p. 102:
The eldest child of Capt. Samuel Ellis and his wife Hannah was
Samuel, 2nd, b. 10 March 1800. He married Susanna Perry* d/o Robert and he died September 1833.
Ibid p. 543:
Susanna Parry, born 21 January 1800, d/o Capt. Robert Parry and his wife Susanna Coffran, married Capt. Samuel Ellis 2nd, s/o Capt. Samuel.
My take on all this is that the record you posted has condensed the two generations into one (not at all surprising given that both father and son were named Samuel Ellis and both married a woman named Susanna Perry!) The marriage you quoted refers to Samuel 1st; his 2nd wife Susanna was the daughter of Capt. John Magray and widow of Levi Perry. The death record for Susanna d/o Robert and Susan is for the widow of Samuel's son, Samuel 2nd, who had himself died before his father remarried.
*To add to the confusion, there were two very distinct lineages in Yarmouth in the early years, Perry and Parry, and in the 18th and 19th centuries most of them spelled it "Perry" regardless. Brown successfully untangles them (p. 527ff for Perry and 541ff for Parry. However, in his other genealogies, it is often spelled Perry by mistake. (I have Parry ancestry, and I've had to deal with this a lot!) Moses Perry was the original settler of that spelling--and one of the three 1st settlers of Yarmouth, who came from Sandwich, MA in 1761; it was his son Levi who married Susanna Magray, so she is properly Perry.
Capt. Robert Parry was a son of John Parry 1st, the original settler of that name (who came from Connecticut via Cumberland Co., NS a year or two later.) So Samuel 2nd's wife is properly Susanna Parry.