#1 2023-02-27 09:24:26

avavdoshin
Member
Registered: 2022-11-16
Posts: 25

RecordVersionSynchroniseSlave doesn't work with blobs and PostgreSQL

Arnaud, RecordVersionSynchroniseSlave doesn't synchronize tables with blob fields if SLAVE db is PostgreSQL (tested with mormot.db.sql.postgres).
It affect only with synchronisation. If i use PostgreSQL on master server, saving blobs works ok. Synchronisation works ok if slave db is sqlite.

Last edited by avavdoshin (2023-02-27 09:27:28)

Offline

#2 2023-02-27 09:40:42

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: RecordVersionSynchroniseSlave doesn't work with blobs and PostgreSQL

Could you investigate a little and find out what actually happens?

Offline

#3 2023-02-27 10:53:44

avavdoshin
Member
Registered: 2022-11-16
Posts: 25

Re: RecordVersionSynchroniseSlave doesn't work with blobs and PostgreSQL

ab wrote:

Could you investigate a little and find out what actually happens?

Batch prepared correct, but something happened in BatchSend, i suppose, because i've got error when step-by-step debug "TSqlDBPostgresStatement.ExecutePrepared: Invalid array type ftBlob on bound parameter #3" (it is one of my blob fields) "in mormot.db.sql.postgres.pas line 656"

Offline

#4 2023-02-27 21:09:27

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: RecordVersionSynchroniseSlave doesn't work with blobs and PostgreSQL

Please try with https://github.com/synopse/mORMot2/commit/7609b12b

It would be slower, but should not raise any exception any more.

Offline

#5 2023-02-28 06:33:16

avavdoshin
Member
Registered: 2022-11-16
Posts: 25

Re: RecordVersionSynchroniseSlave doesn't work with blobs and PostgreSQL

ab wrote:

Please try with https://github.com/synopse/mORMot2/commit/7609b12b

It would be slower, but should not raise any exception any more.

It works now, but only if there is no deleted rows. If i have any deleted row - table doesn't synchronise at all.
Maybe it affected not only tables with blobs, i don't know. In my case i do not delete rows in another tables.

Offline

#6 2023-03-01 06:59:03

avavdoshin
Member
Registered: 2022-11-16
Posts: 25

Re: RecordVersionSynchroniseSlave doesn't work with blobs and PostgreSQL

(i leave the same message in ISSUES on github)

First of all i delete all databases (master and slave)

Then i create new database on master (sqlite), create some orm instances (TSomeOrm, TSomeOtherOrm)
Then i create TMyBlobOrm instances with blobs (just simple strings in blob) on master, they had IDs 1,2,3,4,5,6
Then i delete TMyBlobOrm with id 4 on master
then create some other orm instances (TSomeAnotherORM) on master

Then i create SLAVE database (postgres) and synchronise from master (sqlite) to slave (postgresql) (calling RecordVersionSynchroniseSlave from slave).

In step-by-step debug i've got error
"Unexpected TSqlDBPostgresConnectionProperties.SharedTransaction (1,2)" in mormot.db.sql line 3701

Maybe it's because in prepared for sending batch i see in JSON that DELETE goes before all other lines? But this record cannot be deleted, it doesn't exist on slave server yet.

If i only create orm instances on master (with or without blobs, but do not delete any instance) - synchronise works ok

Offline

#7 2023-03-02 14:51:37

avavdoshin
Member
Registered: 2022-11-16
Posts: 25

Re: RecordVersionSynchroniseSlave doesn't work with blobs and PostgreSQL

fails on TRestOrmServerBatchSend.AutomaticCommit after sequence POST-POST-POST-POST-DELETE-POST if ID for delete doesn't exists. Can't find out reason yet. No error message except "TSqlDBPostgresConnectionProperties.SharedTransaction( )"

upd: If i comment whole part for encDelete in TRestOrmServerBatchSend.ExecuteValue it fails too with the same exception

Last edited by avavdoshin (2023-03-02 14:58:59)

Offline

#8 2023-03-02 15:45:33

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: RecordVersionSynchroniseSlave doesn't work with blobs and PostgreSQL

Is it the same if the slave is SQlite3?

Offline

#9 2023-03-02 17:00:22

avavdoshin
Member
Registered: 2022-11-16
Posts: 25

Re: RecordVersionSynchroniseSlave doesn't work with blobs and PostgreSQL

ab wrote:

Is it the same if the slave is SQlite3?

No, there is no problem at all if the slave is SQlite3.

Offline

Board footer

Powered by FluxBB