#1 2024-11-19 18:36:38

MikeCheater
Member
Registered: 2020-04-17
Posts: 2

Exception in TRestOrmServer.RecordVersionSynchronizeSlave

Hi everyone,

I'm encountering an exception within the TRestOrmServer.RecordVersionSynchronizeSlave function when using a synchronization model with only one table.
The issue seems to lie within mormot.orm.server, specifically around line 854:

  if (t > PtrUInt(length(fRecordVersionMax))) or (fRecordVersionMax[t] = 0) then
    InternalRecordVersionMaxFromExisting(t, {next=}false);

My model is defined as follows:

FModel := TOrmModel.Create([TMasterDataVersioned]);

The exception occurs only with this single-table model. If I define the model with additional tables, like so:

FModel := TOrmModel.Create([TMasterData, TMasterDataVersioned]);

or

FModel := TOrmModel.Create([TOrmTableDeleted, TMasterDataVersioned]);

the synchronization works correctly.

I've found a workaround by modifying the TRestOrmServer.RecordVersionSynchronizeSlave function as follows:

  if (length(fRecordVersionMax) = 0) or (t > PtrUInt(length(fRecordVersionMax))) or (fRecordVersionMax[t] = 0) then
    InternalRecordVersionMaxFromExisting(t, {next=}false);

With this change, the function operates as expected. Is this a known issue?
Could someone explain why this workaround is necessary and if there's a more appropriate solution?
Thanks in advance for any assistance.

Offline

#2 2024-11-20 07:48:15

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

Re: Exception in TRestOrmServer.RecordVersionSynchronizeSlave

This was indeed a regression when converting to mORMot 2.

Please try with https://github.com/synopse/mORMot2/commit/0f2a2ae0

Offline

#3 2024-11-20 20:43:41

MikeCheater
Member
Registered: 2020-04-17
Posts: 2

Re: Exception in TRestOrmServer.RecordVersionSynchronizeSlave

Hi Arnaud,
Thank you very much. It works as expected now.

Offline

Board footer

Powered by FluxBB