Skip to content

Commit

Permalink
[DB-15227] Populate the datatype in the UNSUPPORTED_DATATYPE_LIVE_MIG…
Browse files Browse the repository at this point in the history
…RATION / FF_FB fields in Assessment Issues

- this might be a temporary fix until we breakdown  unsupported datatype issues
  • Loading branch information
sanyamsinghal committed Feb 6, 2025
1 parent cde572b commit d9ecb13
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
27 changes: 13 additions & 14 deletions migtests/scripts/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,7 @@ normalize_json() {
local input_file="$1"
local output_file="$2"
local temp_file="/tmp/temp_file.json"
# local temp_file2="/tmp/temp_file2.json"
local temp_file2="/tmp/temp_file2.json"

# Normalize JSON with jq; use --sort-keys to avoid the need to keep the same sequence of keys in expected vs actual json
jq --sort-keys 'walk(
Expand Down Expand Up @@ -909,23 +909,22 @@ normalize_json() {
end
)' "$input_file" > "$temp_file"

# Sample code: how to ignore nested fields with a specific parent in a json
# TODO: For fields like SqlStatement or others we can more explicit regarding changing them
# jq --sort-keys 'walk(
# if type == "object" and (.UnsupportedFeatures?|type) == "array" then
# .UnsupportedFeatures |= map(
# .FeatureName? = "IGNORED"
# )
# else
# .
# end
# )' "$temp_file" > "$temp_file2"
# Second pass: for AssessmentIssue objects, if Category is "migration_caveats" and the Type is one
# of the two specified values, then set ObjectName to "IGNORED".
jq 'walk(
if type == "object" and
.Category == "migration_caveats" and
(.Type == "UNSUPPORTED_DATATYPE_LIVE_MIGRATION" or .Type == "UNSUPPORTED_DATATYPE_LIVE_MIGRATION_WITH_FF_FB")
then .ObjectName = "IGNORED"
else .
end
)' "$temp_file" > "$temp_file2"

# Remove unwanted lines
sed -i '/Review and manually import.*uncategorized.sql/d' "$temp_file"
sed -i '/Review and manually import.*uncategorized.sql/d' "$temp_file2"

# Move cleaned file to output
mv "$temp_file" "$output_file"
mv "$temp_file2" "$output_file"
}


Expand Down
2 changes: 1 addition & 1 deletion yb-voyager/cmd/assessMigrationCommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,7 @@ func addMigrationCaveatsToAssessmentReport(unsupportedDataTypesForLiveMigration
Impact: constants.IMPACT_LEVEL_1, // Caveat - we don't know the migration is offline/online;
Description: UNSUPPORTED_DATATYPES_FOR_LIVE_MIGRATION_DESCRIPTION,
ObjectType: constants.COLUMN,
ObjectName: fmt.Sprintf("%s.%s.%s", colInfo.SchemaName, colInfo.TableName, colInfo.ColumnName),
ObjectName: fmt.Sprintf("%s.%s.%s (%s)", colInfo.SchemaName, colInfo.TableName, colInfo.ColumnName, colInfo.DataType), // TODO (fix): adding datatype here is temporary fix
DocsLink: UNSUPPORTED_DATATYPE_LIVE_MIGRATION_DOC_LINK,
})
}
Expand Down

0 comments on commit d9ecb13

Please sign in to comment.