Skip to content

Commit 54af510

Browse files
committed
Skip shard routing tests on OpenSearch < 2.2.0 with security
OpenSearch < 2.2.0 with the security plugin throws java.io.OptionalDataException on shard-routed requests due to non-thread-safe HashSet/HashMap in User serialization. Fixed in 2.2.0 by opensearch-project/security#1970 (50a94b47). Widen the existing 2.1.0-only skip to cover all versions below 2.2.0. Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
1 parent 9cb9fbc commit 54af510

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

opensearchtransport/operation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ const OpPing = CatPing | minPing
616616
// String
617617
// ---------------------------------------------------------------------------
618618

619-
//nolint:cyclop,gocyclo,exhaustive,goconst // intentional large switch with default fallback
619+
//nolint:cyclop,gocyclo,exhaustive // intentional large switch with default fallback
620620
func (op OperationID) String() string {
621621
switch op {
622622
// Search

opensearchtransport/policy_pool_router.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ func (p *poolRouter) Eval(ctx context.Context, req *http.Request) (NextHop, erro
238238
// data nodes) when available. Falls back to the selected connection's
239239
// per-node cwnd before the first poll cycle completes.
240240
var adaptiveMCSR int
241-
if p.poolName == "search" && best != nil {
241+
if p.poolName == RoleSearch && best != nil {
242242
cwnd := loadClusterSearchCwnd(p.clusterSearchCwnd)
243243
if cwnd <= 0 {
244244
cwnd = best.loadCwnd(p.poolName, loadPoolInfoReady(p.poolInfoReady))
@@ -391,13 +391,13 @@ func (p *poolRouter) configurePolicySettings(config policyConfig) error {
391391

392392
// Register the MCSR metric callback for the search pool so that
393393
// ConnectionMetric snapshots include the current per-node value.
394-
if p.poolName == "search" && config.metrics != nil && p.cache.features.adaptiveConcurrencyEnabled() {
394+
if p.poolName == RoleSearch && config.metrics != nil && p.cache.features.adaptiveConcurrencyEnabled() {
395395
cache := p.cache
396396
poolInfoReady := p.poolInfoReady
397397
config.metrics.connMetricCallbacks = append(config.metrics.connMetricCallbacks,
398398
func(conns []*Connection, cms []ConnectionMetric) error {
399399
for i, conn := range conns {
400-
cwnd := conn.loadCwnd("search", loadPoolInfoReady(poolInfoReady))
400+
cwnd := conn.loadCwnd(RoleSearch, loadPoolInfoReady(poolInfoReady))
401401
mcsr := computeAdaptiveConcurrency(cwnd, cache.adaptiveConcurrency, cache.features)
402402
cms[i].MCSR = &mcsr
403403
}

opensearchtransport/shard_routing_integration_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,12 @@ func (s *ShardRoutingSuite) SetupSuite() {
7878
testutil.WaitForCluster(t)
7979
testutil.RequireMinNodes(t, 2) // 1 replica requires at least 2 nodes for green health
8080

81-
// OpenSearch 2.1.0 with the security plugin returns HTTP 500 on search
82-
// requests routed to specific shard-hosting nodes.
81+
// OpenSearch < 2.2.0 with the security plugin returns HTTP 500 on
82+
// shard-routed requests due to non-thread-safe User serialization
83+
// (java.io.OptionalDataException). Fixed in 2.2.0 by
84+
// opensearch-project/security#1970 (50a94b47).
8385
if testutil.IsSecure(t) {
84-
testutil.SkipIfVersion(t, "=", "2.1.0", "shard-exact pipeline (security plugin HTTP 500)")
86+
testutil.SkipIfVersion(t, "<", "2.2.0", "shard-exact pipeline (security plugin OptionalDataException)")
8587
}
8688

8789
s.ctx, s.cancel = context.WithTimeout(t.Context(), 120*time.Second)

0 commit comments

Comments
 (0)