use of org.apache.asterix.metadata.entities.Dataverse in project asterixdb by apache.
the class TestNodeController method createPrimaryIndex.
public void createPrimaryIndex(Dataset dataset, IAType[] primaryKeyTypes, ARecordType recordType, ARecordType metaType, ILSMMergePolicyFactory mergePolicyFactory, Map<String, String> mergePolicyProperties, int[] filterFields, IStorageComponentProvider storageComponentProvider, int[] primaryKeyIndexes, List<Integer> primaryKeyIndicators) throws AlgebricksException, HyracksDataException {
PrimaryIndexInfo primaryIndexInfo = new PrimaryIndexInfo(dataset, primaryKeyTypes, recordType, metaType, mergePolicyFactory, mergePolicyProperties, filterFields, primaryKeyIndexes, primaryKeyIndicators, storageComponentProvider);
Dataverse dataverse = new Dataverse(dataset.getDataverseName(), NonTaggedDataFormat.class.getName(), MetadataUtil.PENDING_NO_OP);
MetadataProvider mdProvider = new MetadataProvider((ICcApplicationContext) ExecutionTestUtil.integrationUtil.cc.getApplicationContext(), dataverse, storageComponentProvider);
try {
IResourceFactory resourceFactory = dataset.getResourceFactory(mdProvider, primaryIndexInfo.index, recordType, metaType, mergePolicyFactory, mergePolicyProperties);
IndexBuilderFactory indexBuilderFactory = new IndexBuilderFactory(storageComponentProvider.getStorageManager(), primaryIndexInfo.fileSplitProvider, resourceFactory, !dataset.isTemp());
IHyracksTaskContext ctx = createTestContext(false);
IIndexBuilder indexBuilder = indexBuilderFactory.create(ctx, 0);
indexBuilder.build();
} finally {
mdProvider.getLocks().unlock();
}
}
use of org.apache.asterix.metadata.entities.Dataverse in project asterixdb by apache.
the class TestNodeController method getPrimaryResourceFactory.
public IResourceFactory getPrimaryResourceFactory(IHyracksTaskContext ctx, PrimaryIndexInfo primaryIndexInfo, IStorageComponentProvider storageComponentProvider, Dataset dataset) throws AlgebricksException {
Dataverse dataverse = new Dataverse(dataset.getDataverseName(), NonTaggedDataFormat.class.getName(), MetadataUtil.PENDING_NO_OP);
Index index = primaryIndexInfo.getIndex();
CcApplicationContext appCtx = (CcApplicationContext) ExecutionTestUtil.integrationUtil.cc.getApplicationContext();
MetadataProvider mdProvider = new MetadataProvider(appCtx, dataverse, storageComponentProvider);
try {
return dataset.getResourceFactory(mdProvider, index, primaryIndexInfo.recordType, primaryIndexInfo.metaType, primaryIndexInfo.mergePolicyFactory, primaryIndexInfo.mergePolicyProperties);
} finally {
mdProvider.getLocks().unlock();
}
}
use of org.apache.asterix.metadata.entities.Dataverse in project asterixdb by apache.
the class MetadataManager method getDataverse.
@Override
public Dataverse getDataverse(MetadataTransactionContext ctx, String dataverseName) throws MetadataException {
// First look in the context to see if this transaction created the
// requested dataverse itself (but the dataverse is still uncommitted).
Dataverse dataverse = ctx.getDataverse(dataverseName);
if (dataverse != null) {
// uncommitted.
return dataverse;
}
if (ctx.dataverseIsDropped(dataverseName)) {
// in the cache.
return null;
}
dataverse = cache.getDataverse(dataverseName);
if (dataverse != null) {
// Dataverse is already in the cache, don't add it again.
return dataverse;
}
try {
dataverse = metadataNode.getDataverse(ctx.getJobId(), dataverseName);
} catch (RemoteException e) {
throw new MetadataException(e);
}
// when this transaction commits.
if (dataverse != null) {
ctx.addDataverse(dataverse);
}
return dataverse;
}
use of org.apache.asterix.metadata.entities.Dataverse in project asterixdb by apache.
the class MetadataNode method getDataverse.
@Override
public Dataverse getDataverse(JobId jobId, String dataverseName) throws MetadataException, RemoteException {
try {
ITupleReference searchKey = createTuple(dataverseName);
DataverseTupleTranslator tupleReaderWriter = tupleTranslatorProvider.getDataverseTupleTranslator(false);
IValueExtractor<Dataverse> valueExtractor = new MetadataEntityValueExtractor<>(tupleReaderWriter);
List<Dataverse> results = new ArrayList<>();
searchIndex(jobId, MetadataPrimaryIndexes.DATAVERSE_DATASET, searchKey, valueExtractor, results);
if (results.isEmpty()) {
return null;
}
return results.get(0);
} catch (HyracksDataException e) {
throw new MetadataException(e);
}
}
use of org.apache.asterix.metadata.entities.Dataverse in project asterixdb by apache.
the class MetadataBootstrap method insertInitialDataverses.
private static void insertInitialDataverses(MetadataTransactionContext mdTxnCtx) throws MetadataException {
String dataFormat = NonTaggedDataFormat.NON_TAGGED_DATA_FORMAT;
MetadataManager.INSTANCE.addDataverse(mdTxnCtx, new Dataverse(MetadataConstants.METADATA_DATAVERSE_NAME, dataFormat, MetadataUtil.PENDING_NO_OP));
MetadataManager.INSTANCE.addDataverse(mdTxnCtx, MetadataBuiltinEntities.DEFAULT_DATAVERSE);
}
Aggregations