asterixdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Young-Seok Kim (JIRA)" <j...@apache.org>
Subject [jira] [Created] (ASTERIXDB-1088) handleCompactStatement() in AqlTranslator.java has a bug
Date Sat, 12 Sep 2015 00:22:45 GMT
Young-Seok Kim created ASTERIXDB-1088:
-----------------------------------------

             Summary: handleCompactStatement() in AqlTranslator.java has a bug
                 Key: ASTERIXDB-1088
                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1088
             Project: Apache AsterixDB
          Issue Type: Bug
          Components: AsterixDB
            Reporter: Young-Seok Kim


The following code in handleCompactStatement() in AqlTranslator.java 
(https://github.com/apache/incubator-asterixdb/blob/master/asterix-app/src/main/java/org/apache/asterix/aql/translator/AqlTranslator.java)
1) doesn't compact secondary indexes if any
2) instead compact primary index as many as the number of secondary indexes. 

from line 2421.
            if (ds.getDatasetType() == DatasetType.INTERNAL) {
                for (int j = 0; j < indexes.size(); j++) {
                    if (indexes.get(j).isSecondaryIndex()) {
                        CompiledIndexCompactStatement cics = new CompiledIndexCompactStatement(dataverseName,
                                datasetName, indexes.get(j).getIndexName(), indexes.get(j).getKeyFieldNames(),
indexes
                                        .get(j).getKeyFieldTypes(), indexes.get(j).isEnforcingKeyFileds(),
indexes.get(
                                        j).getGramLength(), indexes.get(j).getIndexType());

                        Dataverse dataverse = MetadataManager.INSTANCE.getDataverse(
                                metadataProvider.getMetadataTxnContext(), dataverseName);
                        jobsToExecute.add(DatasetOperations.compactDatasetJobSpec(dataverse,
datasetName,
                                metadataProvider));

                    }
                }

The code should fixed something as follows:
            if (ds.getDatasetType() == DatasetType.INTERNAL) {
                for (int j = 0; j < indexes.size(); j++) {
                    if (indexes.get(j).isSecondaryIndex()) {
                		
                        CompiledIndexCompactStatement cics = new CompiledIndexCompactStatement(dataverseName,
                                datasetName, indexes.get(j).getIndexName(), indexes.get(j).getKeyFieldNames(),

                                indexes.get(j).getKeyFieldTypes(), indexes.get(j).getIndexType(),
null,
                                indexes.get(j).isEnforcingKeyFileds());
                        jobsToExecute.add(IndexOperations.buildSecondaryIndexCompactJobSpec(cics,
metadataProvider, ds));
                    }
                }
                Dataverse dataverse = MetadataManager.INSTANCE.getDataverse(
                        metadataProvider.getMetadataTxnContext(), dataverseName);
                jobsToExecute.add(DatasetOperations.compactDatasetJobSpec(dataverse, datasetName,
                        metadataProvider));



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message