deletedatabase issue

45 views
Skip to first unread message

rupa selvaraj

unread,
Aug 12, 2014, 9:54:23 AM8/12/14
to mobile-c...@googlegroups.com
Is there any specific condition that needs to be met before deleting the database using deletedatabase method ?because we are facing issues in our application . Actually ,we have put progress view till delete action gets over . But its keep on loading , and the delete action never ends .

I have one more query ,it can be a silly question also .. Why I'm not able to call close on cblmanager sharedinstance .I have read in the documentation that , it is applicable for cblmanager instances only .. What's the purpose of closing the cblmanager's copies .. ??


Please help me to understand

Jens Alfke

unread,
Aug 12, 2014, 11:57:51 AM8/12/14
to mobile-c...@googlegroups.com
On Aug 12, 2014, at 6:54 AM, rupa selvaraj <rups...@gmail.com> wrote:

Is there any specific condition that needs to be met before deleting the database using deletedatabase method ?because we are facing issues in our application . Actually ,we have put progress view till delete action gets over . But its keep on loading , and the delete action never ends .

Please always make it clear what platform you're using (iOS, Mac OS, Android, pure Java?) when asking a question.

This definitely sounds like a bug, so please file a bug report in the relevant project on Github.

I have one more query ,it can be a silly question also .. Why I'm not able to call close on cblmanager shared instance .

Because it's a singleton, and singletons shouldn't be disposed of.

I have read in the documentation that , it is applicable for cblmanager instances only .. What's the purpose of closing the cblmanager's copies .. ??

If you need a manager for a temporary purpose, like an activity on a temporary background thread, then you should close it when you're done with it.

—Jens

rupa selvaraj

unread,
Aug 12, 2014, 11:07:36 PM8/12/14
to mobile-c...@googlegroups.com

Sorry about it. Ours is an iOS application.Since we are not able to delete the database, we are actually replacing the database with an empty database on logout. Even after the new data is parsed and saved to database on login,sometimes we could see the old data in the application, but could not find those documents in the database.We are guessing that, still the cblmanager sharedinstance keeping reference to its old database documents.Is there any possibility for that? or do we need to change the approach of replacing the database ? deleting the database requires closing of cblmanager instances?

 
 
Thanks for your help.

Jens Alfke

unread,
Aug 12, 2014, 11:15:30 PM8/12/14
to mobile-c...@googlegroups.com

> On Aug 12, 2014, at 8:07 PM, rupa selvaraj <rups...@gmail.com> wrote:

> Sorry about it. Ours is an iOS application.Since we are not able to delete the database,

The proper thing to do is to figure out and fix the bug. I need you to file a bug report. Please include a backtrace of the thread that's stuck.

> we are actually replacing the database with an empty database on logout.

> Even after the new data is parsed and saved to database on login,sometimes we could see the old data in the application, but could not find those documents in the database.

You're in a weird undefined state due to the bug that's causing deleting the database to hang. I can't help you with this situation; instead, as I said, we need to figure out why deleting the database hangs.

—Jens

rupa selvaraj

unread,
Aug 20, 2014, 3:41:34 AM8/20/14
to mobile-c...@googlegroups.com
Hi,

I have raised a bug in GitHub for that issue.I am using couchbase 1.0 beta3 release.If i dont create a copy of CBLManager at all and try to delete the database ,its working cool.
Similarly if i try to delete the database (database from cblmanager's copy )in the same thread it is created , it is deleting. But if i create a copy,does some update functionality using the database from the manager's copy , then closing the manager once its done, and if try to delete the database (database from sharedinstance ) after switching to main thread , i am getting a warning

WARNING*** : <CBL_Shared: 0xa283d00>: Still waiting to -forgetDatabaseNamed: "couchblite"

code snippet for your reference : (modified the sample HElloCBL project)
- (BOOL) sayHello {
   
    // create a database
    if (![self createDataBase:@"my-new-database"]) return NO;
   
    // create a new document & save it in the database
    if (![self createTheDocument]) return NO;

    // retrieve a document from the database
    if (![self retrieveTheDocument]) return NO;
   
   [NSThread detachNewThreadSelector:@selector(test) toTarget:self withObject:nil];
   
   
    return YES;
   
}

-(void)test{
    CBLManager *manager=[[CBLManager sharedInstance]copy];
    CBLDatabase *database=[manager databaseNamed:@"my-new-database" error:nil];
    [self updateTheDocument:database];
    [database.manager close];
    [self performSelectorOnMainThread:@selector(deleteDatabase) withObject:nil waitUntilDone:YES];
   
}

-(void)deleteDatabase{
    if ([_database deleteDatabase:nil]) {
        NSLog(@"you have done it !!!!");
    }
   
}


I have put so many attempts, all ended in vain.Though i am closing the manager's copy, still why i am not able to delete it ?

Please help me out. Thanks

Reply all
Reply to author
Forward
0 new messages