What does this MR do?
This is a fix for a change behind a feature flag elasticsearch_use_routing
. Introduced in !22261 (merged)
While working on #196569 (comment 281186673) we met an unexpected exception https://sentry.gitlab.net/gitlab/staginggitlabcom/issues/1216820/?referrer=slack
[400] {"error":{"root_cause":[{"type":"too_long_frame_exception","reason":"An HTTP line is larger than 4096 bytes."}],"type":"too_long_frame_exception","reason":"An HTTP line is larger than 4096 bytes."},"status":400}
I'm still waiting for rails c
access on staging, so my guess is that we push too many project_ids to routing and http URI becomes too long resulting in the ES transport exception.
http://localhost:9200/gitlab-development/doc/_search?from=0&routing=project_1,project_2,project_3,project_4,...
This MR sets a limit to prevent this kind of errors.
Calculation of a new limit
The worst possible case:
- each project_id is 10 digit long (close to the max 4-byte integer size >=
2,000,000,000
)
That way we have 19 bytes per project_id ("project_2147483647,".length => 19
)
We want to make room for schema, login-password, path. Let's say we over reserve 512 bytes, we have 4096-512=3584 bytes left.
3584/19 = 188 project_ids. Let's round it to the closest power of 2 - 128.
Screenshots
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides - [-] Database guides
-
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. - [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team