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

Proposed by Brian Murray
Status: Merged
Merged at revision: 60
Proposed branch: lp:~brian-murray/oops-repository/bucketsystems
Merge into: lp:~ev/oops-repository/whoopsie-daisy
Diff against target: 43 lines (+18/-0)
2 files modified
oopsrepository/oopses.py (+14/-0)
oopsrepository/schema.py (+4/-0)
To merge this branch: bzr merge lp:~brian-murray/oops-repository/bucketsystems
Reviewer Review Type Date Requested Status
Evan Pending
Review via email: mp+147198@code.launchpad.net

Description of the change

Per our earlier discussion this adds bucketsystems to the schema, provides a method for adding systems to a bucket, and a way to query bucket versions.

To post a comment you must log in.
Brian Murray (brian-murray) wrote :

One thing I'm uncertain of is limiting the column_count to 20. I sent you an email regarding the querying I did of the bucketversions column family and it seems that the first version appears in the first 9 columns more than 90% of the time an within the first 20 100% of the time.

Evan (ev) wrote :

On Thu, Feb 7, 2013 at 6:11 PM, Brian Murray <email address hidden> wrote:
> +def update_bucket_systems(config, bucket, system):
> + pool = connection_pool(config)
> + bucketsystems_cf = pycassa.ColumnFamily(pool, 'BucketSystems')
> + try:
> + systems = bucketsystems_cf.get(bucket)
> + if system not in systems:
> + bucketsystems_cf.insert(bucket, {system: ''})
> + except NotFoundException:
> + bucketsystems_cf.insert(bucket, {system: ''})

Shouldn't this just be bucketsystems_cf.insert() without the try block
or get() method? If there are already columns in bucketsystems_cf,
calling insert() will just update the column with that system
identifier.

Brian Murray (brian-murray) wrote :

On Thu, Feb 07, 2013 at 06:22:23PM -0000, Evan Dandrea wrote:
> On Thu, Feb 7, 2013 at 6:11 PM, Brian Murray <email address hidden> wrote:
> > +def update_bucket_systems(config, bucket, system):
> > + pool = connection_pool(config)
> > + bucketsystems_cf = pycassa.ColumnFamily(pool, 'BucketSystems')
> > + try:
> > + systems = bucketsystems_cf.get(bucket)
> > + if system not in systems:
> > + bucketsystems_cf.insert(bucket, {system: ''})
> > + except NotFoundException:
> > + bucketsystems_cf.insert(bucket, {system: ''})
>
> Shouldn't this just be bucketsystems_cf.insert() without the try block
> or get() method? If there are already columns in bucketsystems_cf,
> calling insert() will just update the column with that system
> identifier.

Ah, I hadn't thought about that. I'll go ahead and test that then,
thanks.

--
Brian Murray

57. By Brian Murray on 2013-02-07

just use an insert in update_bucket_systems

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 2012-12-17 09:27:35 +0000
3+++ oopsrepository/oopses.py 2013-02-07 18:43:22 +0000
4@@ -187,6 +187,15 @@
5 retry_counter_mutations=True)
6 bucketversions_cf.add(bucketid, version)
7
8+def query_bucket_versions(config, bucketid):
9+ pool = connection_pool(config)
10+ bucketversions_cf = pycassa.ColumnFamily(pool, 'BucketVersions')
11+ try:
12+ bucket_versions = bucketversions_cf.get(bucketid, column_count=20)
13+ except NotFoundException:
14+ bucket_versions = None
15+ return bucket_versions
16+
17 def update_bucket_metadata(config, bucketid, source, version, comparator, release=''):
18 # We only update the first and last seen version fields. We do not update
19 # the current version field as talking to Launchpad is an expensive
20@@ -219,3 +228,8 @@
21 if metadata:
22 metadata['Source'] = source
23 bucketmetadata_cf.insert(bucketid, metadata)
24+
25+def update_bucket_systems(config, bucket, system):
26+ pool = connection_pool(config)
27+ bucketsystems_cf = pycassa.ColumnFamily(pool, 'BucketSystems')
28+ bucketsystems_cf.insert(bucket, {system: ''})
29
30=== modified file 'oopsrepository/schema.py'
31--- oopsrepository/schema.py 2012-12-03 18:04:54 +0000
32+++ oopsrepository/schema.py 2013-02-07 18:43:22 +0000
33@@ -73,6 +73,10 @@
34 workaround_1779(mgr.create_column_family, keyspace, 'BucketVersions',
35 comparator_type=UTF8_TYPE,
36 default_validation_class=CounterColumnType())
37+ if 'BucketSystems' not in cfs:
38+ workaround_1779(mgr.create_column_family, keyspace, 'BucketSystems',
39+ comparator_type=UTF8_TYPE,
40+ default_validation_class=UTF8_TYPE)
41 if 'Counters' not in cfs:
42 workaround_1779(mgr.create_column_family, keyspace, 'Counters',
43 comparator_type=UTF8_TYPE,

Subscribers

People subscribed via source and target branches

to all changes: