Skip to content

Commit ad45900

Browse files
authored
Merge branch 'main' into snapshot_rate_dynamic3
Signed-off-by: kkewwei <[email protected]>
2 parents 9c61127 + d04e2f9 commit ad45900

File tree

9 files changed

+106
-12
lines changed

9 files changed

+106
-12
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Trigger manifest generation workflow
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- buildSrc/version.properties
8+
9+
jobs:
10+
trigger-manifest-workflow:
11+
if: github.repository == 'opensearch-project/OpenSearch'
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Trigger manifest-update workflow
15+
run: |
16+
echo "Triggering manifest-update workflow at https://build.ci.opensearch.org/job/manifest-update/"
17+
curl -f -X POST https://build.ci.opensearch.org/job/manifest-update/build --user ${{ secrets.JENKINS_GITHUB_USER}}:${{ secrets.JENKINS_GITHUB_USER_TOKEN}}

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1818

1919
### Changed
2020
- Update Subject interface to use CheckedRunnable ([#18570](https://github.com/opensearch-project/OpenSearch/issues/18570))
21+
- Update SecureAuxTransportSettingsProvider to distinguish between aux transport types ([#18616](https://github.com/opensearch-project/OpenSearch/pull/18616))
2122
- Making multi rate limiters in repository dynamic [#18069](https://github.com/opensearch-project/OpenSearch/pull/18069)
2223

2324
### Dependencies
@@ -26,6 +27,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2627
- Bump `org.apache.logging.log4j:log4j-core` from 2.24.3 to 2.25.0 ([#18589](https://github.com/opensearch-project/OpenSearch/pull/18589))
2728
- Bump `com.google.code.gson:gson` from 2.13.0 to 2.13.1 ([#18585](https://github.com/opensearch-project/OpenSearch/pull/18585))
2829
- Bump `com.azure:azure-core-http-netty` from 1.15.11 to 1.15.12 ([#18586](https://github.com/opensearch-project/OpenSearch/pull/18586))
30+
- Bump `com.squareup.okio:okio` from 3.13.0 to 3.14.0 ([#18645](https://github.com/opensearch-project/OpenSearch/pull/18645))
2931

3032
### Deprecated
3133

@@ -34,11 +36,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3436
### Fixed
3537
- Add task cancellation checks in aggregators ([#18426](https://github.com/opensearch-project/OpenSearch/pull/18426))
3638
- Fix concurrent timings in profiler ([#18540](https://github.com/opensearch-project/OpenSearch/pull/18540))
39+
- Fix regex query from query string query to work with field alias ([#18215](https://github.com/opensearch-project/OpenSearch/issues/18215))
3740
- [Autotagging] Fix delete rule event consumption in InMemoryRuleProcessingService ([#18628](https://github.com/opensearch-project/OpenSearch/pull/18628))
3841
- Cannot communicate with HTTP/2 when reactor-netty is enabled ([#18599](https://github.com/opensearch-project/OpenSearch/pull/18599))
3942
- Fix the visit of sub queries for HasParentQuery and HasChildQuery ([#18621](https://github.com/opensearch-project/OpenSearch/pull/18621))
4043

41-
4244
### Security
4345

4446
[Unreleased 3.x]: https://github.com/opensearch-project/OpenSearch/compare/3.1...main

plugins/transport-grpc/src/main/java/org/opensearch/plugin/transport/grpc/ssl/SecureNetty4GrpcServerTransport.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,16 @@ public String settingKey() {
106106
* @param provider for SSLContext and SecureAuxTransportParameters (ClientAuth and enabled ciphers).
107107
*/
108108
private JdkSslContext getSslContext(Settings settings, SecureAuxTransportSettingsProvider provider) throws SSLException {
109-
Optional<SSLContext> sslContext = provider.buildSecureAuxServerTransportContext(settings, this);
109+
Optional<SSLContext> sslContext = provider.buildSecureAuxServerTransportContext(settings, this.settingKey());
110110
if (sslContext.isEmpty()) {
111111
try {
112112
sslContext = Optional.of(SSLContext.getDefault());
113113
} catch (NoSuchAlgorithmException e) {
114114
throw new SSLException("Failed to build default SSLContext for " + SecureNetty4GrpcServerTransport.class.getName(), e);
115115
}
116116
}
117-
SecureAuxTransportSettingsProvider.SecureAuxTransportParameters params = provider.parameters().orElseGet(DefaultParameters::new);
117+
SecureAuxTransportSettingsProvider.SecureAuxTransportParameters params = provider.parameters(settings, this.settingKey())
118+
.orElseGet(DefaultParameters::new);
118119
ClientAuth clientAuth = ClientAuth.valueOf(params.clientAuth().orElseThrow().toUpperCase(Locale.ROOT));
119120
return new JdkSslContext(
120121
sslContext.get(),

plugins/transport-grpc/src/test/java/org/opensearch/plugin/transport/grpc/ssl/SecureSettingsHelpers.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import org.opensearch.common.settings.Settings;
1212
import org.opensearch.plugins.SecureAuxTransportSettingsProvider;
13-
import org.opensearch.transport.AuxTransport;
1413

1514
import javax.net.ssl.KeyManagerFactory;
1615
import javax.net.ssl.SSLContext;
@@ -110,7 +109,7 @@ static SecureAuxTransportSettingsProvider getSecureSettingsProvider(
110109
) {
111110
return new SecureAuxTransportSettingsProvider() {
112111
@Override
113-
public Optional<SSLContext> buildSecureAuxServerTransportContext(Settings settings, AuxTransport transport)
112+
public Optional<SSLContext> buildSecureAuxServerTransportContext(Settings settings, String auxTransportType)
114113
throws SSLException {
115114
// Choose a random protocol from among supported test defaults
116115
String protocol = randomFrom(DEFAULT_SSL_PROTOCOLS);
@@ -126,7 +125,7 @@ public Optional<SSLContext> buildSecureAuxServerTransportContext(Settings settin
126125
}
127126

128127
@Override
129-
public Optional<SecureAuxTransportParameters> parameters() {
128+
public Optional<SecureAuxTransportParameters> parameters(Settings settings, String auxTransportType) {
130129
return Optional.of(new SecureAuxTransportParameters() {
131130
@Override
132131
public Optional<String> clientAuth() {
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
setup:
2+
- skip:
3+
version: " - 3.1.99"
4+
reason: "regex query over field alias support starts 3.2"
5+
6+
- do:
7+
indices.create:
8+
index: test_index
9+
body:
10+
settings:
11+
number_of_shards: 1
12+
number_of_replicas: 0
13+
mappings:
14+
properties:
15+
test:
16+
type: text
17+
test_alias:
18+
type: alias
19+
path: test
20+
21+
- do:
22+
bulk:
23+
refresh: true
24+
body: |
25+
{"index":{"_index":"test_index","_id":"1"}}
26+
{"test":"hello"}
27+
{"index":{"_index":"test_index","_id":"2"}}
28+
{"test":"world"}
29+
30+
---
31+
"regex search on normal field":
32+
- do:
33+
search:
34+
rest_total_hits_as_int: true
35+
index: test_index
36+
body:
37+
query:
38+
query_string:
39+
query: "test: /h[a-z].*/"
40+
41+
- match: {hits.total: 1}
42+
- match: {hits.hits.0._id: "1"}
43+
44+
---
45+
"regex search on alias field":
46+
- do:
47+
search:
48+
rest_total_hits_as_int: true
49+
index: test_index
50+
body:
51+
query:
52+
query_string:
53+
query: "test_alias: /h[a-z].*/"
54+
55+
- match: {hits.total: 1}
56+
- match: {hits.hits.0._id: "1"}

server/src/main/java/org/opensearch/index/search/QueryStringQueryParser.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import org.apache.lucene.search.SynonymQuery;
5757
import org.apache.lucene.search.WildcardQuery;
5858
import org.apache.lucene.util.BytesRef;
59+
import org.apache.lucene.util.automaton.RegExp;
5960
import org.opensearch.common.lucene.search.Queries;
6061
import org.opensearch.common.regex.Regex;
6162
import org.opensearch.common.unit.Fuzziness;
@@ -787,8 +788,12 @@ private Query getRegexpQuerySingle(String field, String termStr) throws ParseExc
787788
if (currentFieldType == null) {
788789
return newUnmappedFieldQuery(field);
789790
}
790-
setAnalyzer(getSearchAnalyzer(currentFieldType));
791-
return super.getRegexpQuery(field, termStr);
791+
if (forceAnalyzer != null) {
792+
setAnalyzer(forceAnalyzer);
793+
}
794+
// query string query normalizes search value
795+
termStr = getAnalyzer().normalize(currentFieldType.name(), termStr).utf8ToString();
796+
return currentFieldType.regexpQuery(termStr, RegExp.ALL, 0, getDeterminizeWorkLimit(), getMultiTermRewriteMethod(), context);
792797
} catch (RuntimeException e) {
793798
if (lenient) {
794799
return newLenientFieldQuery(field, e);

server/src/main/java/org/opensearch/plugins/SecureAuxTransportSettingsProvider.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import org.opensearch.common.annotation.ExperimentalApi;
1212
import org.opensearch.common.settings.Settings;
13-
import org.opensearch.transport.AuxTransport;
1413

1514
import javax.net.ssl.SSLContext;
1615
import javax.net.ssl.SSLException;
@@ -26,17 +25,22 @@
2625
public interface SecureAuxTransportSettingsProvider {
2726
/**
2827
* Fetch an SSLContext as managed by pluggable security provider.
28+
* @param settings for providing additional configuration options when building the ssl context.
29+
* @param auxTransportType key for enabling this transport with AUX_TRANSPORT_TYPES_SETTING.
2930
* @return an instance of SSLContext.
3031
*/
31-
default Optional<SSLContext> buildSecureAuxServerTransportContext(Settings settings, AuxTransport transport) throws SSLException {
32+
default Optional<SSLContext> buildSecureAuxServerTransportContext(Settings settings, String auxTransportType) throws SSLException {
3233
return Optional.empty();
3334
}
3435

3536
/**
3637
* Additional params required for configuring ALPN.
38+
* @param settings for providing additional configuration options when building secure params.
39+
* @param auxTransportType key for enabling this transport with AUX_TRANSPORT_TYPES_SETTING.
3740
* @return an instance of {@link SecureAuxTransportSettingsProvider.SecureAuxTransportParameters}
3841
*/
39-
default Optional<SecureAuxTransportSettingsProvider.SecureAuxTransportParameters> parameters() {
42+
default Optional<SecureAuxTransportSettingsProvider.SecureAuxTransportParameters> parameters(Settings settings, String auxTransportType)
43+
throws SSLException {
4044
return Optional.empty();
4145
}
4246

server/src/test/java/org/opensearch/index/query/QueryStringQueryBuilderTests.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,16 @@ public void testToQueryRegExpQuery() throws Exception {
786786
assertTrue(regexpQuery.toString().contains("/foo*bar/"));
787787
}
788788

789+
public void testRegexpQueryParserWithForceAnalyzer() throws Exception {
790+
QueryStringQueryParser queryParser = new QueryStringQueryParser(createShardContext(), TEXT_FIELD_NAME);
791+
queryParser.setForceAnalyzer(new org.apache.lucene.analysis.standard.StandardAnalyzer());
792+
Query query = queryParser.parse("/aBc.*/");
793+
assertThat(query, instanceOf(RegexpQuery.class));
794+
RegexpQuery regexpQuery = (RegexpQuery) query;
795+
// Standard analyzer normalizes to lowercase, verifying the normalization path with currentFieldType.name() is hit
796+
assertTrue(regexpQuery.toString().contains("abc.*"));
797+
}
798+
789799
public void testToQueryRegExpQueryTooComplex() throws Exception {
790800
QueryStringQueryBuilder queryBuilder = queryStringQuery("/[ac]*a[ac]{50,200}/").defaultField(TEXT_FIELD_NAME);
791801

test/fixtures/hdfs-fixture/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,6 @@ dependencies {
8888
runtimeOnly("com.squareup.okhttp3:okhttp:4.12.0") {
8989
exclude group: "com.squareup.okio"
9090
}
91-
runtimeOnly "com.squareup.okio:okio:3.13.0"
91+
runtimeOnly "com.squareup.okio:okio:3.14.0"
9292
runtimeOnly "org.xerial.snappy:snappy-java:1.1.10.7"
9393
}

0 commit comments

Comments
 (0)