Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebase on main #363

Merged
merged 61 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
49565b2
Update gradle version to 7.6 (#265)
VijayanB Apr 26, 2023
ba16116
Exclude lombok generated code from jacoco coverage report (#268)
heemin32 Apr 26, 2023
3524683
Make jacoco report to be generated faster in local (#267)
heemin32 Apr 26, 2023
d9884b3
Update dependency org.json:json to v20230227 (#273)
mend-for-github-com[bot] May 2, 2023
b9db1c7
Baseline owners and maintainers (#275)
VijayanB May 2, 2023
7ee2f13
Add Auto Release Workflow (#288)
naveentatikonda May 6, 2023
55e7798
Change package for Strings.hasText (#314)
heemin32 May 19, 2023
78e4005
Adding release notes for 2.8 (#323)
martin-gaievski May 26, 2023
ee06307
Add 2.9.0 release notes (#350)
junqiu-lei Jul 11, 2023
806755f
Update packages according to a change in OpenSearch core (#353)
heemin32 Jul 13, 2023
3c6dc55
Implement creation of ip2geo feature (#257)
heemin32 Apr 26, 2023
a3627a6
Added unit tests with some refactoring of codes (#271)
heemin32 May 3, 2023
ee519a2
Sync from main (#280)
heemin32 May 3, 2023
cc41bf5
Add datasource name validation (#281)
heemin32 May 3, 2023
c31ded4
Refactoring of code (#282)
heemin32 May 3, 2023
2bc5bb0
Change field name from md5 to sha256 (#285)
heemin32 May 4, 2023
df6de87
Implement get datasource api (#279)
heemin32 May 4, 2023
6d5ffa5
Update index option (#284)
heemin32 May 4, 2023
82e3430
Make some fields in manifest file as mandatory (#289)
heemin32 May 4, 2023
932e1e1
Create datasource index explicitly (#283)
heemin32 May 4, 2023
fde10e1
Add wrapper class of job scheduler lock service (#290)
heemin32 May 5, 2023
d3f39b0
Remove all unused client attributes (#293)
heemin32 May 6, 2023
056159b
Update copyright header (#298)
heemin32 May 8, 2023
4622492
Run system index handling code with stashed thread context (#297)
heemin32 May 9, 2023
50a29e8
Reduce lock duration and renew the lock during update (#299)
heemin32 May 10, 2023
235431e
Implements delete datasource API (#291)
heemin32 May 10, 2023
062d73b
Set User-Agent in http request (#300)
heemin32 May 10, 2023
e42d65a
Implement datasource update API (#292)
heemin32 May 10, 2023
befcf47
Refactoring test code (#302)
heemin32 May 11, 2023
0da53eb
Add ip2geo processor integ test for failure case (#303)
heemin32 May 11, 2023
8d5c6bf
Bug fix and refactoring of code (#305)
heemin32 May 12, 2023
3adb06a
Add integration test for Ip2GeoProcessor (#306)
heemin32 May 15, 2023
9da3d85
Add ConcurrentModificationException (#308)
heemin32 May 16, 2023
f5d5bee
Add integration test for UpdateDatasource API (#307)
heemin32 May 16, 2023
3992850
Bug fix on lock management and few performance improvements (#310)
heemin32 May 16, 2023
75137e8
Change index setting from read_only_allow_delete to write (#311)
heemin32 May 17, 2023
94b5bf7
Fix bug in get datasource API and improve memory usage (#313)
heemin32 May 19, 2023
34804c9
Change package for Strings.hasText (#314) (#317)
heemin32 May 23, 2023
2bec196
Remove jitter and move index setting from DatasourceFacade to Datasou…
heemin32 May 24, 2023
21ae37a
Do not index blank value and do not enrich null property (#320)
heemin32 May 24, 2023
1de266b
Move index setting keys to constants (#321)
heemin32 May 24, 2023
91b99d8
Return null index name for expired data (#322)
heemin32 May 25, 2023
7a83df4
Add new fields in datasource (#325)
heemin32 May 30, 2023
a52bc8b
Delete index once it is expired (#326)
heemin32 May 31, 2023
661fe6a
Add restoring event listener (#328)
heemin32 Jun 2, 2023
d158239
Reverse forcemerge and refresh order (#331)
heemin32 Jun 7, 2023
dff8206
Removed parameter and settings (#332)
heemin32 Jun 7, 2023
860c902
Add a field in datasource for current index name (#333)
heemin32 Jun 8, 2023
fb19948
Delete GeoIP data indices after restoring complete (#334)
heemin32 Jun 8, 2023
10f9107
Use bool query for array form of IPs (#335)
heemin32 Jun 9, 2023
c43eae1
Run update/delete request in a new thread (#337)
heemin32 Jun 16, 2023
b505ca3
Remove IP2Geo processor validation (#336)
heemin32 Jun 16, 2023
8d8b949
Acquire lock sychronously (#339)
heemin32 Jun 26, 2023
b657fff
Added a cache to store datasource metadata (#338)
heemin32 Jun 26, 2023
20b3a85
Changed class name and package (#341)
heemin32 Jun 26, 2023
a45760f
Refactoring of code (#342)
heemin32 Jun 26, 2023
dd3f393
Add geo data cache (#340)
heemin32 Jun 26, 2023
418c3bc
Add cache layer to reduce GeoIp data retrieval latency (#343)
heemin32 Jun 29, 2023
04e6d6d
Use _primary in query preference and few changes (#347)
heemin32 Jun 30, 2023
90f3b7c
Wait until GeoIP data to be replicated to all data nodes (#348)
heemin32 Jul 5, 2023
c0987cb
Update packages according to a change in OpenSearch core (#354)
heemin32 Jul 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# This should match the owning team set up in https://github.com/orgs/opensearch-project/teams
* @opensearch-project/geospatial
* @heemin32 @navneet1v @VijayanB @vamshin @jmazanec15 @naveentatikonda @junqiu-lei @martin-gaievski
28 changes: 28 additions & 0 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Releases

on:
push:
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: GitHub App token
id: github_app_token
uses: tibdex/[email protected]
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
installation_id: 22958780
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
- uses: actions/checkout@v2
- uses: ncipollo/release-action@v1
with:
github_token: ${{ steps.github_app_token.outputs.token }}
bodyFile: release-notes/opensearch-geospatial.release-notes-${{steps.tag.outputs.tag}}.md
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Maintenance
### Refactoring

## [Unreleased 2.x](https://github.com/opensearch-project/geospatial/compare/2.7...2.x)
## [Unreleased 2.x](https://github.com/opensearch-project/geospatial/compare/2.9...2.x)
### Features
### Enhancements
### Bug Fixes
### Infrastructure
* Make jacoco report to be generated faster in local ([#267](https://github.com/opensearch-project/geospatial/pull/267))
* Exclude lombok generated code from jacoco coverage report ([#268](https://github.com/opensearch-project/geospatial/pull/268))
### Documentation
### Maintenance
* Change package for Strings.hasText ([#314](https://github.com/opensearch-project/geospatial/pull/314))
### Refactoring
15 changes: 10 additions & 5 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ This document contains a list of maintainers in this repo. See [opensearch-proje

## Current Maintainers

| Maintainer | GitHub ID | Affiliation |
| ----------------------- | ------------------------------------------- | ----------- |
| Jack Mazanec | [jmazanec15](https://github.com/jmazanec15) | Amazon |
| Vamshi Vijay Nakkirtha | [vamshin](https://github.com/vamshin) | Amazon |
| Vijayan Balasubramanian | [VijayanB](https://github.com/VijayanB) | Amazon |
| Maintainer | GitHub ID | Affiliation |
|-------------------------|-------------------------------------------------------|-------------|
| Heemin Kim | [heemin32](https://github.com/heemin32) | Amazon |
| Jack Mazanec | [jmazanec15](https://github.com/jmazanec15) | Amazon |
| Junqiu Lei | [junqiu-lei](https://github.com/junqiu-lei) | Amazon |
| Martin Gaievski | [martin-gaievski](https://github.com/martin-gaievski) | Amazon |
| Naveen Tatikonda | [naveentatikonda](https://github.com/naveentatikonda) | Amazon |
| Navneet Verma | [navneet1v](https://github.com/navneet1v) | Amazon |
| Vamshi Vijay Nakkirtha | [vamshin](https://github.com/vamshin) | Amazon |
| Vijayan Balasubramanian | [VijayanB](https://github.com/VijayanB) | Amazon |
59 changes: 55 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import org.opensearch.gradle.test.RestIntegTestTask

import java.util.concurrent.Callable

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'opensearch.opensearchplugin'
Expand Down Expand Up @@ -35,6 +37,7 @@ opensearchplugin {
classname "${projectPath}.${pathToPlugin}.${pluginClassName}"
licenseFile rootProject.file('LICENSE')
noticeFile rootProject.file('NOTICE')
extendedPlugins = ['opensearch-job-scheduler']
}

// This requires an additional Jar not published as part of build-tools
Expand Down Expand Up @@ -142,6 +145,10 @@ publishing {
}


configurations {
zipArchive
}

//****************************************************************************/
// Dependencies
//****************************************************************************/
Expand All @@ -150,10 +157,13 @@ dependencies {
api project(":libs:h3")
yamlRestTestRuntimeOnly "org.apache.logging.log4j:log4j-core:${versions.log4j}"
testImplementation "org.hamcrest:hamcrest:${versions.hamcrest}"
testImplementation 'org.json:json:20211205'
testImplementation 'org.json:json:20230227'
implementation "org.apache.commons:commons-lang3:3.12.0"
implementation "org.locationtech.spatial4j:spatial4j:${versions.spatial4j}"
implementation "org.locationtech.jts:jts-core:${versions.jts}"
implementation "org.apache.commons:commons-csv:1.10.0"
zipArchive group: 'org.opensearch.plugin', name:'opensearch-job-scheduler', version: "${opensearch_build}"
compileOnly "org.opensearch:opensearch-job-scheduler-spi:${opensearch_build}"
}

licenseHeaders.enabled = true
Expand Down Expand Up @@ -206,8 +216,6 @@ integTest {
testClusters.integTest {
testDistribution = "ARCHIVE"

// This installs our plugin into the testClusters
plugin(project.tasks.bundlePlugin.archiveFile)
// Cluster shrink exception thrown if we try to set numberOfNodes to 1, so only apply if > 1
if (_numNodes > 1) numberOfNodes = _numNodes
// When running integration tests it doesn't forward the --debug-jvm to the cluster anymore
Expand All @@ -220,6 +228,49 @@ testClusters.integTest {
debugPort += 1
}
}

// This installs our plugin into the testClusters
plugin(project.tasks.bundlePlugin.archiveFile)
plugin(provider(new Callable<RegularFile>(){
@Override
RegularFile call() throws Exception {
return new RegularFile() {
@Override
File getAsFile() {
return configurations.zipArchive.asFileTree.getSingleFile()
}
}
}
}))

// opensearch-geospatial plugin is being added to the list of plugins for the testCluster during build before
// the opensearch-job-scheduler plugin, which is causing build failures. From the stack trace, this looks like a bug.
//
// Exception in thread "main" java.lang.IllegalArgumentException: Missing plugin [opensearch-job-scheduler], dependency of [opensearch-geospatial]
// at org.opensearch.plugins.PluginsService.addSortedBundle(PluginsService.java:515)
//
// A temporary hack is to reorder the plugins list after evaluation but prior to task execution when the plugins are installed.
// See https://github.com/opensearch-project/anomaly-detection/blob/fd547014fdde5114bbc9c8e49fe7aaa37eb6e793/build.gradle#L400-L422
nodes.each { node ->
def plugins = node.plugins
def firstPlugin = plugins.get(0)
plugins.remove(0)
plugins.add(firstPlugin)
}
}

testClusters.yamlRestTest {
plugin(provider(new Callable<RegularFile>(){
@Override
RegularFile call() throws Exception {
return new RegularFile() {
@Override
File getAsFile() {
return configurations.zipArchive.asFileTree.getSingleFile()
}
}
}
}))
}

run {
Expand Down Expand Up @@ -261,7 +312,7 @@ spotless {
}

jacocoTestReport {
dependsOn integTest, test, yamlRestTest
dependsOn test
reports {
xml.enabled = true
html.enabled = true
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
5 changes: 5 additions & 0 deletions lombok.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# tell lombok this is your root directory
config.stopBubbling = true
# add @lombok.Generated annotations to all generated nodes where possible
# to skip code coverage for auto generated code
lombok.addLombokGeneratedAnnotation = true
10 changes: 10 additions & 0 deletions release-notes/opensearch-geospatial.release-notes-2.8.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Version 2.8.0.0 Release Notes

Compatible with OpenSearch 2.8.0

### Infrastructure
* Make jacoco report to be generated faster in local ([#267](https://github.com/opensearch-project/geospatial/pull/267))
* Exclude lombok generated code from jacoco coverage report ([#268](https://github.com/opensearch-project/geospatial/pull/268))

### Maintenance
* Change package for Strings.hasText ([#314](https://github.com/opensearch-project/geospatial/pull/314))
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Version 2.9.0.0 Release Notes

Compatible with OpenSearch 2.9.0

### Maintenance
Increment version to 2.9.0-SNAPSHOT ([#329](https://github.com/opensearch-project/geospatial/pull/329))

### Refactoring
Change package for Strings.hasText ([#314](https://github.com/opensearch-project/geospatial/pull/314))
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
import java.util.Map;
import java.util.Objects;

import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.xcontent.XContentHelper;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.core.common.bytes.BytesReference;
import org.opensearch.geospatial.geojson.Feature;
import org.opensearch.geospatial.geojson.FeatureCollection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.opensearch.action.index.IndexRequestBuilder;
import org.opensearch.action.support.WriteRequest;
import org.opensearch.client.Client;
import org.opensearch.common.Strings;
import org.opensearch.core.common.Strings;
import org.opensearch.geospatial.GeospatialParser;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import org.opensearch.action.ingest.PutPipelineRequest;
import org.opensearch.client.ClusterAdminClient;
import org.opensearch.common.UUIDs;
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.xcontent.XContentFactory;
import org.opensearch.common.xcontent.XContentType;
import org.opensearch.core.common.bytes.BytesReference;
import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.geospatial.processor.FeatureProcessor;
import org.opensearch.ingest.Pipeline;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

import org.opensearch.action.ActionRequest;
import org.opensearch.action.ActionRequestValidationException;
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.core.common.bytes.BytesReference;
import org.opensearch.core.common.io.stream.StreamInput;
import org.opensearch.core.common.io.stream.StreamOutput;
import org.opensearch.rest.RestRequest;

@AllArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import lombok.AccessLevel;
import lombok.AllArgsConstructor;

import org.opensearch.common.Strings;
import org.opensearch.core.ParseField;
import org.opensearch.core.common.Strings;
import org.opensearch.geospatial.GeospatialParser;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import org.opensearch.action.ActionResponse;
import org.opensearch.action.bulk.BulkItemResponse;
import org.opensearch.action.bulk.BulkResponse;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.core.common.io.stream.StreamInput;
import org.opensearch.core.common.io.stream.StreamOutput;
import org.opensearch.core.xcontent.ToXContentObject;
import org.opensearch.core.xcontent.XContentBuilder;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/

package org.opensearch.geospatial.annotation;

public @interface VisibleForTesting {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.geospatial.constants;

/**
* Collection of keys for index setting
*/
public class IndexSetting {

Check warning on line 11 in src/main/java/org/opensearch/geospatial/constants/IndexSetting.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/opensearch/geospatial/constants/IndexSetting.java#L11

Added line #L11 was not covered by tests
public static final String NUMBER_OF_SHARDS = "index.number_of_shards";
public static final String NUMBER_OF_REPLICAS = "index.number_of_replicas";
public static final String REFRESH_INTERVAL = "index.refresh_interval";
public static final String AUTO_EXPAND_REPLICAS = "index.auto_expand_replicas";
public static final String HIDDEN = "index.hidden";
public static final String BLOCKS_WRITE = "index.blocks.write";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.geospatial.exceptions;

import java.io.IOException;

import org.opensearch.OpenSearchException;
import org.opensearch.core.common.io.stream.StreamInput;
import org.opensearch.core.rest.RestStatus;

/**
* General ConcurrentModificationException corresponding to the {@link RestStatus#BAD_REQUEST} status code
*
* The exception is thrown when multiple mutation API is called for a same resource at the same time
*/
public class ConcurrentModificationException extends OpenSearchException {

public ConcurrentModificationException(String msg, Object... args) {
super(msg, args);
}

public ConcurrentModificationException(String msg, Throwable cause, Object... args) {
super(msg, cause, args);
}

public ConcurrentModificationException(StreamInput in) throws IOException {
super(in);
}

@Override
public final RestStatus status() {
return RestStatus.BAD_REQUEST;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

package org.opensearch.geospatial.exceptions;

import java.io.IOException;

import org.opensearch.OpenSearchException;
import org.opensearch.core.common.io.stream.StreamInput;
import org.opensearch.core.rest.RestStatus;

/**
* IncompatibleDatasourceException corresponding to the {@link RestStatus#BAD_REQUEST} status code
*
* The exception is thrown when a user tries to update datasource with new endpoint which is not compatible
* with current datasource
*/
public class IncompatibleDatasourceException extends OpenSearchException {

public IncompatibleDatasourceException(String msg, Object... args) {
super(msg, args);
}

public IncompatibleDatasourceException(String msg, Throwable cause, Object... args) {
super(msg, cause, args);
}

public IncompatibleDatasourceException(StreamInput in) throws IOException {
super(in);
}

@Override
public final RestStatus status() {
return RestStatus.BAD_REQUEST;
}
}
Loading
Loading