﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
175	Unique constraint violation in clustered mode	e.ropartz		"Hi,

We used zooproject in a clustered mode. So we have a database backend to share ongoing informations of running services between 2 ZOO-Kernel instances.
When the load on the cluster increases, some requests fails due to databases errors : 

''ERROR 1: ERROR: duplicate key value violates unique constraint ""services_osid_key"" DÉTAIL : Key (osid)=(1593003150) already exists. ERROR 1: ERROR: insert or update on table ""responses"" violates foreign key constraint ""responses_uuid_fkey"" DÉTAIL : Key (uuid)=(519e1ea2-b481-11ea-917c-005056b8dc20) is not present in table ""services"".

- The osid value calculated by the kernel is not unique 

The osid is calculated by the script zoo-project/zoo-kernel/zoo_service_loader.c (line 830) :
'' sprintf (tmpBuff, ""%i"", (cpid + ((int) tp.tv_sec + (int) tp.tv_usec))); 

- In some cases, the PID variation is cancelled by the timestamp variation







"	defect	closed	critical		zoo-kernel		fixed	cluster	
