Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
In some cases it's required to retrieve configuration distributed value. Currently we use meta storage manager interface for this purpose and cause configuration registry hides the keys the code of the distributed property retrieval looks horrible:
//TODO This is an egregious violation of encapsulation. Current approach has to be revisited. private Set<String> tableNamesConfigured() { IgniteBiTuple<ByteArray, ByteArray> range = toRange(new ByteArray(PUBLIC_PREFIX)); Set<String> tableNames = new HashSet<>(); try (Cursor<Entry> cursor = metaStorageMgr.range(range.get1(), range.get2())) { while (cursor.hasNext()) { Entry entry = cursor.next(); List<String> keySplit = ConfigurationUtil.split(entry.key().toString()); if (keySplit.size() == 5 && NamedListNode.NAME.equals(keySplit.get(4))) tableNames.add(ByteUtils.fromBytes(entry.value()).toString()); } } catch (Exception e) { LOG.error("Can't get table names.", e); } return tableNames; }
Let's refactor it by adding distributedValue() (concrete name of the method is up to an implementator) to ConfigurationProperty. That will allow to simplify distributed retrieval:
private Set<String> tableNamesConfigured() { return new HashSet<>(clusterCfgMgr.configurationRegistry().getConfiguration(TablesConfiguration.KEY).tables(). distirbuteValue().namedListKeys()); }
Internally distributedValue() should fetch corresponding key->val from the meta storage without applying this value to local state updating localRoots.version etc.
Attachments
Issue Links
- blocks
-
IGNITE-15396 TableManager#table(UUID) could return null value even though the required table is already created
- Resolved
- links to