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

Deprecate the "Master" nomenclature in nodejs client #221

Closed
ananzh opened this issue Apr 21, 2022 · 2 comments · Fixed by #222
Closed

Deprecate the "Master" nomenclature in nodejs client #221

ananzh opened this issue Apr 21, 2022 · 2 comments · Fixed by #222
Assignees
Labels

Comments

@ananzh
Copy link
Member

ananzh commented Apr 21, 2022

Is your feature request related to a problem? Please describe.
Coming from opensearch-project/OpenSearch#2589.

OpenSearch repository is going to replace the terminology "master"with "cluster manager".
issue: opensearch-project/OpenSearch#472 (comment), with the plan for its terminology replacement.

Although the existing usages with "master" will be supported in OpenSearch version 2.x to keep the backwards compatibility, please prepare for the nomenclature change in advance, and replace all the usages with "master" terminology in the code base.
All the OpenSearch REST APIs and settings that contain "master" terminology will be deprecated in 2.0, and alternative usages will be added.

Describe the solution you'd like
Replace the terminology "master" with "cluster manager".

When being compatible with OpenSearch 2.0:

Replace "master" in code comment and internal variable / function name
Replace OpenSearch REST API that contains "master" with the provided inclusive REST API
Replace "master" in documentation
Specifically, for the impacted OpenSearch REST API:
Replace the API request parameter "master_timeout" with "cluster_manager_timeout" in:
https://github.com/opensearch-project/OpenSearch-Dashboards/tree/1.3.1/src/plugins/console/server/lib/spec_definitions/json/generated and
https://github.com/opensearch-project/OpenSearch-Dashboards/tree/1.3.1/packages/osd-spec-to-console/test/fixtures

@ananzh ananzh added the 2.0 label Apr 21, 2022
@ananzh
Copy link
Member Author

ananzh commented Apr 21, 2022

Affected API

Multiple APIs are affected directly/indirectly (params & types)

  • Cat API is affected directly. Cat API can be used to cat master node
    index.d.ts:

    master<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.CatMaster, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>

    new.d.ts:
    master<TContext = unknown>(params?: T.CatMasterRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.CatMasterResponse, TContext>>

    master<TContext = unknown>(params: T.CatMasterRequest, options: TransportRequestOptions, callback: callbackFn<T.CatMasterResponse, TContext>): TransportRequestCallback

    opensearch_dashboards.d.ts:
    master<TContext = unknown>(params?: T.CatMasterRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.CatMasterResponse, TContext>>

  • API params definitions are affected which indirectly affect APIs
    There are many requestParams containing master_timeout, for example for Cat API params:
    Interface CatAllocation:

    master_timeout?: string;

    Interface CatIndices
    master_timeout?: string;

    Interface CatMaster
    master_timeout?: string;

    Below is a complete list (Cat API, Cluster API, Dangling API, Indices API and etc) :

Interface CatAllocation
Interface CatIndices
Interface CatMaster
Interface CatNodeattrs
Interface CatNodes
Interface CatPendingTasks
Interface CatPlugins
Interface CatRepositories
Interface CatShards
Interface CatSnapshots
Interface CatTemplates
Interface CatThreadPool
Interface ClusterDeleteComponentTemplate
interface ClusterGetComponentTemplate
interface ClusterGetSettings
interface ClusterGetSettings
interface ClusterHealth
interface ClusterPendingTasks
interface ClusterPutComponentTemplate
interface ClusterPutSettings
interface ClusterReroute
interface ClusterState
interface DanglingIndicesDeleteDanglingIndex
interface DeleteScript
interface FeaturesGetFeatures
interface GetScript
interface IndicesAddBlock
interface IndicesClone
interface IndicesClose
interface IndicesCreate
interface IndicesDelete
interface IndicesDeleteAlias
interface IndicesDeleteIndexTemplate
interface IndicesDeleteTemplate
interface IndicesExistsIndexTemplate
interface IndicesExistsTemplate
interface IndicesGet
interface IndicesGetIndexTemplate
interface IndicesGetMapping
interface IndicesGetSettings
interface IndicesGetTemplate
interface IndicesOpen
interface IndicesPutAlias
interface IndicesPutIndexTemplate
interface IndicesPutMapping
interface IndicesPutSettings
interface IndicesPutTemplate
interface IndicesRollover
interface IndicesShrink
interface IndicesSimulateIndexTemplate
interface IndicesSimulateTemplate
interface IndicesSplit
interface IndicesUpdateAliases
interface IngestDeletePipeline
interface IngestGetPipeline
interface IngestPutPipeline
interface PutScript
interface SnapshotCleanupRepository
interface SnapshotClone
interface SnapshotCreate
interface SnapshotCreateRepository
interface SnapshotDelete
interface SnapshotDeleteRepository
interface SnapshotGet
interface SnapshotGetRepository
interface SnapshotRestore
interface SnapshotStatus
interface SnapshotVerifyRepository
  • Types used in APIs containing keys master, master_timeout, master_node, initial_master_nodes? or has master in the name (interface CatMasterMasterRecord, interface CatMasterRequest, type CatMasterResponse). Below is the complete list:
interface DeleteScriptRequest
interface GetScriptRequest
interface PutScriptRequest
interface ClusterDeleteComponentTemplateRequest
interface ClusterGetComponentTemplateRequest
interface ClusterGetSettingsRequest
interface ClusterHealthRequest
interface ClusterPendingTasksRequest
interface ClusterPutComponentTemplateRequest
interface ClusterPutSettingsRequest
interface ClusterRerouteRequest
interface ClusterStateRequest
interface IndicesAddBlockRequest
interface IndicesCloneRequest
interface IndicesCloseRequest
interface IndicesCreateRequest
interface IndicesDeleteRequest
interface IndicesDeleteAliasRequest
interface IndicesDeleteTemplateRequest
interface IndicesExistsIndexTemplateRequest
interface IndicesExistsTemplateRequest
interface IndicesGetRequest
interface IndicesGetIndexTemplateRequest
interface IndicesGetMappingRequest
interface IndicesGetSettingsRequest
interface IndicesGetTemplateRequest
interface IndicesOpenRequest
interface IndicesPutAliasRequest
interface IndicesPutMappingRequest
interface IndicesPutSettingsRequest
interface IndicesPutTemplateRequest
interface IndicesRolloverRequest
interface IndicesShrinkRequest
interface IndicesSimulateTemplateRequest
interface IndicesSplitRequest 
interface IndicesUpdateAliasesRequest
interface IngestDeletePipelineRequest
interface IngestGetPipelineRequest
interface IngestPutPipelineRequest
interface NodesInfoRequest
interface NodesStatsRequest
interface SnapshotCleanupRepositoryRequest
interface SnapshotCloneRequest
interface SnapshotCreateRequest
interface SnapshotCreateRepositoryRequest
interface SnapshotDeleteRequest
interface SnapshotDeleteRepositoryRequest
interface SnapshotGetRequest
interface SnapshotGetRepositoryRequest
interface SnapshotRestoreRequest
interface SnapshotStatusRequest
interface SnapshotVerifyRepositoryRequest
interface SpecUtilsCommonCatQueryParameters
interface ClusterRerouteRerouteState
interface ClusterStateResponse
interface NodesInfoNodeInfoSettingsCluster
interface CatNodesNodesRecord
interface ClusterStatsClusterNodeCount
interface CatMasterMasterRecord
interface CatMasterRequest
type CatMasterResponse
  • Contains master in variable definition and affect other functions
const acceptedQuerystring = [ …, ‘master_timeout’, …]
snakeCase key and value:
const snakeCase = {…,  masterTimeout: 'master_timeout’, …}

const acceptedQuerystring = ['format', 'local', 'h', 'help', 's', 'v', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'bytes', 'master_timeout', 'fields', 'time', 'ts', 'health', 'pri', 'include_unloaded_segments', 'allow_no_match', 'allow_no_datafeeds', 'allow_no_jobs', 'from', 'size', 'full_id', 'include_bootstrap', 'active_only', 'detailed', 'index', 'ignore_unavailable', 'nodes', 'actions', 'parent_task_id']

const snakeCase = { expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', masterTimeout: 'master_timeout', includeUnloadedSegments: 'include_unloaded_segments', allowNoMatch: 'allow_no_match', allowNoDatafeeds: 'allow_no_datafeeds', allowNoJobs: 'allow_no_jobs', fullId: 'full_id', includeBootstrap: 'include_bootstrap', activeOnly: 'active_only', ignoreUnavailable: 'ignore_unavailable', parentTaskId: 'parent_task_id' }

Here is a complete list:

api/api/cat.js
api/api/cluster.js
api/api/dangling_indices.js
api/api/delete_script.js
api/api/features.js
api/api/get_script.js
api/api/indices.js
api/api/ingest.js
api/api/put_script.js
api/api/snapshot.js

@ananzh
Copy link
Member Author

ananzh commented Apr 21, 2022

Affected Tests
*MASTER/master key in Connect roles or cluster node roles, for example:

roles: ['master', 'data', 'ingest']

roles: { master: true },

*Affect Mock

roles: ['master', 'data', 'ingest']

roles: ['master', 'data', 'ingest']

Test list:

test/types/connection.test-d.ts
test/unit/Base-connection-pool.test.js
test/unit/Client.test.js
test/unit/Connection-pool.test.js
test/unit/Connection.test.js
test/utils/buildCluster.js
test/utils/MockConnection.js
test/acceptance/sniff.test.js

Others
*comments

* let's say the we have stashed the `master` value,

* is_true: nodes.$master.transport.profiles

* By default it filters the `master` only nodes.

* By default it filters the `master` only nodes.

// avoid master only nodes

*data
Might need to change test data in stackoverflow.ndjson, for example:
https://github.com/opensearch-project/opensearch-js/blob/c56751acae73f4735bf7efa3ddf1abc378c2e1a6/test/fixtures/stackoverflow.ndjson#L603

ananzh added a commit to ananzh/opensearch-js-1 that referenced this issue Apr 21, 2022
1.Deprecate setting cluster.initial_master_nodes and introduce
the alternative setting cluster.initial_cluster_manager_nodes.
2.Use a new node role cluster_manager that has the same functionality
with master in the node setting node.roles: [ master ]
3.Cat API _cat/master is replaced with _cat/cluster_manager
4.Deprecate master_timeout parameter to cluster_manager_timeout
5.Deprecate several interfaces, for example CatMasterMasterRecord
6.Replaces tests and comments

Issue Resolved:
opensearch-project#221

Signed-off-by: Anan Zhuang <[email protected]>
ananzh added a commit to ananzh/opensearch-js-1 that referenced this issue Apr 21, 2022
1.Deprecate setting cluster.initial_master_nodes and introduce
the alternative setting cluster.initial_cluster_manager_nodes.
2.Use a new node role cluster_manager that has the same functionality
with master in the node setting node.roles: [ master ]
3.Cat API _cat/master is replaced with _cat/cluster_manager
4.Deprecate master_timeout parameter to cluster_manager_timeout
5.Deprecate several interfaces, for example CatMasterMasterRecord
6.Replaces tests and comments

Issue Resolved:
opensearch-project#221

Signed-off-by: Anan Zhuang <[email protected]>
ananzh added a commit to ananzh/opensearch-js-1 that referenced this issue Apr 26, 2022
1.Deprecate setting cluster.initial_master_nodes and introduce
the alternative setting cluster.initial_cluster_manager_nodes.
2.Use a new node role cluster_manager that has the same functionality
with master in the node setting node.roles: [ master ]
3.Cat API _cat/master is deprecated with _cat/cluster_manager
4.Deprecate master_timeout parameter to cluster_manager_timeout
5.Deprecate several interfaces, for example CatMasterMasterRecord
6.Replaces tests and comments

Issue Resolved:
opensearch-project#221

Signed-off-by: Anan Zhuang <[email protected]>
ananzh added a commit to ananzh/opensearch-js-1 that referenced this issue Apr 27, 2022
1.Deprecate setting cluster.initial_master_nodes and introduce
the alternative setting cluster.initial_cluster_manager_nodes.
2.Use a new node role cluster_manager that has the same functionality
with master in the node setting node.roles: [ master ]
3.Cat API _cat/master is deprecated with _cat/cluster_manager
4.Deprecate master_timeout parameter to cluster_manager_timeout
5.Deprecate several interfaces, for example CatMasterMasterRecord
6.Replaces tests and comments

fix lint issue

Issue Resolved:
opensearch-project#221

Signed-off-by: Anan Zhuang <[email protected]>
ananzh added a commit to ananzh/opensearch-js-1 that referenced this issue May 4, 2022
1.Deprecate setting cluster.initial_master_nodes and introduce
the alternative setting cluster.initial_cluster_manager_nodes.
2.Use a new node role cluster_manager that has the same functionality
with master in the node setting node.roles: [ master ]
3.Cat API _cat/master is deprecated with _cat/cluster_manager
4.Deprecate master_timeout parameter to cluster_manager_timeout
5.Deprecate several interfaces, for example CatMasterMasterRecord
6.Replaces tests and comments

fix lint issue

Issue Resolved:
opensearch-project#221

Signed-off-by: Anan Zhuang <[email protected]>

add some comments and toDos for master deprecation

Signed-off-by: Anan Zhuang <[email protected]>
ananzh added a commit to ananzh/opensearch-js-1 that referenced this issue May 12, 2022
1.Deprecate setting cluster.initial_master_nodes and introduce
the alternative setting cluster.initial_cluster_manager_nodes.
2.Use a new node role cluster_manager that has the same functionality
with master in the node setting node.roles: [ master ]
3.Cat API _cat/master is deprecated with _cat/cluster_manager
4.Deprecate master_timeout parameter to cluster_manager_timeout
5.Deprecate several interfaces, for example CatMasterMasterRecord
6.Replaces tests and comments

fix lint issue

Issue Resolved:
opensearch-project#221

Signed-off-by: Anan Zhuang <[email protected]>

add some comments and toDos for master deprecation

Signed-off-by: Anan Zhuang <[email protected]>

update TODO and use JSDoc

Signed-off-by: Anan Zhuang <[email protected]>
ananzh added a commit to ananzh/opensearch-js-1 that referenced this issue May 12, 2022
1.Deprecate setting cluster.initial_master_nodes and introduce
the alternative setting cluster.initial_cluster_manager_nodes.
2.Use a new node role cluster_manager that has the same functionality
with master in the node setting node.roles: [ master ]
3.Cat API _cat/master is deprecated with _cat/cluster_manager
4.Deprecate master_timeout parameter to cluster_manager_timeout
5.Deprecate several interfaces, for example CatMasterMasterRecord
6.Replaces tests and comments

fix lint issue

Issue Resolved:
opensearch-project#221

Signed-off-by: Anan Zhuang <[email protected]>

add some comments and toDos for master deprecation

Signed-off-by: Anan Zhuang <[email protected]>

update TODO and use JSDoc

Signed-off-by: Anan Zhuang <[email protected]>
ananzh added a commit to ananzh/opensearch-js-1 that referenced this issue May 24, 2022
1.Deprecate setting cluster.initial_master_nodes and introduce
the alternative setting cluster.initial_cluster_manager_nodes.
2.Use a new node role cluster_manager that has the same functionality
with master in the node setting node.roles: [ master ]
3.Cat API _cat/master is deprecated with _cat/cluster_manager
4.Deprecate master_timeout parameter to cluster_manager_timeout
5.Deprecate several interfaces, for example CatMasterMasterRecord
6.Replaces tests and comments

Issue Resolved:
opensearch-project#221

Signed-off-by: Anan Zhuang <[email protected]>

add some comments and toDos for master deprecation

Signed-off-by: Anan Zhuang <[email protected]>

update TODO and use JSDoc

Signed-off-by: Anan Zhuang <[email protected]>
@ananzh ananzh closed this as completed in e008fe8 May 25, 2022
@kavilla kavilla linked a pull request May 26, 2022 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant