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

Added capability to choose Connection Pooling driver and specify it's configuration #265

Merged
merged 3 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [7.10.0] - 2024-06-26
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

7.2.0

### Added
- Added `hms_ro_datanucleus_connection_pooling_type`, `hms_rw_datanucleus_connection_pooling_type`, `hms_ro_datanucleus_connection_pool_config`, `hms_rw_datanucleus_connection_pool_config`, `hms_housekeeper_db_connection_pool_size` variables to allow specifying the pooling driver and its config

## [7.1.9] - 2024-06-20
### Fixed
- Housekeeper deployment should not use common `HADOOP_HEAPSIZE` variable since it is a low memory container.
Expand Down
11 changes: 11 additions & 0 deletions k8s-housekeeper.tf
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,17 @@ resource "kubernetes_deployment_v1" "apiary_hms_housekeeper" {
name = "ENABLE_HIVE_LOCK_HOUSE_KEEPER"
value = var.enable_hms_housekeeper ? "true" : ""
}

env {
name = "DATANUCLEUS_CONNECTION_POOLING_TYPE"
value = var.hms_rw_datanucleus_connection_pooling_type
patduin marked this conversation as resolved.
Show resolved Hide resolved
}

env {
name = "DATANUCLEUS_CONNECTION_POOL_MAX_POOLSIZE"
value = var.hms_housekeeper_db_connection_pool_size
}

dynamic "env" {
for_each = var.hms_housekeeper_additional_environment_variables

Expand Down
22 changes: 18 additions & 4 deletions k8s-readonly.tf
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,6 @@ resource "kubernetes_deployment_v1" "apiary_hms_readonly" {
name = "HMS_MAX_THREADS"
value = local.hms_ro_maxthreads
}
env {
name = "MYSQL_CONNECTION_POOL_SIZE"
value = var.hms_ro_db_connection_pool_size
}
env {
name = "HMS_AUTOGATHER_STATS"
value = "false"
Expand All @@ -186,6 +182,15 @@ resource "kubernetes_deployment_v1" "apiary_hms_readonly" {
name = "LIMIT_PARTITION_REQUEST_NUMBER"
value = var.hms_ro_request_partition_limit == "" ? "" : var.hms_ro_request_partition_limit
}
env {
name = "DATANUCLEUS_CONNECTION_POOLING_TYPE"
value = var.hms_ro_datanucleus_connection_pooling_type
}
env {
name = "DATANUCLEUS_CONNECTION_POOL_MAX_POOLSIZE"
value = var.hms_ro_db_connection_pool_size
}

dynamic "env" {
for_each = var.hms_additional_environment_variables

Expand All @@ -195,6 +200,15 @@ resource "kubernetes_deployment_v1" "apiary_hms_readonly" {
}
}

dynamic "env" {
for_each = var.hms_ro_datanucleus_connection_pool_config

content {
name = env.key
value = env.value
}
}

liveness_probe {
tcp_socket {
port = var.hive_metastore_port
Expand Down
22 changes: 18 additions & 4 deletions k8s-readwrite.tf
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,6 @@ resource "kubernetes_deployment_v1" "apiary_hms_readwrite" {
name = "DISALLOW_INCOMPATIBLE_COL_TYPE_CHANGES"
value = var.disallow_incompatible_col_type_changes
}
env {
name = "MYSQL_CONNECTION_POOL_SIZE"
value = var.hms_rw_db_connection_pool_size
}
env {
name = "HMS_AUTOGATHER_STATS"
value = var.hms_autogather_stats
Expand All @@ -226,6 +222,15 @@ resource "kubernetes_deployment_v1" "apiary_hms_readwrite" {
name = "LIMIT_PARTITION_REQUEST_NUMBER"
value = var.hms_rw_request_partition_limit == "" ? "" : var.hms_rw_request_partition_limit
}
env {
name = "DATANUCLEUS_CONNECTION_POOLING_TYPE"
value = var.hms_rw_datanucleus_connection_pooling_type
}
env {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have DATANUCLEUS_CONNECTION_POOL_MAX_POOLSIZE setting but at the same time we add dynamically connection pool configuration? should not be this part of the dynamic configuration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it a lot. It can be but it should not be. It is way too important and can be missed. We need to add an explicit setting for the pool size.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this setting by the way is shared across all pool types as well, so it's safe to make it explicit.

name = "DATANUCLEUS_CONNECTION_POOL_MAX_POOLSIZE"
value = var.hms_rw_db_connection_pool_size
}

dynamic "env" {
for_each = var.hms_additional_environment_variables

Expand All @@ -235,6 +240,15 @@ resource "kubernetes_deployment_v1" "apiary_hms_readwrite" {
}
}

dynamic "env" {
for_each = var.hms_rw_datanucleus_connection_pool_config

content {
name = env.key
value = env.value
}
}

liveness_probe {
tcp_socket {
port = var.hive_metastore_port
Expand Down
34 changes: 32 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -661,17 +661,23 @@ variable "hms_autogather_stats" {
}

variable "hms_ro_db_connection_pool_size" {
description = "Read-only Hive metastore setting for size of the MySQL connection pool. Default is 10."
description = "Read-only Hive metastore setting for max size of the MySQL connection pool. Default is 10."
type = number
default = 10
}

variable "hms_rw_db_connection_pool_size" {
description = "Read-write Hive metastore setting for size of the MySQL connection pool. Default is 10."
description = "Read-write Hive metastore setting for max size of the MySQL connection pool. Default is 10."
type = number
default = 10
}

variable "hms_housekeeper_db_connection_pool_size" {
description = "HMS Housekeeper setting for max size of the MySQL connection pool. Default is 5."
type = number
default = 5
}

variable "db_enable_performance_insights" {
description = "Enable RDS Performance Insights"
type = bool
Expand Down Expand Up @@ -757,3 +763,27 @@ variable "apiary_common_producer_iamroles" {
type = list(string)
default = []
}

variable "hms_ro_datanucleus_connection_pooling_type" {
description = "The Datanucleus connection pool type: Valid types are BoneCP, HikariCP, c3p0, dbcp, dbcp2"
type = string
default = "HikariCP"
}

variable "hms_rw_datanucleus_connection_pooling_type" {
description = "The Datanucleus connection pool type: Valid types are BoneCP, HikariCP, c3p0, dbcp, dbcp2"
type = string
default = "HikariCP"
}

variable "hms_ro_datanucleus_connection_pool_config" {
description = "A map of env vars supported by Apiary docker image that can configure the chosen Datanucleus connection pool"
type = map(any)
default = {}
}

variable "hms_rw_datanucleus_connection_pool_config" {
description = "A map of env vars supported by Apiary docker image that can configure the chosen Datanucleus connection pool"
type = map(any)
default = {}
}
Loading