Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dlg_id as primary key and single dialog table shared by multiple opensips instances #306

Closed
mikomarrache opened this issue Aug 19, 2014 · 3 comments

Comments

@mikomarrache
Copy link

Hi,

After the dialog table schema has been changed to replace the hash_entry and hash_id columns by the new dlg_id column, the dlg_id column is now the primary key of the table (while only an index - non UNIQUE - was defined before for the (hash_entry,hash_id) columns).

With a configuration where multiple opensips instances share the same dialog table, I can imagine a case where multiple instances create dialogs with the same (hash_entry,hash_id) pair. The problem is that if one instance inserts a dialog with the coordinates (6,2) and that some time after another instance inserts a new dialog with the coordinates (6,2), the database will reject the INSERT statement since the dlg_id will be the same for both dialogs.

Regards,
Mickael

@liviuchircu
Copy link
Member

Hello Mickael,

Is this a real-life scenario? To me, this looks like a problem which should not be addressed, since there are alternatives (either deploy a backup instance for each primary instance, or put more load on one machine, and make the other one a backup). You can use dialog replication if you want "hot backups".

Looking at the problem from a generic perspective, it is similar to the "master-master replication" database scenario. Doing inserts on both nodes will eventually lead to inconsistencies even on the latest MySQL versions, since it just was not meant to be used this way.

liviuchircu added a commit that referenced this issue Aug 21, 2014
When updating rows in the dialog table in REALTIME db mode, the dlg_id
update key is not properly initialized (actually contains random data).

Reported by miko95 on GitHub
Closes issue #306
liviuchircu added a commit that referenced this issue Aug 21, 2014
When updating rows in the dialog table in REALTIME db mode, the dlg_id
update key is not properly initialized (actually contains random data).

Reported by miko95 on GitHub
Closes issue #306
(cherry picked from commit 0ad3e4f)
liviuchircu added a commit that referenced this issue Aug 21, 2014
When updating rows in the dialog table in REALTIME db mode, the dlg_id
update key is not properly initialized (actually contains random data).

Reported by miko95 on GitHub
Closes issue #306
(cherry picked from commit 0ad3e4f)
@mikomarrache
Copy link
Author

Hi Liviu,

This is the architecture we use for a long time.

We have N OpenSIPS instances that share the same dialog table. Traffic is load balanced over the instances. I agree that dialogs are exclusive to each instance (a dialog that doesn't belong to an instance would be ignored by this instance during a restart) but we use this to centralize the dialogs in a single table.

Mickael

@mikomarrache
Copy link
Author

Hi Liviu,

I think your argumentation is right, we will think about using one dialog table per instance so that we never encounter this issue.

Regards,
Mickael

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants