Merge lp:~ev/oops-repository/bucket-version-systems-test into lp:~daisy-pluckers/oops-repository/trunk

Proposed by Evan
Status: Merged
Approved by: Evan
Approved revision: 81
Merged at revision: 80
Proposed branch: lp:~ev/oops-repository/bucket-version-systems-test
Merge into: lp:~daisy-pluckers/oops-repository/trunk
Diff against target: 51 lines (+16/-4)
3 files modified
oopsrepository/oopses.py (+1/-1)
oopsrepository/schema.py (+3/-3)
oopsrepository/tests/test_oopses.py (+12/-0)
To merge this branch: bzr merge lp:~ev/oops-repository/bucket-version-systems-test
Reviewer Review Type Date Requested Status
Brian Murray Approve
Review via email: mp+168969@code.launchpad.net

Commit message

Fix the BucketVersionSystems CF and rename it to BucketVersionSystems2.

Description of the change

We set the comparator_type incorrectly with the previous cut of BucketVersionSystems. As we had set it to the same composite type used for the row key (UTF8, ASCII), pycassa was treating the value we were inserting into the column name (the system uuid) as an iterable, and thus giving us data like a:3 (where a3 might be the first two characters of a sha512 hashed system UUID).

To post a comment you must log in.
Revision history for this message
Brian Murray (brian-murray) wrote :

This looks good to me sorry about the mistake with the comparator_type.

review: Approve
Revision history for this message
Evan (ev) wrote :

No worries. It surfaced problems in our review process. :)

Revision history for this message
Evan (ev) wrote :

yay, it works

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-06-11 16:24:25 +0000
3+++ oopsrepository/oopses.py 2013-06-12 14:53:30 +0000
4@@ -310,7 +310,7 @@
5 # If all we had were unicode characters.
6 return
7 pool = connection_pool(config)
8- bucketsystems_cf = pycassa.ColumnFamily(pool, 'BucketVersionSystems')
9+ bucketsystems_cf = pycassa.ColumnFamily(pool, 'BucketVersionSystems2')
10 bucketsystems_cf.insert((bucketid, version), {system: ''})
11
12 def update_source_version_buckets(config, source, version, bucketid):
13
14=== modified file 'oopsrepository/schema.py'
15--- oopsrepository/schema.py 2013-06-10 16:20:23 +0000
16+++ oopsrepository/schema.py 2013-06-12 14:53:30 +0000
17@@ -96,11 +96,11 @@
18 workaround_1779(mgr.create_column_family, keyspace, 'BucketSystems',
19 key_validation_class=UTF8_TYPE,
20 comparator_type=ASCII_TYPE)
21- if 'BucketVersionSystems' not in cfs:
22+ if 'BucketVersionSystems2' not in cfs:
23 composite = CompositeType(UTF8Type(), AsciiType())
24 workaround_1779(mgr.create_column_family, keyspace,
25- 'BucketVersionSystems', key_validation_class=composite,
26- comparator_type=composite)
27+ 'BucketVersionSystems2', key_validation_class=composite,
28+ comparator_type=AsciiType())
29 if 'Counters' not in cfs:
30 workaround_1779(mgr.create_column_family, keyspace, 'Counters',
31 comparator_type=UTF8_TYPE,
32
33=== modified file 'oopsrepository/tests/test_oopses.py'
34--- oopsrepository/tests/test_oopses.py 2013-06-12 12:38:16 +0000
35+++ oopsrepository/tests/test_oopses.py 2013-06-12 14:53:30 +0000
36@@ -266,3 +266,15 @@
37
38 bucket_id = srcversbuckets.get((src_package, version)).keys()[0]
39 self.assertEqual(oops_id, bucket_id)
40+
41+ def test_update_bucket_systems(self):
42+ keyspace = self.useFixture(TemporaryOOPSDB()).keyspace
43+ bv_systems = pycassa.ColumnFamily(self.pool, 'BucketVersionSystems2')
44+ bucketid = 'foo'
45+ system_token = 'system-id'
46+ version = '1.0'
47+ oopses.update_bucket_systems(self.config, bucketid, system_token,
48+ version=version)
49+
50+ system = bv_systems.get((bucketid, version)).keys()[0]
51+ self.assertEqual(system, system_token)

Subscribers

People subscribed via source and target branches

to all changes: