openbsc[master]: libmsc: db_subscriber_alloc_exten() remove infinite loop

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Keith Whyte gerrit-no-reply at lists.osmocom.org
Thu Sep 14 18:16:47 UTC 2017


Patch Set 5:

> >
 > > That could work, right?
 > 
 > OK this will give you a random available extension:
 > 
 > SELECT t.extension+1, t2.extension AS ext
 > FROM subscriber AS t
 > LEFT OUTER JOIN subscriber AS t2 ON
 > t.extension+1 = t2.extension
 > WHERE t2.extension IS NULL
 > ORDER BY RANDOM() LIMIT 1;

Actually something other than +1 (maybe something random here) would avoid sequential numbers if desired. 
By somehow "seeding" the db, then adding limits to stay within the constraints of GSM_MAX_EXTEN and GSM_MIN_EXTEN it could be good to go. 

I wonder if sqlite is more efficient at doing this than we would be.
I'm getting more or less

 CPU Time: user 0.220000 sys 0.016000

on a database with ~ 21000 subscriber entries.

I will write up and push the patch and see what folks think..

-- 
To view, visit https://gerrit.osmocom.org/3910
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Icf0f1e5a7f360bc27592a55890f74a9a12bc9f42
Gerrit-PatchSet: 5
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Keith Whyte <keith at rhizomatica.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Keith Whyte <keith at rhizomatica.org>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pablo Neira Ayuso <pablo at gnumonks.org>
Gerrit-HasComments: No



More information about the gerrit-log mailing list