Skip to content

ServiceConfigGuide re-orders ConfigEntries when merging #997

@drewfarris

Description

@drewfarris

Given a configuration file like:

TEST_KEY = testValueA
TEST_KEY = testValueB

There are potentially places that are sensitive to the ordering of the ConfigEntries that are generated, such as coordination places. When running with a plain configuration file, the order is preserved, but when merging in a flavored configuration (or whenever else the merge flag is set to true in ServiceConfigGuide.handleNewEntry(...), the new ConfigEntries generated are inserted at position 0 in the serviceParameters list. As a result, the entries wind up in the list in the opposite order in which they were listed in the configuration file. This means it may be difficult to preserve/predict the order a series of configuration entries are returned by something like List<String> configG.findEntries("TEST_KEY")

In the case of the example above, a non-merge operation generates the order 'testValueA, testValueB' whereas a merged configuration operation produces the result of 'testValueB, testValueA'. The issue on merge may indeed be more complex than a simple re-ordering and deserves further investigation.

One portion of the code in question is from the ServiceConfigGuide.handleNewEntry(...) method

if (merge) {
this.serviceParameters.add(0, anEntry);
} else {
this.serviceParameters.add(anEntry);
}

Alternately, we could just make the statement that findEntries always returns the matching configuration options in non-deterministic order and rely on other methods for precisely ordering configuration entries.

It's not clear how pervasive the ordering assumption is throughout configuration files used in systems that depend on Emissary, so any changes related to this will require investigation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions