Skip to content

Commit a05ebbc

Browse files
authored
This reverts commit db49a15 to avoid jarHell in downstream plugins. (#836)
Signed-off-by: cliu123 <lc12251109@gmail.com>
1 parent db49a15 commit a05ebbc

File tree

13 files changed

+116
-326
lines changed

13 files changed

+116
-326
lines changed

build.gradle

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -241,34 +241,11 @@ repositories {
241241

242242
dependencies {
243243
implementation project(path: ":${rootProject.name}-spi", configuration: 'shadow')
244-
implementation ("org.opensearch:opensearch-remote-metadata-sdk-ddb-client:${opensearch_build}")
245-
implementation "org.opensearch:opensearch-remote-metadata-sdk:${opensearch_build}"
246244
testImplementation group: 'org.mockito', name: 'mockito-core', version: "${versions.mockito}"
247245

248246
opensearchPlugin "org.opensearch.plugin:opensearch-security:${security_plugin_version}@zip"
249247
}
250248

251-
def commonResolutionStrategy = {
252-
force "org.slf4j:slf4j-api:${versions.slf4j}"
253-
force "com.fasterxml.jackson.core:jackson-core:${versions.jackson}"
254-
force "com.fasterxml.jackson.core:jackson-databind:${versions.jackson}"
255-
force "com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}"
256-
force "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:${versions.jackson}"
257-
force "com.fasterxml.jackson.dataformat:jackson-dataformat-smile:${versions.jackson}"
258-
force "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${versions.jackson}"
259-
force "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${versions.jackson}"
260-
force "commons-codec:commons-codec:${versions.commonscodec}"
261-
force "org.apache.httpcomponents:httpcore:${versions.httpcore}"
262-
force "jakarta.json:jakarta.json-api:2.1.3"
263-
force "commons-logging:commons-logging:${versions.commonslogging}"
264-
force "org.apache.httpcomponents.client5:httpclient5:${versions.httpclient5}"
265-
}
266-
267-
configurations {
268-
runtimeClasspath.resolutionStrategy(commonResolutionStrategy)
269-
testRuntimeClasspath.resolutionStrategy(commonResolutionStrategy)
270-
}
271-
272249
// RPM & Debian build
273250
apply plugin: 'com.netflix.nebula.ospackage'
274251

@@ -317,9 +294,9 @@ integTest {
317294
}
318295
}
319296
Zip bundle = (Zip) project.getTasks().getByName("bundlePlugin");
320-
integTest.getClusters().forEach{ c ->
297+
integTest.getClusters().forEach{c -> {
321298
c.plugin(project.getObjects().fileProperty().value(bundle.getArchiveFile()))
322-
}
299+
}}
323300

324301
testClusters.integTest {
325302
testDistribution = 'INTEG_TEST'

sample-extension-plugin/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ integTest {
111111

112112
Zip bundle = (Zip) project.getTasks().getByName("bundlePlugin");
113113
Zip rootBundle = (Zip) rootProject.getTasks().getByName("bundlePlugin");
114-
integTest.getClusters().forEach{c ->
114+
integTest.getClusters().forEach{c -> {
115115
c.plugin(rootProject.getObjects().fileProperty().value(rootBundle.getArchiveFile()))
116116
c.plugin(project.getObjects().fileProperty().value(bundle.getArchiveFile()))
117-
}
117+
}}
118118

119119
testClusters.integTest {
120120
testDistribution = 'INTEG_TEST'

src/main/java/org/opensearch/jobscheduler/JobSchedulerPlugin.java

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@
5656
import org.opensearch.plugins.IdentityAwarePlugin;
5757
import org.opensearch.plugins.Plugin;
5858
import org.opensearch.plugins.SystemIndexPlugin;
59-
import org.opensearch.remote.metadata.client.SdkClient;
60-
import org.opensearch.remote.metadata.client.impl.SdkClientFactory;
6159
import org.opensearch.repositories.RepositoriesService;
6260
import org.opensearch.rest.RestController;
6361
import org.opensearch.script.ScriptService;
@@ -72,23 +70,14 @@
7270
import java.util.Map;
7371
import java.util.Set;
7472
import java.util.Collection;
75-
import java.util.Collections;
7673
import java.util.List;
7774
import java.util.ArrayList;
7875
import java.util.function.Supplier;
7976

80-
import static org.opensearch.remote.metadata.common.CommonValue.REMOTE_METADATA_ENDPOINT_KEY;
81-
import static org.opensearch.remote.metadata.common.CommonValue.REMOTE_METADATA_REGION_KEY;
82-
import static org.opensearch.remote.metadata.common.CommonValue.REMOTE_METADATA_SERVICE_NAME_KEY;
83-
import static org.opensearch.remote.metadata.common.CommonValue.REMOTE_METADATA_TYPE_KEY;
84-
import static org.opensearch.remote.metadata.common.CommonValue.TENANT_AWARE_KEY;
85-
import static org.opensearch.remote.metadata.common.CommonValue.TENANT_ID_FIELD_KEY;
86-
8777
public class JobSchedulerPlugin extends Plugin implements ActionPlugin, ExtensiblePlugin, SystemIndexPlugin, IdentityAwarePlugin {
8878

8979
public static final String OPEN_DISTRO_JOB_SCHEDULER_THREAD_POOL_NAME = "open_distro_job_scheduler";
9080
public static final String JS_BASE_URI = "/_plugins/_job_scheduler";
91-
public static final String TENANT_ID_FIELD = "tenant_id";
9281

9382
private static final Logger log = LogManager.getLogger(JobSchedulerPlugin.class);
9483
private JobSweeper sweeper;
@@ -98,7 +87,6 @@ public class JobSchedulerPlugin extends Plugin implements ActionPlugin, Extensib
9887
private Map<String, ScheduledJobProvider> indexToJobProviders;
9988
private Set<String> indicesToListen;
10089
private PluginClient pluginClient;
101-
private SdkClient sdkClient;
10290

10391
private JobDetailsService jobDetailsService;
10492

@@ -142,36 +130,10 @@ public Collection<Object> createComponents(
142130
IndexNameExpressionResolver indexNameExpressionResolver,
143131
Supplier<RepositoriesService> repositoriesServiceSupplier
144132
) {
145-
Settings settings = environment.settings();
146-
Boolean isMultiTenancyEnabled = JobSchedulerSettings.JOB_SCHEDULER_MULTI_TENANCY_ENABLED.get(settings);
147-
this.pluginClient = new PluginClient(client);
148-
149-
// Initialize SDK client for remote metadata storage
150-
this.sdkClient = SdkClientFactory.createSdkClient(
151-
pluginClient,
152-
xContentRegistry,
153-
isMultiTenancyEnabled
154-
? Map.ofEntries(
155-
Map.entry(REMOTE_METADATA_TYPE_KEY, JobSchedulerSettings.REMOTE_METADATA_TYPE.get(settings)),
156-
Map.entry(REMOTE_METADATA_ENDPOINT_KEY, JobSchedulerSettings.REMOTE_METADATA_ENDPOINT.get(settings)),
157-
Map.entry(REMOTE_METADATA_REGION_KEY, JobSchedulerSettings.REMOTE_METADATA_REGION.get(settings)),
158-
Map.entry(REMOTE_METADATA_SERVICE_NAME_KEY, JobSchedulerSettings.REMOTE_METADATA_SERVICE_NAME.get(settings)),
159-
Map.entry(TENANT_AWARE_KEY, "true"),
160-
Map.entry(TENANT_ID_FIELD_KEY, TENANT_ID_FIELD)
161-
)
162-
: Collections.emptyMap()
163-
);
164-
165133
Supplier<Boolean> statusHistoryEnabled = () -> JobSchedulerSettings.STATUS_HISTORY.get(environment.settings());
134+
this.pluginClient = new PluginClient(client);
166135
this.historyService = new JobHistoryService(pluginClient, clusterService);
167-
this.lockService = new LockServiceImpl(
168-
pluginClient,
169-
clusterService,
170-
historyService,
171-
statusHistoryEnabled,
172-
this.sdkClient,
173-
isMultiTenancyEnabled
174-
);
136+
this.lockService = new LockServiceImpl(pluginClient, clusterService, historyService, statusHistoryEnabled);
175137
this.jobDetailsService = new JobDetailsService(client, clusterService, this.indicesToListen, this.indexToJobProviders);
176138
this.scheduler = new JobScheduler(threadPool, this.lockService);
177139
this.sweeper = initSweeper(
@@ -187,7 +149,7 @@ public Collection<Object> createComponents(
187149
clusterService.addListener(this.sweeper);
188150
clusterService.addLifecycleListener(this.sweeper);
189151

190-
return List.of(this.lockService, this.scheduler, this.jobDetailsService, this.pluginClient, this.sdkClient);
152+
return List.of(this.lockService, this.scheduler, this.jobDetailsService, this.pluginClient);
191153
}
192154

193155
@Override
@@ -206,11 +168,6 @@ public List<Setting<?>> getSettings() {
206168
settingList.add(JobSchedulerSettings.SWEEP_PERIOD);
207169
settingList.add(JobSchedulerSettings.JITTER_LIMIT);
208170
settingList.add(JobSchedulerSettings.STATUS_HISTORY);
209-
settingList.add(JobSchedulerSettings.REMOTE_METADATA_TYPE);
210-
settingList.add(JobSchedulerSettings.REMOTE_METADATA_ENDPOINT);
211-
settingList.add(JobSchedulerSettings.REMOTE_METADATA_REGION);
212-
settingList.add(JobSchedulerSettings.REMOTE_METADATA_SERVICE_NAME);
213-
settingList.add(JobSchedulerSettings.JOB_SCHEDULER_MULTI_TENANCY_ENABLED);
214171
return settingList;
215172
}
216173

src/main/java/org/opensearch/jobscheduler/JobSchedulerSettings.java

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@
1111
import org.opensearch.common.settings.Setting;
1212
import org.opensearch.common.unit.TimeValue;
1313

14-
import static org.opensearch.remote.metadata.common.CommonValue.REMOTE_METADATA_ENDPOINT_KEY;
15-
import static org.opensearch.remote.metadata.common.CommonValue.REMOTE_METADATA_REGION_KEY;
16-
import static org.opensearch.remote.metadata.common.CommonValue.REMOTE_METADATA_SERVICE_NAME_KEY;
17-
import static org.opensearch.remote.metadata.common.CommonValue.REMOTE_METADATA_TYPE_KEY;
18-
import static org.opensearch.remote.metadata.common.CommonValue.TENANT_AWARE_KEY;
19-
2014
public class JobSchedulerSettings {
2115
public static final Setting<TimeValue> REQUEST_TIMEOUT = Setting.positiveTimeSetting(
2216
"plugins.jobscheduler.request_timeout",
@@ -66,40 +60,4 @@ public class JobSchedulerSettings {
6660
Setting.Property.NodeScope,
6761
Setting.Property.Dynamic
6862
);
69-
70-
/** This setting sets the remote metadata type */
71-
public static final Setting<String> REMOTE_METADATA_TYPE = Setting.simpleString(
72-
"plugins.jobscheduler." + REMOTE_METADATA_TYPE_KEY,
73-
Setting.Property.NodeScope,
74-
Setting.Property.Final
75-
);
76-
77-
/** This setting sets the remote metadata endpoint */
78-
public static final Setting<String> REMOTE_METADATA_ENDPOINT = Setting.simpleString(
79-
"plugins.jobscheduler." + REMOTE_METADATA_ENDPOINT_KEY,
80-
Setting.Property.NodeScope,
81-
Setting.Property.Final
82-
);
83-
84-
/** This setting sets the remote metadata region */
85-
public static final Setting<String> REMOTE_METADATA_REGION = Setting.simpleString(
86-
"plugins.jobscheduler." + REMOTE_METADATA_REGION_KEY,
87-
Setting.Property.NodeScope,
88-
Setting.Property.Final
89-
);
90-
91-
/** This setting sets the remote metadata service name */
92-
public static final Setting<String> REMOTE_METADATA_SERVICE_NAME = Setting.simpleString(
93-
"plugins.jobscheduler." + REMOTE_METADATA_SERVICE_NAME_KEY,
94-
Setting.Property.NodeScope,
95-
Setting.Property.Final
96-
);
97-
98-
/** This setting enables multi-tenancy for job scheduler */
99-
public static final Setting<Boolean> JOB_SCHEDULER_MULTI_TENANCY_ENABLED = Setting.boolSetting(
100-
"plugins.jobscheduler." + TENANT_AWARE_KEY,
101-
false,
102-
Setting.Property.NodeScope,
103-
Setting.Property.Final
104-
);
10563
}

src/main/java/org/opensearch/jobscheduler/utils/JobDetailsService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ public void processJobDetails(
398398

399399
/**
400400
* Create Job details entry
401-
* @param tempJobDetails new job details object that need to be inserted as document in the index
401+
* @param tempJobDetails new job details object that need to be inserted as document in the index=
402402
* @param listener an {@code ActionListener} that has onResponse and onFailure that is used to return the job details if it was created
403403
* or else null.
404404
*/

0 commit comments

Comments
 (0)