From ec3386a1963017b777395f4e1f884dcc4bc76a5d Mon Sep 17 00:00:00 2001 From: currantw Date: Mon, 18 Nov 2024 12:14:56 -0800 Subject: [PATCH] Add clarifying comments. Signed-off-by: currantw --- src/sqlodbc/opensearch_communication.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/sqlodbc/opensearch_communication.cpp b/src/sqlodbc/opensearch_communication.cpp index 80c4440..b509dbb 100644 --- a/src/sqlodbc/opensearch_communication.cpp +++ b/src/sqlodbc/opensearch_communication.cpp @@ -572,10 +572,18 @@ bool OpenSearchCommunication::EstablishConnection() { InitializeConnection(); } + // Set whether the connection is to OpenSearch serverless cluster. + // This can be specified explicitly via a configuration option, or + // determined by parsing the server URL. SetIsServerless(); + + // Set the SQL endpoint to connect to. If this is a serverless connection, + // the SQL endpoint can be determined directly; if not, the endpoint is + // determined by sending a request to OpenSearch, which may result in an + // error. SetSqlEndpoint(); - if (sql_endpoint == SQL_ENDPOINT_ERROR) { + if (is_serverless && (sql_endpoint == SQL_ENDPOINT_ERROR)) { LogMsg(OPENSEARCH_ERROR, m_error_message.c_str()); return false; }