Elasticsearch versioned schema for Snippet
The CE port is at: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31465
What does this MR do?
Allows multiple versioned elasticsearch instances/schemas to work in the same code base.
This MR is a proof of concept/foundation change focusing on Snippet
. The search related logic from SnippetSearch
module to V12p1::SnippetClassProxy
and V12p1::SnippetInstanceProxy
.
The following diagram represents a comparison of the old (top) and the new approach (bottom). Grey text represents elasticsearch-rails classes.
Now, a call to model.__elasticsearch__.foo
would be forwarded to:
- one applicable version, if foo is a read method
- multiple applicable versions, if foo is a write method
We can also call model.__elasticsearch__.version('V12p1').foo
to trigger the method in the particular version of proxy.
Currently the versions are hardcoded to the latest version though. We need to create a table to record the versions. I've left this to another issue. The table would consist of the following fields:
- version (e.g. 'V12p1')
- read (boolean which can only be one)
- write (boolean which can be many)
- port (integer of the port the version should be connected to)
After this other ActiveModels can be migrated in a similar fashion.
Note that PersonalSnippet indexing does not work prior to this: https://gitlab.com/gitlab-org/gitlab-ee/issues/11328
Related to #328 (closed)
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
- [-] Documentation created/updated or follow-up review issue created
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Performance and testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.