ceilometer db2 need to insert random strings to prevent multi-thread running case in db upgrade

Bug #1427997 reported by Kai Qiang Wu(Kennan)
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
Medium
Kai Qiang Wu(Kennan)

Bug Description

In simple single run, dbsync it would not have issue for that

if used configured tools, like chef, the recipe have signal mechnism, so it can have multi-thread hit the same path

/usr/lib/python2.6/site-packages/ceilometer/storage/impl_db2.py

def upgrade(self, version=None)

  ..

like ceilometer-api process run, and also dbsync run.

In order to better support, we initial table with random strings to prevent such case to happen

in db2, we can check logs as :

   com.ibm.nosql.db2wire.server.DB2CollectionHelper Error: An exception has been thrown: com.ibm.nosql.json.api.DBException : [nosql][1.3.44] Unable to perform the update: [nosql][1.3.44] One or more values in the INSERT statement, UPDATE statement, or foreign key update caused by a DELETE statement are not valid because the primary key, unique constraint or unique index identified by "1" constrains table "CEILODB2.resource" from having duplicate values for the index key.. SQLCODE=-803, SQLSTATE=23505, DRIVER=3.67.27;

in nosql logs find

[nosql][2015-03-03-18:40:03.252][NoSQLTCPThreads : 0][DBCollection@de69398d][insert] ENTRY {"_id":"xxxxxxxx....

[nosql][2015-03-03-18:40:03.254][NoSQLTCPThreads : 1][DBCollection@de69398d][insert] ENTRY {"_id":"xxxx...

Changed in ceilometer:
assignee: nobody → Kai Qiang Wu(Kennan) (wkqwu)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ceilometer (master)

Fix proposed to branch: master
Review: https://review.openstack.org/161126

Changed in ceilometer:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (master)

Reviewed: https://review.openstack.org/161126
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=45bb98531ba4ef757c50a080652c81bc21e3d9dd
Submitter: Jenkins
Branch: master

commit 45bb98531ba4ef757c50a080652c81bc21e3d9dd
Author: Kennan <email address hidden>
Date: Wed Mar 4 16:20:23 2015 +0800

    Fix db2 upgrade in multi-thread run issue

    In multi-thread run cases(like chef recipes run), it would hit insert same
    record issue, this fix make sure insert different data in db, thus not hit
    duplicated insert issue, it is mainly improve in multi-thread cases run.

    Change-Id: I1690dc5863cbd2b213d241477e23e82d295856fe
    Closes-Bug: #1427997

Changed in ceilometer:
status: In Progress → Fix Committed
Changed in ceilometer:
importance: Undecided → Medium
Changed in ceilometer:
milestone: none → kilo-rc1
Eoghan Glynn (eglynn)
Changed in ceilometer:
milestone: kilo-rc1 → kilo-3
Thierry Carrez (ttx)
Changed in ceilometer:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: kilo-3 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.