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

feat: adds mysql resource group information #395

Merged
merged 5 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 4.3.33
current_version = 4.3.34
commit = False
tag = False

Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ build-collector: clean-collector ## Build the collector SQL scripts.

@echo "=> Building Assessment Data Collection Scripts for MySQL version $(VERSION)..."
@mkdir -p $(BUILD_DIR)/collector/mysql/sql/
@mkdir -p $(BUILD_DIR)/collector/mysql/sql/5.7
@mkdir -p $(BUILD_DIR)/collector/mysql/sql/base
@cp scripts/collector/mysql/sql/*.sql $(BUILD_DIR)/collector/mysql/sql
@cp scripts/collector/mysql/sql/5.7/*.sql $(BUILD_DIR)/collector/mysql/sql/5.7
@cp scripts/collector/mysql/sql/base/*.sql $(BUILD_DIR)/collector/mysql/sql/base
@cp scripts/collector/mysql/collect-data.sh $(BUILD_DIR)/collector/mysql/
@cp -L scripts/collector/mysql/db-machine-specs.sh $(BUILD_DIR)/collector/mysql/
@cp scripts/collector/mysql/README.txt $(BUILD_DIR)/collector/mysql/
Expand Down
16 changes: 14 additions & 2 deletions scripts/collector/mysql/collect-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

### Setup directories needed for execution
#############################################################################
OpVersion="4.3.33"
OpVersion="4.3.34"
dbmajor=""

LOCALE=$(echo $LANG | cut -d '.' -f 1)
Expand Down Expand Up @@ -227,8 +227,9 @@ if ! [ -x "$(command -v ${SQLCMD})" ]; then
fi

export DMA_SOURCE_ID=$(${SQLCMD} --user=$user --password=$pass -h $host -P $port --force --silent --skip-column-names $db 2>>${OUTPUT_DIR}/opdb__stderr_${V_FILE_TAG}.log < sql/init.sql | tr -d '\r')
export SCRIPT_PATH=$(${SQLCMD} --user=$user --password=$pass -h $host -P $port --force --silent --skip-column-names $db 2>>${OUTPUT_DIR}/opdb__stderr_${V_FILE_TAG}.log < sql/_base_path_lookup.sql | tr -d '\r')

for f in $(ls -1 sql/*.sql | grep -v -e init.sql)
for f in $(ls -1 sql/*.sql | grep -v -e init.sql | grep -v -e _base_path_lookup.sql)
do
fname=$(echo ${f} | cut -d '/' -f 2 | cut -d '.' -f 1)
${SQLCMD} --user=$user --password=$pass -h $host -P $port --force --table ${db} >${OUTPUT_DIR}/opdb__mysql_${fname}__${V_TAG} 2>>${OUTPUT_DIR}/opdb__stderr_${V_FILE_TAG}.log <<EOF
Expand All @@ -239,6 +240,17 @@ source ${f}
exit
EOF
done
for f in $(ls -1 sql/${SCRIPT_PATH}/*.sql | grep -v -e init.sql | grep -v -e _base_path_lookup.sql)
do
fname=$(echo ${f} | cut -d '/' -f 3 | cut -d '.' -f 1)
${SQLCMD} --user=$user --password=$pass -h $host -P $port --force --table ${db} >${OUTPUT_DIR}/opdb__mysql_${fname}__${V_TAG} 2>>${OUTPUT_DIR}/opdb__stderr_${V_FILE_TAG}.log <<EOF
SET @DMA_SOURCE_ID='${DMA_SOURCE_ID}' ;
SET @DMA_MANUAL_ID='${V_MANUAL_ID}' ;
SET @PKEY='${V_FILE_TAG}';
source ${f}
exit
EOF
done

specsOut="output/opdb__mysql_db_machine_specs_${V_FILE_TAG}.csv"
host=$(echo ${connectString} | cut -d '/' -f 4 | cut -d ':' -f 1)
Expand Down
17 changes: 17 additions & 0 deletions scripts/collector/mysql/sql/5.7/resource_groups.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- name: collector-mysql-resource-groups
select concat(char(34), @PKEY, char(34)) as pkey,
concat(char(34), @DMA_SOURCE_ID, char(34)) as dma_source_id,
concat(char(34), @DMA_MANUAL_ID, char(34)) as dma_manual_id,
concat(char(34), src.resource_group_name, char(34)) as resource_group_name,
concat(char(34), src.resource_group_type, char(34)) as resource_group_type,
concat(char(34), src.resource_group_enabled, char(34)) as resource_group_enabled,
concat(char(34), src.vcpu_ids, char(34)) as vcpu_ids,
concat(char(34), src.thread_priority, char(34)) as thread_priority
from (
select 'Unsupported Version Placeholder' as resource_group_type,
0 as resource_group_enabled,
'Placeholder Value' as resource_group_name,
'' as vcpu_ids,
0 as thread_priority
limit 0
) src;
9 changes: 9 additions & 0 deletions scripts/collector/mysql/sql/_base_path_lookup.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- init-mysql-script-base-path
select if(clean_version like '5.%', '5.7', 'base') as script_path
from (
select if(
version() rlike '^[0-9]+\.[0-9]+\.[0-9]+$' = 1,
version(),
SUBSTRING_INDEX(VERSION(), '.', 2) || '.0'
) as clean_version
) as base;
17 changes: 17 additions & 0 deletions scripts/collector/mysql/sql/base/resource_groups.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- name: collector-mysql-resource-groups
select concat(char(34), @PKEY, char(34)) as pkey,
concat(char(34), @DMA_SOURCE_ID, char(34)) as dma_source_id,
concat(char(34), @DMA_MANUAL_ID, char(34)) as dma_manual_id,
concat(char(34), src.resource_group_name, char(34)) as resource_group_name,
concat(char(34), src.resource_group_type, char(34)) as resource_group_type,
concat(char(34), src.resource_group_enabled, char(34)) as resource_group_enabled,
concat(char(34), src.vcpu_ids, char(34)) as vcpu_ids,
concat(char(34), src.thread_priority, char(34)) as thread_priority
from (
select rg.resource_group_type as resource_group_type,
rg.resource_group_enabled as resource_group_enabled,
rg.resource_group_name as resource_group_name,
rg.vcpu_ids as vcpu_ids,
rg.thread_priority as thread_priority,
from information_schema.resource_groups rg
) src;
2 changes: 1 addition & 1 deletion scripts/collector/oracle/collect-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

### Setup directories needed for execution
#############################################################################
OpVersion="4.3.33"
OpVersion="4.3.34"
dbmajor=""

LOCALE=$(echo $LANG | cut -d '.' -f 1)
Expand Down
2 changes: 1 addition & 1 deletion scripts/collector/postgres/collect-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

### Setup directories needed for execution
#############################################################################
OpVersion="4.3.33"
OpVersion="4.3.34"
dbmajor=""

LOCALE=$(echo $LANG | cut -d '.' -f 1)
Expand Down
2 changes: 1 addition & 1 deletion scripts/collector/sqlserver/instanceReview.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ $validSQLInstanceVersionCheckValues = $splitValidInstanceVerisionCheckObj | ForE
$isValidSQLInstanceVersion = $validSQLInstanceVersionCheckValues[0]
$isCloudOrLinuxHost = $validSQLInstanceVersionCheckValues[1]

$op_version = "4.3.33"
$op_version = "4.3.34"

if ([string]($isValidSQLInstanceVersion) -eq "N") {
Write-Host "#############################################################"
Expand Down
2 changes: 1 addition & 1 deletion scripts/masker/dma-collection-masker
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ __all__ = [
"run_masker",
]

__version__ = "4.3.33"
__version__ = "4.3.34"

logger = logging.getLogger(__name__)

Expand Down