Merge lp:~brian-murray/oops-repository/bucketversion into lp:~ev/oops-repository/whoopsie-daisy

Proposed by Brian Murray
Status: Needs review
Proposed branch: lp:~brian-murray/oops-repository/bucketversion
Merge into: lp:~ev/oops-repository/whoopsie-daisy
Diff against target: 46 lines (+17/-0)
3 files modified
oopsrepository/oopses.py (+4/-0)
oopsrepository/schema.py (+4/-0)
oopsrepository/tests/test_oopses.py (+9/-0)
To merge this branch: bzr merge lp:~brian-murray/oops-repository/bucketversion
Reviewer Review Type Date Requested Status
Evan Needs Information
Review via email: mp+149180@code.launchpad.net

Description of the change

This adds the bucketversion cf which uses the custom comparator.

To post a comment you must log in.
Evan (ev) wrote :

Would this still work for your needs if it was a composite type of (DpkgVersionComparator, UTF8) where the latter part of the tuple represents the Ubuntu release that version is responsible for? The ordering matters here, as we want to sort on the dpkg version primarily.

Getting the first version this issue was ever seen in would still be:
bucketversions_cf.get(column_count=1) -> ('1.0-0ubuntu1', 'Ubuntu 12.04')

Getting the total count of instances for the first version this issue was ever seen in, regardless of release, would require two operations as far as I can tell [1]:
bucketversions_cf.get(column_count=1) -> ('1.0-0ubuntu1', 'Ubuntu 12.04')
bucketversions_cf.get_range(column_start='1.0-0ubuntu1', column_finish='1.0-0ubuntu2~')

But if we grabbed the entire row, we could build an accurate table of "package versions with this error", as described in the specification:
https://wiki.ubuntu.com/ErrorTracker#Bucket_page

And mentioned in the following bug report:
https://bugs.launchpad.net/errors/+bug/1078801

Alternatively we could have another column family responsible for this finer granularity.

1: http://mail-archives.apache.org/mod_mbox/cassandra-user/201208.mbox/%<email address hidden>%3E

review: Needs Information

Unmerged revisions

58. By Brian Murray on 2013-02-18

add and use bucketversion cf which uses a dpkgversiontype custom comparator

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'oopsrepository/oopses.py'
2--- oopsrepository/oopses.py 2013-02-08 10:05:08 +0000
3+++ oopsrepository/oopses.py 2013-02-18 23:36:21 +0000
4@@ -188,6 +188,10 @@
5 bucketversions_cf = pycassa.ColumnFamily(pool, 'BucketVersions',
6 retry_counter_mutations=True)
7 bucketversions_cf.add(bucketid, version)
8+ # use BucketVersion which has the custom comparator
9+ bucketversion_cf = pycassa.ColumnFamily(pool, 'BucketVersion',
10+ retry_counter_mutations=True)
11+ bucketversion_cf.add(bucketid, version)
12
13 def update_bucket_metadata(config, bucketid, source, version, comparator, release=''):
14 # We only update the first and last seen version fields. We do not update
15
16=== modified file 'oopsrepository/schema.py'
17--- oopsrepository/schema.py 2013-02-12 15:36:48 +0000
18+++ oopsrepository/schema.py 2013-02-18 23:36:21 +0000
19@@ -74,6 +74,10 @@
20 workaround_1779(mgr.create_column_family, keyspace, 'BucketVersions',
21 comparator_type=UTF8_TYPE,
22 default_validation_class=CounterColumnType())
23+ if 'BucketVersion' not in cfs:
24+ workaround_1779(mgr.create_column_family, keyspace, 'BucketVersion',
25+ comparator_type='com.canonical.dpkgversiontype.DpkgVersionType',
26+ default_validation_class=CounterColumnType())
27 if 'Counters' not in cfs:
28 workaround_1779(mgr.create_column_family, keyspace, 'Counters',
29 comparator_type=UTF8_TYPE,
30
31=== modified file 'oopsrepository/tests/test_oopses.py'
32--- oopsrepository/tests/test_oopses.py 2012-09-26 13:34:08 +0000
33+++ oopsrepository/tests/test_oopses.py 2013-02-18 23:36:21 +0000
34@@ -212,3 +212,12 @@
35 bucketversions_cf = pycassa.ColumnFamily(pool, 'BucketVersions')
36 oopses.update_bucket_versions(config, 'bucket-id', '1.2.3')
37 self.assertEqual(bucketversions_cf.get('bucket-id')['1.2.3'], 1)
38+
39+ def test_update_bucket_version(self):
40+ keyspace = self.useFixture(TemporaryOOPSDB()).keyspace
41+ config = dict(keyspace=keyspace, host=['localhost:9160'],
42+ username='', password='')
43+ pool = pycassa.ConnectionPool(keyspace, ['localhost:9160'])
44+ bucketversion_cf = pycassa.ColumnFamily(pool, 'BucketVersion')
45+ oopses.update_bucket_versions(config, 'bucket-id', '1.2.3')
46+ self.assertEqual(bucketversion_cf.get('bucket-id')['1.2.3'], 1)

Subscribers

People subscribed via source and target branches

to all changes: