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.
Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
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

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
=== modified file 'oopsrepository/oopses.py'
--- oopsrepository/oopses.py 2012-12-17 09:27:35 +0000
+++ oopsrepository/oopses.py 2013-02-07 18:43:22 +0000
@@ -187,6 +187,15 @@
187 retry_counter_mutations=True)187 retry_counter_mutations=True)
188 bucketversions_cf.add(bucketid, version)188 bucketversions_cf.add(bucketid, version)
189189
190def query_bucket_versions(config, bucketid):
191 pool = connection_pool(config)
192 bucketversions_cf = pycassa.ColumnFamily(pool, 'BucketVersions')
193 try:
194 bucket_versions = bucketversions_cf.get(bucketid, column_count=20)
195 except NotFoundException:
196 bucket_versions = None
197 return bucket_versions
198
190def update_bucket_metadata(config, bucketid, source, version, comparator, release=''):199def update_bucket_metadata(config, bucketid, source, version, comparator, release=''):
191 # We only update the first and last seen version fields. We do not update200 # We only update the first and last seen version fields. We do not update
192 # the current version field as talking to Launchpad is an expensive201 # the current version field as talking to Launchpad is an expensive
@@ -219,3 +228,8 @@
219 if metadata:228 if metadata:
220 metadata['Source'] = source229 metadata['Source'] = source
221 bucketmetadata_cf.insert(bucketid, metadata)230 bucketmetadata_cf.insert(bucketid, metadata)
231
232def update_bucket_systems(config, bucket, system):
233 pool = connection_pool(config)
234 bucketsystems_cf = pycassa.ColumnFamily(pool, 'BucketSystems')
235 bucketsystems_cf.insert(bucket, {system: ''})
222236
=== modified file 'oopsrepository/schema.py'
--- oopsrepository/schema.py 2012-12-03 18:04:54 +0000
+++ oopsrepository/schema.py 2013-02-07 18:43:22 +0000
@@ -73,6 +73,10 @@
73 workaround_1779(mgr.create_column_family, keyspace, 'BucketVersions',73 workaround_1779(mgr.create_column_family, keyspace, 'BucketVersions',
74 comparator_type=UTF8_TYPE,74 comparator_type=UTF8_TYPE,
75 default_validation_class=CounterColumnType())75 default_validation_class=CounterColumnType())
76 if 'BucketSystems' not in cfs:
77 workaround_1779(mgr.create_column_family, keyspace, 'BucketSystems',
78 comparator_type=UTF8_TYPE,
79 default_validation_class=UTF8_TYPE)
76 if 'Counters' not in cfs:80 if 'Counters' not in cfs:
77 workaround_1779(mgr.create_column_family, keyspace, 'Counters',81 workaround_1779(mgr.create_column_family, keyspace, 'Counters',
78 comparator_type=UTF8_TYPE,82 comparator_type=UTF8_TYPE,

Subscribers

People subscribed via source and target branches

to all changes: