Skip to content

Commit

Permalink
Renaming and CHANGELOG fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Bogan <[email protected]>
  • Loading branch information
ryanbogan committed Nov 23, 2022
1 parent 21355f1 commit 2f1a588
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 47 deletions.
14 changes: 1 addition & 13 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- [Test] Add IAE test for deprecated edgeNGram analyzer name ([#5040](https://github.com/opensearch-project/OpenSearch/pull/5040))
- Allow mmap to use new JDK-19 preview APIs in Apache Lucene 9.4+ ([#5151](https://github.com/opensearch-project/OpenSearch/pull/5151))
- Add feature flag for extensions ([#5211](https://github.com/opensearch-project/OpenSearch/pull/5211))
- Adding initial support for extensions ([#2796](https://github.com/opensearch-project/OpenSearch/pull/2796))
- Adding extension framework support for first extension point ([#3107](https://github.com/opensearch-project/OpenSearch/pull/3107))
- Updated imports with absolute path ([#3173](https://github.com/opensearch-project/OpenSearch/pull/3173))
- Fix a bug where indexing times out when extensions do not exist ([#3188](https://github.com/opensearch-project/OpenSearch/pull/3188))
- Integrated CreateComponent extensionPoint ([#3265](https://github.com/opensearch-project/OpenSearch/pull/3265))
- Added javadocs for extensibility ([#3366](https://github.com/opensearch-project/OpenSearch/pull/3366))
- Resolved javadoc error ([#3380](https://github.com/opensearch-project/OpenSearch/pull/3380))
- Read from extensions.yml ([#3381](https://github.com/opensearch-project/OpenSearch/pull/3381))
- Added unit tests and modified extension read logic for ExtensionsOrchestrator ([#3449](https://github.com/opensearch-project/OpenSearch/pull/3449))
- Removed Plugin Directory code from ExtensionsOrchestrator ([#3721](https://github.com/opensearch-project/OpenSearch/pull/3721))
- Added unit test for createComponent workflow ([#3750](https://github.com/opensearch-project/OpenSearch/pull/3750))
- Adding support to register settings dynamically ([#3753](https://github.com/opensearch-project/OpenSearch/pull/3753))
- Added flag to check if connectToNode request is coming from ExtensionsOrchestrator ([#3830](https://github.com/opensearch-project/OpenSearch/pull/3830))
- Merge first batch of feature/extensions into main ([#5347](https://github.com/opensearch-project/OpenSearch/pull/5347))

### Dependencies
- Bumps `log4j-core` from 2.18.0 to 2.19.0
Expand Down
10 changes: 5 additions & 5 deletions server/src/main/java/org/opensearch/discovery/PluginRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.opensearch.cluster.node.DiscoveryNode;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.extensions.DiscoveryExtension;
import org.opensearch.extensions.DiscoveryExtensionNode;
import org.opensearch.transport.TransportRequest;

import java.io.IOException;
Expand All @@ -28,17 +28,17 @@ public class PluginRequest extends TransportRequest {
/*
* TODO change DiscoveryNode to Extension information
*/
private final List<DiscoveryExtension> extensions;
private final List<DiscoveryExtensionNode> extensions;

public PluginRequest(DiscoveryNode sourceNode, List<DiscoveryExtension> extensions) {
public PluginRequest(DiscoveryNode sourceNode, List<DiscoveryExtensionNode> extensions) {
this.sourceNode = sourceNode;
this.extensions = extensions;
}

public PluginRequest(StreamInput in) throws IOException {
super(in);
sourceNode = new DiscoveryNode(in);
extensions = in.readList(DiscoveryExtension::new);
extensions = in.readList(DiscoveryExtensionNode::new);
}

@Override
Expand All @@ -48,7 +48,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeList(extensions);
}

public List<DiscoveryExtension> getExtensions() {
public List<DiscoveryExtensionNode> getExtensions() {
return extensions;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
*
* @opensearch.internal
*/
public class DiscoveryExtension extends DiscoveryNode implements Writeable, ToXContentFragment {
public class DiscoveryExtensionNode extends DiscoveryNode implements Writeable, ToXContentFragment {

private final PluginInfo pluginInfo;

public DiscoveryExtension(
public DiscoveryExtensionNode(
String name,
String id,
String ephemeralId,
Expand All @@ -53,12 +53,12 @@ public void writeTo(StreamOutput out) throws IOException {
}

/**
* Construct DiscoveryExtension from a stream.
* Construct DiscoveryExtensionNode from a stream.
*
* @param in the stream
* @throws IOException if an I/O exception occurred reading the plugin info from the stream
*/
public DiscoveryExtension(final StreamInput in) throws IOException {
public DiscoveryExtensionNode(final StreamInput in) throws IOException {
super(in);
this.pluginInfo = new PluginInfo(in);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,23 @@ public static enum RequestType {
};

private final Path extensionsPath;
final List<DiscoveryExtension> extensionsList;
List<DiscoveryExtension> extensionsInitializedList;
final List<DiscoveryExtensionNode> uninitializedExtensions;
List<DiscoveryExtensionNode> extensions;
TransportService transportService;
ClusterService clusterService;

public ExtensionsOrchestrator(Settings settings, Path extensionsPath) throws IOException {
logger.info("ExtensionsOrchestrator initialized");
this.extensionsPath = extensionsPath;
this.transportService = null;
this.extensionsList = new ArrayList<DiscoveryExtension>();
this.extensionsInitializedList = new ArrayList<DiscoveryExtension>();
this.uninitializedExtensions = new ArrayList<DiscoveryExtensionNode>();
this.extensions = new ArrayList<DiscoveryExtensionNode>();
this.clusterService = null;

/*
* Now Discover extensions
*/
extensionsDiscovery();
discover();

}

Expand Down Expand Up @@ -149,7 +149,7 @@ public PluginsAndModules info() {
/*
* Load and populate all extensions
*/
private void extensionsDiscovery() throws IOException {
private void discover() throws IOException {
logger.info("Extensions Config Directory :" + extensionsPath.toString());
if (!FileSystemUtils.isAccessibleDirectory(extensionsPath, logger)) {
return;
Expand All @@ -164,8 +164,8 @@ private void extensionsDiscovery() throws IOException {
}
for (Extension extension : extensions) {
try {
extensionsList.add(
new DiscoveryExtension(
uninitializedExtensions.add(
new DiscoveryExtensionNode(
extension.getName(),
extension.getUniqueId(),
// placeholder for ephemeral id, will change with POC discovery
Expand All @@ -192,21 +192,21 @@ private void extensionsDiscovery() throws IOException {
logger.error(e.toString());
}
}
if (!extensionsList.isEmpty()) {
if (!uninitializedExtensions.isEmpty()) {
logger.info("Loaded all extensions");
}
} else {
logger.info("Extensions.yml file is not present. No extensions will be loaded.");
}
}

public void extensionsInitialize() {
for (DiscoveryNode extensionNode : extensionsList) {
extensionInitialize(extensionNode);
public void initialize() {
for (DiscoveryNode extensionNode : uninitializedExtensions) {
initializeExtension(extensionNode);
}
}

private void extensionInitialize(DiscoveryNode extensionNode) {
private void initializeExtension(DiscoveryNode extensionNode) {

final TransportResponseHandler<PluginResponse> pluginResponseHandler = new TransportResponseHandler<PluginResponse>() {

Expand All @@ -217,9 +217,9 @@ public PluginResponse read(StreamInput in) throws IOException {

@Override
public void handleResponse(PluginResponse response) {
for (DiscoveryExtension extension : extensionsList) {
for (DiscoveryExtensionNode extension : uninitializedExtensions) {
if (extension.getName().equals(response.getName())) {
extensionsInitializedList.add(extension);
extensions.add(extension);
break;
}
}
Expand All @@ -240,7 +240,7 @@ public String executor() {
transportService.sendRequest(
extensionNode,
REQUEST_EXTENSION_ACTION_NAME,
new PluginRequest(transportService.getLocalNode(), new ArrayList<DiscoveryExtension>(extensionsList)),
new PluginRequest(transportService.getLocalNode(), new ArrayList<DiscoveryExtensionNode>(uninitializedExtensions)),
pluginResponseHandler
);
} catch (Exception e) {
Expand Down Expand Up @@ -268,7 +268,7 @@ TransportResponse handleExtensionRequest(ExtensionRequest extensionRequest) thro
}

public void onIndexModule(IndexModule indexModule) throws UnknownHostException {
for (DiscoveryNode extensionNode : extensionsList) {
for (DiscoveryNode extensionNode : uninitializedExtensions) {
onIndexModule(indexModule, extensionNode);
}
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/main/java/org/opensearch/node/Node.java
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ public Node start() throws NodeValidationException {
: "clusterService has a different local node than the factory provided";
transportService.acceptIncomingRequests();
if (FeatureFlags.isEnabled(FeatureFlags.EXTENSIONS)) {
extensionsOrchestrator.extensionsInitialize();
extensionsOrchestrator.initialize();
}
discovery.startInitialJoin();
final TimeValue initialStateTimeout = DiscoverySettings.INITIAL_STATE_TIMEOUT_SETTING.get(settings());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ public void testExtensionsDiscovery() throws Exception {

ExtensionsOrchestrator extensionsOrchestrator = new ExtensionsOrchestrator(settings, extensionDir);

List<DiscoveryExtension> expectedExtensionsList = new ArrayList<DiscoveryExtension>();
List<DiscoveryExtensionNode> expectedUninitializedExtensions = new ArrayList<DiscoveryExtensionNode>();

expectedExtensionsList.add(
new DiscoveryExtension(
expectedUninitializedExtensions.add(
new DiscoveryExtensionNode(
"firstExtension",
"uniqueid1",
"uniqueid1",
Expand All @@ -180,8 +180,8 @@ public void testExtensionsDiscovery() throws Exception {
)
);

expectedExtensionsList.add(
new DiscoveryExtension(
expectedUninitializedExtensions.add(
new DiscoveryExtensionNode(
"secondExtension",
"uniqueid2",
"uniqueid2",
Expand All @@ -202,7 +202,7 @@ public void testExtensionsDiscovery() throws Exception {
)
)
);
assertEquals(expectedExtensionsList, extensionsOrchestrator.extensionsList);
assertEquals(expectedUninitializedExtensions, extensionsOrchestrator.uninitializedExtensions);
}

public void testNonAccessibleDirectory() throws Exception {
Expand Down Expand Up @@ -305,7 +305,7 @@ public void testExtensionsInitialize() throws Exception {
)
);

extensionsOrchestrator.extensionsInitialize();
extensionsOrchestrator.initialize();
mockLogAppender.assertAllExpectationsMatched();
}
}
Expand Down

0 comments on commit 2f1a588

Please sign in to comment.