use of org.apache.ignite.internal.processors.cache.CacheGroupDescriptor in project ignite by apache.
the class IgniteH2Indexing method tablesInformation.
/**
* {@inheritDoc}
*/
@Override
public Collection<TableInformation> tablesInformation(String schemaNamePtrn, String tblNamePtrn, String... tblTypes) {
Set<String> types = F.isEmpty(tblTypes) ? Collections.emptySet() : new HashSet<>(Arrays.asList(tblTypes));
Collection<TableInformation> infos = new ArrayList<>();
boolean allTypes = F.isEmpty(tblTypes);
if (allTypes || types.contains(TableType.TABLE.name())) {
schemaMgr.dataTables().stream().filter(t -> matches(t.getSchema().getName(), schemaNamePtrn)).filter(t -> matches(t.getName(), tblNamePtrn)).map(t -> {
int cacheGrpId = t.cacheInfo().groupId();
CacheGroupDescriptor cacheGrpDesc = ctx.cache().cacheGroupDescriptors().get(cacheGrpId);
// We should skip table in case regarding cache group has been removed.
if (cacheGrpDesc == null)
return null;
GridQueryTypeDescriptor type = t.rowDescriptor().type();
IndexColumn affCol = t.getExplicitAffinityKeyColumn();
String affinityKeyCol = affCol != null ? affCol.columnName : null;
return new TableInformation(t.getSchema().getName(), t.getName(), TableType.TABLE.name(), cacheGrpId, cacheGrpDesc.cacheOrGroupName(), t.cacheId(), t.cacheName(), affinityKeyCol, type.keyFieldAlias(), type.valueFieldAlias(), type.keyTypeName(), type.valueTypeName());
}).filter(Objects::nonNull).forEach(infos::add);
}
if ((allTypes || types.contains(TableType.VIEW.name())) && matches(QueryUtils.SCHEMA_SYS, schemaNamePtrn)) {
schemaMgr.systemViews().stream().filter(t -> matches(t.getTableName(), tblNamePtrn)).map(v -> new TableInformation(QueryUtils.SCHEMA_SYS, v.getTableName(), TableType.VIEW.name())).forEach(infos::add);
}
return infos;
}
use of org.apache.ignite.internal.processors.cache.CacheGroupDescriptor in project ignite by apache.
the class GridCommonAbstractTest method checkCacheDiscoveryDataConsistent.
/**
*/
protected final void checkCacheDiscoveryDataConsistent() {
Map<Integer, CacheGroupDescriptor> cacheGrps = null;
Map<String, DynamicCacheDescriptor> caches = null;
for (Ignite node : G.allGrids()) {
Map<Integer, CacheGroupDescriptor> cacheGrps0 = ((IgniteKernal) node).context().cache().cacheGroupDescriptors();
Map<String, DynamicCacheDescriptor> caches0 = ((IgniteKernal) node).context().cache().cacheDescriptors();
assertNotNull(cacheGrps0);
assertNotNull(caches0);
if (cacheGrps == null) {
cacheGrps = cacheGrps0;
caches = caches0;
} else {
assertEquals(cacheGrps.size(), cacheGrps0.size());
for (Map.Entry<Integer, CacheGroupDescriptor> e : cacheGrps.entrySet()) {
CacheGroupDescriptor desc = e.getValue();
CacheGroupDescriptor desc0 = cacheGrps0.get(e.getKey());
assertNotNull(desc0);
checkGroupDescriptorsData(desc, desc0);
}
for (Map.Entry<String, DynamicCacheDescriptor> e : caches.entrySet()) {
DynamicCacheDescriptor desc = e.getValue();
DynamicCacheDescriptor desc0 = caches.get(e.getKey());
assertNotNull(desc0);
assertEquals(desc.deploymentId(), desc0.deploymentId());
assertEquals(desc.receivedFrom(), desc0.receivedFrom());
assertEquals(desc.startTopologyVersion(), desc0.startTopologyVersion());
assertEquals(desc.cacheConfiguration().getName(), desc0.cacheConfiguration().getName());
assertEquals(desc.cacheConfiguration().getGroupName(), desc0.cacheConfiguration().getGroupName());
checkGroupDescriptorsData(desc.groupDescriptor(), desc0.groupDescriptor());
}
}
}
}
Aggregations