Duplicated SmartGuids on IOS

Hi Wagner,

I've been looking at getting our app working on IOS and the first problem that I am seeing is occasionally we are getting duplicated ID's. Is this something that you have had reports of? (We are not using the native SQLite driver that you did for Aurelius but the one that comes with FireDac as I was thinking about encrypting it on the phone at some stage.) It works fine on Android and with Windows. Here's an extract of the log showing it happening.

------------ SQL Start------------ 
INSERT INTO GC_LOAD_ITEM (   ID, CAPTION, DISPLAY_LABEL, ITEM_GROUP, MASTER_ID, MOBILE_DEVICE_ID, PICKED, TABLE_ID, TABLE_NAME, TICKET_DATA_TYPE, TICKET_NUMBER)  VALUES (   :p1, :p2, :p3, :p4, :p5, :p6, :p7, :p8, :p9, :p10, :p11)
p1 = "{3A0A39C5-C25A-ED11-AB83-4E3C62B67329}" (ftFixedChar)
p2 = "" (ftString)
p3 = "Haulier" (ftString)
p4 = "1" (ftInteger)
p5 = "{3A0A39C5-C249-ED11-AB83-4E3C62B67329}" (ftFixedChar)
p6 = "{3A0A029A-5F71-4396-ADB5-D341B000A880}" (ftFixedChar)
p7 = "" (ftMemo)
p8 = "0" (ftInteger)
p9 = "HAULIER" (ftString)
p10 = "Caption" (ftString)
p11 = "23019" (ftInteger)
------------ SQL End ------------ 

            [3/27/23 9:42:25 AM][ThreadId:131351104][Trace]
------------ SQL Start------------ 
INSERT INTO GC_LOAD_ITEM (   ID, CAPTION, DISPLAY_LABEL, ITEM_GROUP, MASTER_ID, MOBILE_DEVICE_ID, PICKED, TABLE_ID, TABLE_NAME, TICKET_DATA_TYPE, TICKET_NUMBER)  VALUES (   :p1, :p2, :p3, :p4, :p5, :p6, :p7, :p8, :p9, :p10, :p11)
p1 = "{3A0A39C5-C25A-ED11-AB83-4E3C62B67329}" (ftFixedChar)
p2 = "" (ftString)
p3 = "Vehicle" (ftString)
p4 = "1" (ftInteger)
p5 = "{3A0A39C5-C249-ED11-AB83-4E3C62B67329}" (ftFixedChar)
p6 = "{3A0A029A-5F71-4396-ADB5-D341B000A880}" (ftFixedChar)
p7 = "" (ftMemo)
p8 = "0" (ftInteger)
p9 = "VEHICLE" (ftString)
p10 = "Caption" (ftString)
p11 = "23019" (ftInteger)
------------ SQL End ------------ 

            [3/27/23 9:42:25 AM][ThreadId:131351104][Error]FireDac Error
Message:
[FireDAC][Phys][SQLite] ERROR: UNIQUE constraint failed: GC_LOAD_ITEM.ID
SQL:
INSERT INTO GC_LOAD_ITEM (   ID, CAPTION, DISPLAY_LABEL, ITEM_GROUP, MASTER_ID, MOBILE_DEVICE_ID, PICKED, TABLE_ID, TABLE_NAME, TICKET_DATA_TYPE, TICKET_NUMBER)  VALUES (   :p1, :p2, :p3, :p4, :p5, :p6, :p7, :p8, :p9, :p10, :p11)
Params:
P1={3A0A39C5-C25A-ED11-AB83-4E3C62B67329}
P2=
P3=Vehicle
P4=1
P5={3A0A39C5-C249-ED11-AB83-4E3C62B67329}
P6={3A0A029A-5F71-4396-ADB5-D341B000A880}
P7=
P8=0
P9=VEHICLE
P10=Caption
P11=23019
ClassName=ESQLiteNativeException
ErrorCode=1555
FDObjName=TFDQuery($39845E00)

Regards

Steve

Hi Steve,

No, we are not aware of it. Is this something that happens frequently, easy reproducible? Does it also happen if you just use a regular GUID as id generator, not a smart GUID?

Hi Wagner,

Attached is a Test Case showing the error on a Mac Mini.
MyAureliusTests.zip (7.1 KB)

In Windows it works fine but against the MAC I get the problem using Delphi 11.3

Last login: Tue Mar 28 09:15:32 on ttys000
/Applications/PAServer-22.0.app/Contents/MacOS/paserver ; exit;
stevesinclair@Steves-Mac-mini ~ % /Applications/PAServer-22.0.app/Contents/MacOS/paserver ; exit;
Platform Assistant Server  Version 13.3.12.6
Copyright (c) 2009-2023 Embarcadero Technologies, Inc.

Connection Profile password <press Enter for no password>: 

Starting Platform Assistant Server on port 64211

Type ? for available commands
>
>**********************************************************************
*        DUnitX - (c) 2015-2018 Vincent Parrett & Contributors       *
*                                                                    *
*        License - http://www.apache.org/licenses/LICENSE-2.0        *
**********************************************************************

Fixture : uMyAureliusTestObject
-------------------------------------------------
Fixture : uMyAureliusTestObject.TMyAureliusTestObject
-------------------------------------------------
Running Fixture Setup Method : SetupFixture
2023-03-28 11:29:21.425 MyAureliusTests[1665:66350] [28/03/2023 11:29:21][Trace][Value: CREATE TABLE CUSTOMER (   ID TEXT NOT NULL,   NAME TEXT NOT NULL,   DATE_CREATED REAL NOT NULL,   CONSTRAINT PK_CUSTOMER PRIMARY KEY (ID))][Type: string]

Test : uMyAureliusTestObject.TMyAureliusTestObject.TestSmartGuid
-------------------------------------------------
Executing Test : TestSmartGuid

2023-03-28 11:29:21.426 MyAureliusTests[1665:66350] [28/03/2023 11:29:21][Trace][Value: INSERT INTO CUSTOMER (   ID, NAME, DATE_CREATED)  VALUES (   :p1, :p2, :p3)][Type: string]
2023-03-28 11:29:21.426 MyAureliusTests[1665:66350] [28/03/2023 11:29:21][Trace][Value: p1 = "{3A0A3F4E-0412-ED11-BA33-4E3C62B67326}" (ftFixedChar)][Type: string]
2023-03-28 11:29:21.426 MyAureliusTests[1665:66350] [28/03/2023 11:29:21][Trace][Value: p2 = "0" (ftString)][Type: string]
2023-03-28 11:29:21.426 MyAureliusTests[1665:66350] [28/03/2023 11:29:21][Trace][Value: p3 = "45013.4787202083" (ftFloat)][Type: string]
2023-03-28 11:29:21.426 MyAureliusTests[1665:66350] [28/03/2023 11:29:21][Trace][Value: INSERT INTO CUSTOMER (   ID, NAME, DATE_CREATED)  VALUES (   :p1, :p2, :p3)][Type: string]
2023-03-28 11:29:21.426 MyAureliusTests[1665:66350] [28/03/2023 11:29:21][Trace][Value: p1 = "{3A0A3F4E-0412-ED11-BA33-4E3C62B67326}" (ftFixedChar)][Type: string]
2023-03-28 11:29:21.426 MyAureliusTests[1665:66350] [28/03/2023 11:29:21][Trace][Value: p2 = "1" (ftString)][Type: string]
2023-03-28 11:29:21.426 MyAureliusTests[1665:66350] [28/03/2023 11:29:21][Trace][Value: p3 = "45013.4787202083" (ftFloat)][Type: string]
Test Error : TestSmartGuid : UNIQUE constraint failed: CUSTOMER.ID

Running Fixture Teardown Method : TearDownFixture



Done testing.
Tests Found   : 1
Tests Ignored : 0
Tests Passed  : 0
Tests Leaked  : 0
Tests Failed  : 0
Tests Errored : 1

Tests With Errors

  uMyAureliusTestObject.TMyAureliusTestObject.TestSmartGuid
  Message: UNIQUE constraint failed: CUSTOMER.ID


Done.. press <Enter> key to quit.^[[A^[[A^[[A^[[A
q - stop the server
c - print all clients
p - print port number
i - print available IP addresses
s - print scratch directory
g - generate login passfile
v - toggle verbose mode
w - toggle wifi devices mode
r - reset, terminate all child processes
>


I wonder if it is because I am running an ARM version of Windows under Parallels on a new Mac Mini? I listened to a YouTube video where David Millington was speaking and he said there were some issues with floating point numbers under ARM.

2023-03-28 11_47_27-Clipboard

Regards

Steve

Hi Steve,

Thank you very much for the project. We were able to trace and solve the issue. Fix will be included in next release.