Chen Luo created ASTERIXDB-2329:
-----------------------------------

             Summary: Drop Dataverse Throws Resource Not Exists Exception
                 Key: ASTERIXDB-2329
                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-2329
             Project: Apache AsterixDB
          Issue Type: Bug
          Components: MTD - Metadata
            Reporter: Chen Luo
            Assignee: Murtadha Hubail


Previously I constantly encounter ResourceNotExistException when dropping 
dataverse. After some digging, I found the problem is caused as follows:

1. Start a fresh AsterixDB, and create dataverse/dataset.
{code}
drop dataverse test if exists;
create dataverse test;
use test;
create type testType as{id:int};
create dataset testDS(testType) primary key id;
create primary index primaryIdx on testDS;
{code}

2. Insert a record.
{code}
use test;
insert into testDS{"id":1};
{code}

3. Shutdown AsterixDB.
4. Re-start AsterixDB.
5. Drop and recreate the same dataverse.
{code}
drop dataverse test if exists;
create dataverse test;
use test;
create type testType as{id:int};
create dataset testDS(testType) primary key id;
create primary index primaryIdx on testDS;
{code}

Now we can get an exception:
{code}
org.apache.hyracks.api.exceptions.HyracksDataException: HYR0055: Resource does 
not exist for storage/partition_1/test/testDS/0/testDS
        at 
org.apache.hyracks.api.exceptions.HyracksDataException.create(HyracksDataException.java:55)
 ~[classes/:?]
        at 
org.apache.asterix.transaction.management.resource.PersistentLocalResourceRepository.delete(PersistentLocalResourceRepository.java:210)
 ~[classes/:?]
        at 
org.apache.hyracks.storage.am.common.build.IndexBuilder.build(IndexBuilder.java:78)
 ~[classes/:?]
        at 
org.apache.hyracks.storage.am.common.dataflow.IndexCreateOperatorNodePushable.initialize(IndexCreateOperatorNodePushable.java:52)
 ~[classes/:?]
        at 
org.apache.hyracks.api.rewriter.runtime.SuperActivityOperatorNodePushable.lambda$runInParallel$0(SuperActivityOperatorNodePushable.java:204)
 ~[classes/:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
~[?:1.8.0_121]
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
[?:1.8.0_121]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
[?:1.8.0_121]
        at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
{code}

The root cause seems to be that drop dataverse in step 5 is not executed 
properly. It suppose to drop all datasets, all indexes associated with the 
dataverse. However, line 1253 of QueryTranslator returns empty index list 
(MetadataManager.getDatasetIndexes returns at line 292 because the dataset does 
not exist in cache), which causes indexes are not dropped properly.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to