<p><a href="https://gerrit.osmocom.org/11898">View Change</a></p><p>5 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/#/c/11898/7/sql/hlr_index.sql">File sql/hlr_index.sql:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11898/7/sql/hlr_index.sql@3">Patch Set #7, Line 3:</a> <code style="font-family:monospace,monospace">CREATE UNIQUE INDEX idx_subscr_imsi ON subscriber (imsi);</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">we're now only using the hlr. […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">It is still necessary. Otherwise we get the following error when osmo-hlr is started without an existing database file:</p><p style="white-space: pre-wrap; word-wrap: break-word;">20181129131330319 DLGLOBAL NOTICE Available via telnet 127.0.0.1 4258 (telnet_interface.c:104)<br>20181129131330323 DMAIN NOTICE hlr starting (hlr.c:639)<br>20181129131330323 DDB NOTICE using database: hlr.db (db.c:299)<br>20181129131330327 DDB NOTICE Missing database tables detected; Bootstrapping database 'hlr.db' (db.c:347)<br>20181129131330331 DDB ERROR (1) index idx_subscr_imsi already exists (db.c:79)<br>20181129131330331 DDB ERROR Unable to prepare SQL statement '-- These statements are executed after database tables have been bootstrapped.<br>-- Statements which create indices can only be prepared once corresponding tables have been created.<br>CREATE UNIQUE INDEX idx_subscr_imsi ON subscriber (imsi)<br>' (db.c:204)<br>20181129131330331 DDB ERROR Failed to bootstrap DB: (rc=1) index idx_subscr_imsi already exists (db.c:357)</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/#/c/11898/7/src/db.c">File src/db.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11898/7/src/db.c@243">Patch Set #7, Line 243:</a> <code style="font-family:monospace,monospace">static bool db_is_bootstrapped_v0(struct db_context *dbc)</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">this is still kind of a mix between "is_bootstrapped" and "is_correct". […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">I would have thought that yes, indeed, this function will need to be revisted every time tables are added/removed with new schema versions.</p><p style="white-space: pre-wrap; word-wrap: break-word;">I don't see how this problem is any different for just one "subscriber" table vs. N tables.<br>But well, since you insist, I'll change it...</p></li><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11898/7/src/db.c@346">Patch Set #7, Line 346:</a> <code style="font-family:monospace,monospace">        if (!db_is_bootstrapped_v0(dbc)) {</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">let's break it down: […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">I'll try to apply these suggestions.</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/#/c/11898/7/src/hlr.c">File src/hlr.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11898/7/src/hlr.c@651">Patch Set #7, Line 651:</a> <code style="font-family:monospace,monospace">       }</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">(For a unit test, it would be helpful to exit the program right after a db upgrade, so first up I th […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Can't the unit test simply be a separate program from osmo-hlr?</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/#/c/11898/7/src/hlr_db_tool.c">File src/hlr_db_tool.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/#/c/11898/7/src/hlr_db_tool.c@64">Patch Set #7, Line 64:</a> <code style="font-family:monospace,monospace">   printf("  -U --upgrade-db            Allow HLR database schema upgrades.\n");</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">(the variables and other options are all called 'db-foo', this is the only one called 'foo-db')</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">Thanks for spotting that. I'll fix it.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/11898">change 11898</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/11898"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-hlr </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: I8aeaa9a404b622657cbc7138106f38aa6ad8d01b </div>
<div style="display:none"> Gerrit-Change-Number: 11898 </div>
<div style="display:none"> Gerrit-PatchSet: 7 </div>
<div style="display:none"> Gerrit-Owner: Stefan Sperling <ssperling@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Pau Espin Pedrol <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Stefan Sperling <ssperling@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Vadim Yanitskiy <axilirator@gmail.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Mon, 03 Dec 2018 14:49:44 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-HasLabels: No </div>