~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/cloud_ms.cc

  • Committer: Brian Aker
  • Date: 2010-10-15 05:30:39 UTC
  • mfrom: (1843.8.7 trunk-drizzle)
  • Revision ID: brian@tangent.org-20101015053039-ebmv3hnn1yaq4wqy
Merge in refactoring on table (broken it up by type, this will allow me to
insert the new locking).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2009 PrimeBase Technologies GmbH, Germany
 
1
/* Copyright (c) 2009 PrimeBase Technologies GmbH, Germany
2
2
 *
3
3
 * PrimeBase Media Stream for MySQL
4
4
 *
21
21
 */
22
22
 
23
23
#ifdef DRIZZLED
24
 
#include <config.h>
 
24
#include "config.h"
25
25
#include <drizzled/common.h>
26
26
#include <drizzled/session.h>
27
27
#include <drizzled/table.h>
28
28
#include <drizzled/message/table.pb.h>
29
 
#include <drizzled/charset_info.h>
 
29
#include "drizzled/charset_info.h"
30
30
#include <drizzled/table_proto.h>
31
31
#include <drizzled/session.h>
32
32
#include <drizzled/field.h>
269
269
        release_(src_objectKey);
270
270
        push_(list);
271
271
        
272
 
        
273
272
        // Go through the list copying the keys.
274
 
        dst_cloudRef = src_cloudRef;
275
 
        dst_cloud = src_cloud;
276
 
        dst_cloud->retain();
 
273
        try_(a) {
 
274
                dst_cloudRef = src_cloudRef;
 
275
                dst_cloud = src_cloud;
 
276
                dst_cloud->retain();
277
277
        
278
 
        push_ref_(dst_cloud); // Push a reference to dst_cloud so that what ever it references will be released.
279
 
 
280
 
        while ((key = (CSString*)(list->take(0))) ) {
281
 
                push_(key);
282
 
 
283
 
                // The source key name must be parsed to get its
284
 
                // destination cloud reference. The destination for
285
 
                // the BLOBs may not all be in the same cloud. 
286
 
                CloudObjectKey::parseObjectKey(key->getCString(), &cloudKey);
287
 
                
288
 
                // Reset the destination cloud if required.
289
 
                if (cloudKey.cloud_ref != dst_cloudRef) {
290
 
                        if (dst_cloud) {
291
 
                                dst_cloud->release();
292
 
                                dst_cloud = NULL;
 
278
                while ((key = (CSString*)(list->take(0))) ) {
 
279
                        push_(key);
 
280
 
 
281
                        // The source key name must be parsed to get its
 
282
                        // destination cloud reference. The destination for
 
283
                        // the BLOBs may not all be in the same cloud. 
 
284
                        CloudObjectKey::parseObjectKey(key->getCString(), &cloudKey);
 
285
                        
 
286
                        // Reset the destination cloud if required.
 
287
                        if (cloudKey.cloud_ref != dst_cloudRef) {
 
288
                                if (dst_cloud) {
 
289
                                        dst_cloud->release();
 
290
                                        dst_cloud = NULL;
 
291
                                }
 
292
                                dst_cloudRef =  cloudKey.cloud_ref;
 
293
                                dst_cloud = MSCloudInfo::getCloudInfo(dst_cloudRef);
293
294
                        }
294
 
                        dst_cloudRef =  cloudKey.cloud_ref;
295
 
                        dst_cloud = MSCloudInfo::getCloudInfo(dst_cloudRef);
 
295
 
 
296
                        // Copy the BLOB to the recovered database.
 
297
                        dst_objectKey->setObjectKey(&cloudKey);
 
298
                        src_cloud->copy(RETAIN(dst_cloud), dst_objectKey->getCString(), key->getCString());
 
299
                        release_(key);
 
300
                        
296
301
                }
297
 
 
298
 
                // Copy the BLOB to the recovered database.
299
 
                dst_objectKey->setObjectKey(&cloudKey);
300
 
                src_cloud->copy(RETAIN(dst_cloud), dst_objectKey->getCString(), key->getCString());
301
 
                release_(key);
302
 
                
303
302
        }
304
303
        
305
 
        release_(dst_cloud);
 
304
        finally_(a) {
 
305
                if (dst_cloud)
 
306
                        dst_cloud->release();
 
307
        }
 
308
        finally_end_block(a);
306
309
        
307
310
        blob_recovery_no = 0;
308
311
        release_(list);