use of org.apache.ignite.internal.processors.metastorage.DistributedMetaStorage in project ignite by apache.
the class GridMetricManager method remove.
/**
* Removes metric registry.
*
* @param regName Metric registry name.
* @param removeCfg {@code True} if remove metric configurations.
*/
public void remove(String regName, boolean removeCfg) {
GridCompoundFuture opsFut = new GridCompoundFuture<>();
registries.computeIfPresent(regName, (key, mreg) -> {
notifyListeners(mreg, metricRegRemoveLsnrs, log);
if (!removeCfg)
return null;
DistributedMetaStorage metastorage0 = metastorage;
if (metastorage0 == null)
return null;
try {
for (Metric m : mreg) {
if (m instanceof HitRateMetric)
opsFut.add(metastorage0.removeAsync(metricName(HITRATE_CFG_PREFIX, m.name())));
else if (m instanceof HistogramMetric)
opsFut.add(metastorage0.removeAsync(metricName(HISTOGRAM_CFG_PREFIX, m.name())));
}
} catch (IgniteCheckedException e) {
throw new IgniteException(e);
}
return null;
});
try {
opsFut.markInitialized();
opsFut.get();
} catch (NodeStoppingException ignored) {
// No-op.
} catch (IgniteCheckedException e) {
log.error("Failed to remove metrics configuration.", e);
}
}
use of org.apache.ignite.internal.processors.metastorage.DistributedMetaStorage in project ignite by apache.
the class SystemViewCommandTest method testDistributedMetastorage.
/**
*/
@Test
public void testDistributedMetastorage() throws Exception {
DistributedMetaStorage dms = ignite0.context().distributedMetastorage();
String name = "test-distributed-key";
String val = "test-distributed-value";
dms.write(name, val);
assertEquals(1, systemView(ignite0, DISTRIBUTED_METASTORE_VIEW).stream().filter(row -> name.equals(row.get(0)) && val.equals(row.get(1))).count());
assertTrue(waitForCondition(() -> systemView(ignite1, DISTRIBUTED_METASTORE_VIEW).stream().filter(row -> name.equals(row.get(0)) && val.equals(row.get(1))).count() == 1, getTestTimeout()));
}
use of org.apache.ignite.internal.processors.metastorage.DistributedMetaStorage in project ignite by apache.
the class SqlViewExporterSpiTest method testDistributedMetastorage.
/**
*/
@Test
public void testDistributedMetastorage() throws Exception {
DistributedMetaStorage dms = ignite0.context().distributedMetastorage();
SystemView<MetastorageView> distributedMetaStoreView = ignite0.context().systemView().view(DISTRIBUTED_METASTORE_VIEW);
assertNotNull(distributedMetaStoreView);
String name = "test-distributed-key";
String val = "test-distributed-value";
dms.write(name, val);
assertEquals(1, execute(ignite0, "SELECT * FROM SYS.DISTRIBUTED_METASTORAGE WHERE name = ? AND value = ?", name, val).size());
assertTrue(waitForCondition(() -> execute(ignite1, "SELECT * FROM SYS.DISTRIBUTED_METASTORAGE WHERE name = ? AND value = ?", name, val).size() == 1, getTestTimeout()));
}
Aggregations