benoitdm-oslandia / pg_featureserv

Apache License 2.0
1 stars 0 forks source link

feat(catalog_db): add trigger and listener to database events - [merged] #116

Closed benoitdm-oslandia closed 1 year ago

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 10, 2022, 16:00

Merges feature/listen-notify -> develop

close #50

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 11, 2022, 16:58

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 11, 2022, 17:02

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 11, 2022, 17:44

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

merge les 2 if ensemble stp

benoitdm-oslandia commented 1 year ago

merge les 2 if ensemble stp

benoitdm-oslandia commented 1 year ago

merge les 2 if ensemble stp

benoitdm-oslandia commented 1 year ago

est ce qu'on ne pourrait pas faire un type de donnée plutot ?

benoitdm-oslandia commented 1 year ago

on n'ajoute pas le notificationInterface["new_xmin"] dans le cache dans le cas de l'insert ?

benoitdm-oslandia commented 1 year ago

je pense que le code généré ne passera pas avec une table qui contient des caractères spéciaux

benoitdm-oslandia commented 1 year ago

la go func qui fait le listen, comment est ce qu'on l'arrête ?

benoitdm-oslandia commented 1 year ago

typo: est ce que ce block pourrait etre indenté plus vers la gauche ?

benoitdm-oslandia commented 1 year ago

j'y pense, les objets que l'on crée devraient être dans un schema specifiable ... je pense à certains clients que ne veulent pas avoir des trucs temporaires qui polluent leur base. Quitte à créer un schéma 'pg_featureserv' par défaut. pour la gestion du parametre de conf on verra plus tard

benoitdm-oslandia commented 1 year ago

Top @azarz ! As tu une idée pour le test ?

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 10:11

Commented on internal/data/catalog_db.go line 103

Oui, vu qu'a priori on connaît la structure de la notification.

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 10:11

Commented on internal/data/catalog_db.go line 111

Oups, oubli de ma part

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 10:14

Commented on internal/data/catalog_db.go line 609

caratères UTF-8 "exotiques" (kanji...) ou bien caractères du type ;, ., ' ? Dans le 2e cas en effet c'est sûr que ça ne passe pas, mais peut-on se retrouver dans ce cas ? Dans le 1er cas, ce sera à tester avec #54 , non ?

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 10:15

Commented on internal/data/catalog_db.go line 220

Bonne question, je regarde ça, parce qu'en l'état pas sûr que la goroutine se stoppe en effet

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 10:22

Pour faire le test je pense que j'ai besoin des fonctions spécifiques du cache (branche de Nicolas) pour vérifier qu'il a bien été mis à jour : Test :

Pour "vérifier que le cache xxx", je ne sais pas comment faire en l'état, c'est pour ça que je pense que j'ai besoin des devs de @nrevelant

benoitdm-oslandia commented 1 year ago

ok ! alors, à ajouter dans la #54 : https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 11:01

Commented on internal/data/catalog_db.go line 111

En fait si, c'est fait ligne 113 :

Si ce n'est pas un INSERT, on supprime l'ancienne entrée du cache,

Après, si ce n'est pas un DELETE, on ajoute la nouvelle entrée au cache

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 11:07

Commented on internal/data/db_sql.go line 101

On crée un schema pg_featureserv à l'intitialisation du catalog_db, on met les trucs temporaires dedans (pour l'instant juste cette fonction), et au moment de fermer le catalogue, on fait un DROP SCHEMA CASCADE ?

benoitdm-oslandia commented 1 year ago

ok !! c'est perturbant les != :) Est ce que tu peux le ré écrire avec des == ? (stp)

benoitdm-oslandia commented 1 year ago

oui par exemple !

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 11:13

Commented on internal/data/catalog_db.go line 111

J'aimais bien les != parce que dans le cas du UPDATE on fait les 2 opérations, l'écriture des == est légèrement plus lourde : on passe de

if notificationInterface["action"] != "INSERT" {

à

if notificationInterface["action"] == "DELETE" || notificationInterface["action"] == "UPDATE" {

C'est grave ?

benoitdm-oslandia commented 1 year ago

ca me parait plus clair avec les == et comme ca on voit bien les types d'action concernés

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 11:29

Commented on internal/data/catalog_db.go line 84

changed this line in version 5 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 11:29

Commented on internal/data/catalog_db.go line 91

changed this line in version 5 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 11:29

Commented on internal/data/catalog_db.go line 99

changed this line in version 5 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 11:29

Commented on internal/data/catalog_db.go line 103

changed this line in version 5 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 11:29

Commented on internal/data/catalog_db.go line 111

changed this line in version 5 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 11:29

Commented on internal/data/db_sql.go line 127

changed this line in version 5 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 11:29

Commented on internal/data/db_sql.go line 101

changed this line in version 5 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 11:29

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 11:29

Commented on internal/data/db_sql.go line 101

Le nom de schema pg_featureserv n'est pas acceptable en postgres (préfixe pg_) -> j'ai opté pour pgfeatureserv

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 11:30

Commented on internal/data/catalog_db.go line 220

La goroutine s'arrête via un signal envoyé via un channel go que je viens d'ajouter.

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 11:44

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 11:45

Commented on internal/data/catalog_db.go line 103

Type ajouté : https://git.oslandia.net/Client-projects/geoplateforme-ign-pg-featureserv/-/merge_requests/27/diffs#6835afa41c7538b02991063203115d25b036cca0_44_50

benoitdm-oslandia commented 1 year ago

Sinon le pgfeatureserv tu le mets dans une const dans catalog_db.go on verra plus tard pour ajouter l'option dans la conf ?

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 13:52

Commented on internal/data/catalog_db.go line 185

changed this line in version 7 of the diff

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 13:52

added 1 commit

Compare with previous version

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 12, 2022, 13:54

Commented on internal/data/catalog_db.go line 185

Done https://git.oslandia.net/Client-projects/geoplateforme-ign-pg-featureserv/-/merge_requests/27/diffs?diff_id=13775&start_sha=82728dd5c6986077afd00f1060b5ed71a0d310ad#6835afa41c7538b02991063203115d25b036cca0_63_64

benoitdm-oslandia commented 1 year ago

c'est étrange comme façon d'écrire mais bon c'est du go

benoitdm-oslandia commented 1 year ago

Bon donc on attend @nrevelant pour les tests !

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 13, 2022, 15:00

Commented on internal/data/catalog_db.go line 132

Oui j'ai trouvé la syntaxe bizarre, c'est assez spécifique aux channels j'ai l'impression

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 14, 2022, 17:59

added 13 commits

Compare with previous version

benoitdm-oslandia commented 1 year ago

commentaire stp!

benoitdm-oslandia commented 1 year ago

log.Debug avec un message complet ou rien

benoitdm-oslandia commented 1 year ago

Ok, juste une dernière remarque concernant tout ce code : est ce qu'on ne pourrait pas le sortir dans une classe/fichier à part ?

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 17, 2022, 10:14

Oui effectivement ça ferait plus propre ! Je vais voir comment, notmemment au niveau de la goroutine.

L'idée serait de tout mettre dans une seule classe, y compris les créations de triggers ? Comment l'appeler ? listener.go ?

benoitdm-oslandia commented 1 year ago

In GitLab by @azarz on Oct 17, 2022, 10:20

Commented on internal/data/catalog_db.go line 129

changed this line in version 10 of the diff