#1 Re: mORMot 2 » Exception in TRestOrmServer.RecordVersionSynchronizeSlave » Yesterday 20:43:41

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

#2 mORMot 2 » Exception in TRestOrmServer.RecordVersionSynchronizeSlave » 2024-11-19 18:36:38

MikeCheater
Replies: 2

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.

Board footer

Powered by FluxBB