Skip to content

Commit

Permalink
Porting replication plugin to OpenSearch
Browse files Browse the repository at this point in the history
Signed-off-by: Sai <[email protected]>
  • Loading branch information
saikaranam-amazon committed Jun 1, 2021
1 parent e89a9dd commit eb08b4f
Show file tree
Hide file tree
Showing 88 changed files with 1,223 additions and 1,210 deletions.
103 changes: 71 additions & 32 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,48 +16,86 @@
import java.nio.charset.StandardCharsets
import java.nio.file.Files
import java.util.concurrent.Callable
import org.elasticsearch.gradle.testclusters.TestClusterConfiguration
import org.opensearch.gradle.testclusters.TestClusterConfiguration
import java.util.function.Predicate
import java.util.concurrent.TimeUnit
import java.util.stream.Collectors

plugins {
id "elasticsearch.esplugin" version "7.10.2"
id 'org.jetbrains.kotlin.jvm' version "1.3.72"
buildscript {
ext {
opensearch_version = System.getProperty("opensearch_version", "1.0.0-beta1")
kotlin_version = System.getProperty("kotlin.version", "1.3.72")
}

repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}

dependencies {
classpath "org.opensearch.gradle:build-tools:${opensearch_version}"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
classpath "org.jetbrains.kotlin:kotlin-allopen:${kotlin_version}"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.0.0-RC15"
classpath "org.jacoco:org.jacoco.agent:0.8.5"
}
}

group = "com.amazon.es"
version = "${version}.0"

ext.kotlin_version = '1.3.72'
repositories {
mavenCentral()
plugins {
id 'nebula.ospackage' version "8.3.0"
id "com.dorongold.task-tree" version "1.5"
}

apply plugin: 'elasticsearch.testclusters'
apply plugin: 'elasticsearch.rest-test'
apply plugin: 'java'
apply plugin: 'jacoco'
apply plugin: 'idea'
apply plugin: 'opensearch.opensearchplugin'
apply plugin: 'opensearch.testclusters'
apply plugin: 'opensearch.rest-test'
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'org.jetbrains.kotlin.plugin.allopen'

configurations.all {
if (it.state != Configuration.State.UNRESOLVED) return
resolutionStrategy {
force "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
force "org.jetbrains.kotlin:kotlin-stdlib-common:${kotlin_version}"
force 'junit:junit:4.13.1'
force 'commons-beanutils:commons-beanutils:1.9.4'
force 'com.google.guava:guava:30.0-jre'
force 'com.puppycrawl.tools:checkstyle:8.29'
force 'commons-codec:commons-codec:1.13'
force 'org.apache.httpcomponents:httpclient:4.5.13'
force 'org.apache.httpcomponents:httpclient-osgi:4.5.13'
force 'org.apache.httpcomponents.client5:httpclient5:5.0.3'
force 'org.apache.httpcomponents.client5:httpclient5-osgi:5.0.3'
force 'com.fasterxml.jackson.core:jackson-databind:2.10.4'
force 'org.yaml:snakeyaml:1.26'
force 'org.codehaus.plexus:plexus-utils:3.0.24'
}
}

dependencies {
// Elasticsearch nanny state marks all dependencies non-transitive forcing us to list them out.
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7"
compile "org.jetbrains.kotlin:kotlin-stdlib"
compile "org.jetbrains.kotlin:kotlin-stdlib-common"
compileOnly "org.opensearch:opensearch:${opensearch_version}"
compile "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
compile "org.jetbrains.kotlin:kotlin-stdlib-common:${kotlin_version}"
compile "org.jetbrains:annotations:13.0"
compile "com.github.seancfoley:ipaddress:5.3.3"
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5"

testCompile "org.opensearch.test:framework:${opensearch_version}"
testImplementation "org.assertj:assertj-core:3.17.2"
testImplementation "org.elasticsearch.client:elasticsearch-rest-high-level-client:${versions.elasticsearch}"
testImplementation "org.opensearch.client:opensearch-rest-high-level-client:${opensearch_version}"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.5"
testCompile "org.jetbrains.kotlin:kotlin-test:${kotlin_version}"
}

// Elasticsearch nanny state forces us to manually resolve all conflicts
configurations.all {
if (it.state != Configuration.State.UNRESOLVED) return
resolutionStrategy {
force "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
force "org.jetbrains.kotlin:kotlin-stdlib-common:${kotlin_version}"
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}

compileKotlin {
Expand All @@ -75,21 +113,22 @@ compileTestKotlin {
}
}

esplugin {
name = project.name
description = "Open Distro Cross Cluster Replication Plugin"
classname = "com.amazon.elasticsearch.replication.ReplicationPlugin"
}

ext {
licenseFile = rootProject.file('LICENSE')
noticeFile = rootProject.file('NOTICE')
}

opensearchplugin {
name = project.name
description = "Open Distro Cross Cluster Replication Plugin"
classname = "org.opensearch.replication.ReplicationPlugin"
}


javadoc.enabled = false
licenseHeaders.enabled = false
dependencyLicenses.enabled = false
thirdPartyAudit.enabled = true
thirdPartyAudit.enabled = false
validateNebulaPom.enabled = false
loggerUsageCheck.enabled = false

Expand Down Expand Up @@ -211,7 +250,7 @@ task initializeSecurityIndex {
testingConventions {
naming {
IT {
baseClass 'com.amazon.elasticsearch.replication.MultiClusterRestTestCase'
baseClass 'org.opensearch.replication.MultiClusterRestTestCase'
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.

version = 1.13.0
version = 1.0.0
18 changes: 1 addition & 17 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,4 @@
* permissions and limitations under the License.
*/

pluginManagement {
repositories {
mavenCentral()
jcenter()
gradlePluginPortal()
}
resolutionStrategy {
eachPlugin {
// ES not available in gradle plugin portal so hand code here
if(requested.id.namespace == "elasticsearch") {
useModule "org.elasticsearch.gradle:build-tools:${requested.version}"
}
}
}
}

rootProject.name = "opendistro-cross-cluster-replication"
rootProject.name = "opensearch-cross-cluster-replication"
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
* permissions and limitations under the License.
*/

package com.amazon.elasticsearch.replication
package org.opensearch.replication

import org.elasticsearch.index.engine.EngineConfig
import org.elasticsearch.index.engine.InternalEngine
import org.elasticsearch.index.seqno.SequenceNumbers
import org.opensearch.index.engine.EngineConfig
import org.opensearch.index.engine.InternalEngine
import org.opensearch.index.seqno.SequenceNumbers

class ReplicationEngine(config: EngineConfig) : InternalEngine(config) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
* permissions and limitations under the License.
*/

package com.amazon.elasticsearch.replication
package org.opensearch.replication

import org.elasticsearch.ElasticsearchException
import org.elasticsearch.action.ShardOperationFailedException
import org.elasticsearch.cluster.metadata.IndexMetadata.INDEX_UUID_NA_VALUE
import org.elasticsearch.index.shard.ShardId
import org.opensearch.OpenSearchException
import org.opensearch.action.ShardOperationFailedException
import org.opensearch.cluster.metadata.IndexMetadata.INDEX_UUID_NA_VALUE
import org.opensearch.index.shard.ShardId

/**
* Base class replication exceptions. Note: Replication process may throw exceptions that do not derive from this such as
* [org.elasticsearch.ResourceAlreadyExistsException], [org.elasticsearch.index.IndexNotFoundException] or
* [org.elasticsearch.index.shard.ShardNotFoundException].
* [org.opensearch.ResourceAlreadyExistsException], [org.opensearch.index.IndexNotFoundException] or
* [org.opensearch.index.shard.ShardNotFoundException].
*/
class ReplicationException: ElasticsearchException {
class ReplicationException: OpenSearchException {

constructor(message: String, vararg args: Any) : super(message, *args)

Expand Down
Loading

0 comments on commit eb08b4f

Please sign in to comment.