I'm trying to finish developing a kamailio server cluster using database
replication (db_mode=3). One of the issues is "split brain" when there is
network connection problem that prevents the database servers from replicating
data to each other for some time. This is especially bad for the serial int
type primary keys defined in current kamailio tables. When there is a conflict
in serial int primary keys, the record with the latest timestamp would win, but
that record may not always be the correct one, or may not even for the same
user. It seem the best solution to this problem is to use globally unique id as
primary key instead of serial int.
I have tried to change the id in location table from serial int to uuid, and
tested with pjsib clients. Things seem to work. uuid is supported by most
common databases now (postgresql and mysql at least). Wonder if it is a good
idea to change all serial int to uuid for all kamailio tables. I didn't verify
all modules, but it seems the db modules can handle all db types without any
code change. If I missed anything, or there is some spot we need to make code
change, please let me know.
Here is the change I made to location table (postgresql).
current id:
id SERIAL PRIMARY KEY NOT NULL,
to:
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/274
_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev