[MCOL-4898] cmapi not respect custom mariadb port for crossenginesupport from Columnstore.xml Created: 2021-10-15  Updated: 2022-10-25  Resolved: 2022-02-15

Status: Closed
Project: MariaDB ColumnStore
Component/s: cmapi
Affects Version/s: cmapi-1.5, cmapi-1.6
Fix Version/s: cmapi-1.6.2

Type: New Feature Priority: Major
Reporter: Richard Stracke Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 1
Labels: None

Issue Links:
PartOf
is part of MCOL-4850 Refactor CMAPI to meet PEP-8 styleguide Stalled
Sprint: 2021-17

 Description   

Given the following config

 
*******************************
<CrossEngineSupport>
<Host>127.0.0.1</Host>
<Port>3307</Port>
<User>cross_engine</User>
<Password>xxxxxxxx</Password>
**************************

The sourcecode from cmapi reveals:

 
node_config = NodeConfig()
    root = node_config.get_current_config_root()
    ces_node = root.find("./CrossEngineSupport")
    username = ces_node.find("./User").text
    password = ces_node.find("./Password").text
 
 
 cmd = (f"/usr/bin/mariadb -h 127.0.0.1 -u '{username}' --password='{password}' -sN -e \
            \"SELECT COUNT(1) AS slave_threads FROM information_schema.PROCESSLIST WHERE USER = 'system user' AND COMMAND LIKE 'Slave%';\"")

So Port will neither not be read from Columnstore.xml nor used in the mariadb commandline



 Comments   
Comment by Daniel Lee (Inactive) [ 2022-02-07 ]

Build tested: 6.2.3-1 CMAPI-1.6 (Build 600)

Verified that, with the fix, "is_primary" value is returned correct.

Issue reproduction
------------------
With MCS 6.2.2 and CMAPI 1.5, I did not see the error messages in the cmapi_server.log. But the returned values was indeed incorrect.

With port 12345, return value was null. A value of true of false should be returned

[centos8:root~]# curl https://127.0.0.1:8640/cmapi/0.4.0/node/new_primary --header 'Content-Type:application/json' --header 'x-api-key:somekey123' -k | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    20  100    20    0     0    869      0 --:--:-- --:--:-- --:--:--   869
{
  "is_primary": null
}

cmapi_server.log entry

[07/Feb/2022 19:50:47] root  get_module_net_address Module 1 network address 127.0.0.1
[07/Feb/2022 19:50:47] cmapi_server get_new_primary returns {'is_primary': None}
[07/Feb/2022 19:50:47] cherrypy.access.139915931324304 127.0.0.1 - - [07/Feb/2022:19:50:47] "GET /cmapi/0.4.0/node/new_primary HTTP/1.1" 200 20 "" "curl/7.61.1"

Generated at Thu Feb 08 02:53:50 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.