toluaina / pgsync

Postgres to Elasticsearch/OpenSearch sync
https://pgsync.com
MIT License
1.16k stars 181 forks source link

Initially postgres data will get sync with ES but further updates doesn't get synced. #369

Open masodekar opened 1 year ago

masodekar commented 1 year ago

@toluaina can you help me troubleshoot this issue?

PGSync version: 2.3.2 (pulled from main branch)

Postgres version: PostgreSQL 14.5 (Debian 14.5-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit

Elasticsearch version: 8.4.1

Redis version: redis-cli 6.0.16

Python version: 3.10

Problem Description: New records are not going to ES, logs are shown below.

image

Mode: daemon

Additonal Info: I have added plugins for transformation.

Observation: if we restart PGSync all the records sync to ES correctly. But its not ideal to restart it everytime

schema.json

[
    {
        "database": "voice-analytics-2",
        "index": "calls-synced",
        "plugins": [
            "comment"
        ],
        "mapping": {
            "reactions": {
                "type": "nested"
            }
        },
        "routing": "call_id",
        "nodes": {
            "table": "calls_comments",
            "columns": [
                "id",
                "call_id",
                "text",
                "parent_id",
                "type",
                "call_location",
                "created_by",
                "created_at",
                "updated_at",
                "updated_by"
            ],
            "transform": {
                "rename": {
                    "id": "commentId",
                    "text": "commentText",
                    "parent_id": "parentId",
                    "created_by": "createdBy",
                    "created_at": "createdAt",
                    "updated_at": "updatedAt",
                    "updated_by": "updatedBy"
                }
            },
            "children": [
                {
                    "table": "calls_comments_reactions",
                    "columns": [
                        "code",
                        "created_at",
                        "created_by"
                    ],
                    "transform": {
                        "rename": {
                            "code": "reactionCode",
                            "created_by": "createdBy",
                            "created_at": "createdAt"
                        }
                    },
                    "label": "reactions",
                    "relationship": {
                        "variant": "object",
                        "type": "one_to_many",
                        "foreign_key": {
                            "child": [
                                "comment_id"
                            ],
                            "parent": [
                                "id"
                            ]
                        }
                    }
                }
            ]
        }
    }
]
toluaina commented 1 year ago

looks like a duplicated issue