https://code.grnet.gr/2011-09-23T16:39:06+03:00Greek Research and Technology Network's projectsSynnefo - Bug #1255: Incomplete constraints in ImageMetadata Modelhttps://code.grnet.gr/issues/1255?journal_id=49452011-09-23T16:39:06+03:00Giorgos Verigakis
<ul></ul><p>Apart from this not being visible in the models, is it causing any actual problems?</p>
<p>Both update_metadata and create_metadata_item check for existing meta with the same key. You should not be able to create two meta with the same key on the same server or image.</p> Synnefo - Bug #1255: Incomplete constraints in ImageMetadata Modelhttps://code.grnet.gr/issues/1255?journal_id=49552011-09-23T17:36:53+03:00Vangelis Koukis
<ul></ul><p>Checking for existence before adding the row in the DB has a race, and this has actually happened. What do you do if two clients at exactly the same time try to add the same metadata key to the same VM? The API adds two same rows in the table for image metadata.<br />When this happens the DB is in inconsistent state, and the API barfs -- ask [kpap].</p>
<p>I think the best thing to do would be:<br />a) enforce the restriction in the DB [in general, <strong>every</strong> restriction should be enforce in the DB if possible]<br />b) to avoid races, catch the DB exception when the API attempts to insert a duplicate row, and return an appropriate cloud fault.<br />c) related to (b): Does the API prescribe a specific error code when trying to insert a duplicate metadata key?</p> Synnefo - Bug #1255: Incomplete constraints in ImageMetadata Modelhttps://code.grnet.gr/issues/1255?journal_id=49572011-09-23T17:44:46+03:00Giorgos Verigakis
<ul></ul><p>Maybe this is related to the transactions ticket then? It was previously discussed that each API call should run in its own transaction. Race conditions like this one exist all over the API and in most cases will cause a 500 fault.</p>
<p>Regarding c, the OpenStack API allows passing existing keys and in that case replaces the old values.</p> Synnefo - Bug #1255: Incomplete constraints in ImageMetadata Modelhttps://code.grnet.gr/issues/1255?journal_id=49592011-09-23T17:56:52+03:00Vangelis Koukis
<ul></ul><p>The transactions ticket is pending and will be merged, OK, but still, we should make an effort to enforce the constraints as much as possible in the DB itself. Please update the constraints in the ImageMetadata model.</p> Synnefo - Bug #1255: Incomplete constraints in ImageMetadata Modelhttps://code.grnet.gr/issues/1255?journal_id=55342011-10-10T13:30:59+03:00Vangelis Koukis
<ul><li><strong>Target version</strong> changed from <i>67</i> to <i>v0.7</i></li></ul><p>Merged into master, closing ticket.</p> Synnefo - Bug #1255: Incomplete constraints in ImageMetadata Modelhttps://code.grnet.gr/issues/1255?journal_id=55352011-10-10T13:31:07+03:00Vangelis Koukis
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li></ul>