Skip to content

Fix SQL constraint insert into entrytmp table#1638

Merged
Alkarex merged 2 commits intoFreshRSS:devfrom
Alkarex:tmp_unique_guids
Sep 24, 2017
Merged

Fix SQL constraint insert into entrytmp table#1638
Alkarex merged 2 commits intoFreshRSS:devfrom
Alkarex:tmp_unique_guids

Conversation

@Alkarex
Copy link
Copy Markdown
Member

@Alkarex Alkarex commented Sep 23, 2017

@Alkarex Alkarex added this to the 1.7.1 milestone Sep 23, 2017
@Alkarex
Copy link
Copy Markdown
Member Author

Alkarex commented Sep 23, 2017

@Trim Could you please test this patch?

@Frenzie
Copy link
Copy Markdown
Member

Frenzie commented Sep 23, 2017

@Trim in #1614 you mentioned you ran "a test". Would that be anything that could be put in unit test form to prevent regressions?

@Alkarex
Copy link
Copy Markdown
Member Author

Alkarex commented Sep 23, 2017

@Frenzie Related #1639

@Alkarex Alkarex merged commit a38bd3d into FreshRSS:dev Sep 24, 2017
@Alkarex Alkarex deleted the tmp_unique_guids branch September 24, 2017 11:02
@Trim
Copy link
Copy Markdown
Contributor

Trim commented Sep 24, 2017

Hello,

I've just seen that, PostgreSQL had no more logs about the feed http://www.geany.org/Main/HomePage?action=blogrss since the 15 September, but I don't know why.

Anyway, before the 15 September, I had these PostgreSQL errors after each RSS synchronizations:

2017-09-15 06:31:05 CEST [5711-1] freshrss@freshrss ERREUR:  la valeur d'une clé dupliquée rompt la contrainte unique « adrien_entrytmp_id_feed_guid_key »
2017-09-15 06:31:05 CEST [5711-2] freshrss@freshrss DÉTAIL:  La clé « (id_feed, guid)=(67, http://www.geany.org/Main/20170717) » existe déjà.
2017-09-15 06:31:05 CEST [5711-3] freshrss@freshrss INSTRUCTION :  INSERT INTO "adrien_entrytmp" (id, guid, title, author, content, link, date, "lastSeen", hash, is_read, is_favorite, id_feed, tags) VALUES($1, $2, $3, $4, $5, $6, $7, $8, decode($9, 'hex'), $10, $11, $12, $13)
2017-09-15 06:31:05 CEST [5711-4] freshrss@freshrss ERREUR:  la transaction est annulée, les commandes sont ignorées jusqu'à la fin du bloc
2017-09-15 06:31:05 CEST [5711-5] freshrss@freshrss INSTRUCTION :  UPDATE "adrien_feed" SET "lastUpdate"=$1, error=$2 WHERE id=$3

And no articles were found inside the Geany feed in FreshRSS.

After I've applied the patch, I didn't see any error in PostgreSQL and I was able to see two articles in the Geary feed. Although, it contained only two articles with title "Geany 1.30.1 is out!" and "Geany 1.31 is out!" without any content.

That's seems strange that I had only two articles without content despite the direct RSS feed url give me 3 articles with some content if I try to read sources directly. But, that, I've just checked its validity and the W3C validator says that's not valid: https://validator.w3.org/feed/check.cgi?url=http%3A%2F%2Fwww.geany.org%2FMain%2FHomePage%3Faction%3Dblogrss so that's not so strange finally :)

So, for me the bug reported (with the PostgreSQL errors due to guid conflict) is fixed with this patch. Thanks 👍

Edit:
Oh, I've just seen that in the patch you skip contents with same automatically computed GUID, that's why I only see 2 articles on 3 available, I understand and so every thing works as coded !

@Alkarex
Copy link
Copy Markdown
Member Author

Alkarex commented Sep 25, 2017

Thanks for the feedback.
For the record, I am considering changing our fallback mechanism for feeds without GUID to something like hash(link + title) instead of only link; and if there is no link, then use the default SimplePie hash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants