[
https://issues.apache.org/jira/browse/IGNITE-15721?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alexander Lapin updated IGNITE-15721:
-------------------------------------
Description:
h3. Problem
There are use cases that suppose retrieving configuration entities by id. For
example retrieving table by id. The only option now is to get all tables with
further iteration that will check whether a table id matches expected one.
Things get worse if it's required to get table by id from remote node, e.g.
{code:java}
private boolean isTableConfigured(IgniteUuid id) {
NamedListView<TableView> directTablesCfg =
((DirectConfigurationProperty<NamedListView<TableView>>)tablesCfg.tables()).directValue();
// TODO: IGNITE-15721 Need to review this approach after the ticket
would be fixed.
// Probably, it won't be required getting configuration of all tables
from Metastor.
for (String name : directTablesCfg.namedListKeys()) {
ExtendedTableView tView =
(ExtendedTableView)directTablesCfg.get(name);
if (tView != null && id.equals(IgniteUuid.fromString(tView.id())))
return true;
}
return false;
}
{code}
It worth to mention that sometimes, for example in use case mentioned above,
exact data aren't needed, cause only fact of data absence is important. In
other words It'll be great not only to have ability to retrieve tables,
columns, indexes and other named list items by id (in addition to retriever by
name) but also check whether required entity exists or not. Both local and
direct use cases are important.
was:
h3. Problem
There are use cases that suppose retrieving configuration entities by id. For
example retrieving table by id. The only option now is to get all tables with
further iteration that will check whether a table id matches expected one.
Things get worse if it's required to get table by id from remote node, e.g.
{code:java}
private boolean isTableConfigured(IgniteUuid id) {
NamedListView<TableView> directTablesCfg =
((DirectConfigurationProperty<NamedListView<TableView>>)tablesCfg.tables()).directValue();
// TODO: IGNITE-15721 Need to review this approach after the ticket
would be fixed.
// Probably, it won't be required getting configuration of all tables
from Metastor.
for (String name : directTablesCfg.namedListKeys()) {
ExtendedTableView tView =
(ExtendedTableView)directTablesCfg.get(name);
if (tView != null && id.equals(IgniteUuid.fromString(tView.id())))
return true;
}
return false;
}
{code}
It worth to mention that sometimes, for example in use case mentioned above,
exact data aren't needed, cause only fact of data absence is important. In
other words It'll be great not only to have ability to retrieve tables,
columns, indexes and other named list items by id but also check whether
required entity exists or not. Both local and direct use cases are important.
> Effective way of retrieving tables by id.
> -------------------------------------------
>
> Key: IGNITE-15721
> URL: https://issues.apache.org/jira/browse/IGNITE-15721
> Project: Ignite
> Issue Type: Improvement
> Reporter: Alexander Lapin
> Priority: Major
> Labels: ignite-3
>
> h3. Problem
> There are use cases that suppose retrieving configuration entities by id. For
> example retrieving table by id. The only option now is to get all tables with
> further iteration that will check whether a table id matches expected one.
> Things get worse if it's required to get table by id from remote node, e.g.
> {code:java}
> private boolean isTableConfigured(IgniteUuid id) {
> NamedListView<TableView> directTablesCfg =
> ((DirectConfigurationProperty<NamedListView<TableView>>)tablesCfg.tables()).directValue();
> // TODO: IGNITE-15721 Need to review this approach after the ticket
> would be fixed.
> // Probably, it won't be required getting configuration of all tables
> from Metastor.
> for (String name : directTablesCfg.namedListKeys()) {
> ExtendedTableView tView =
> (ExtendedTableView)directTablesCfg.get(name);
> if (tView != null && id.equals(IgniteUuid.fromString(tView.id())))
> return true;
> }
> return false;
> }
> {code}
> It worth to mention that sometimes, for example in use case mentioned above,
> exact data aren't needed, cause only fact of data absence is important. In
> other words It'll be great not only to have ability to retrieve tables,
> columns, indexes and other named list items by id (in addition to retriever
> by name) but also check whether required entity exists or not. Both local and
> direct use cases are important.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)