Mark 0/0 lsn results as null (#6617)

Marks `source_lsn` and `target_lsn` fields as null if the result is 0/0
pull/6618/head
Ahmet Gedemenli 2023-01-13 15:33:43 +03:00 committed by GitHub
parent 28ed013a91
commit ed6dd8b086
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 106 additions and 96 deletions

View File

@ -1298,7 +1298,17 @@ get_rebalance_progress(PG_FUNCTION_ARGS)
values[11] = PointerGetDatum(
cstring_to_text(PlacementUpdateTypeNames[step->updateType]));
values[12] = LSNGetDatum(sourceLSN);
if (sourceLSN == InvalidXLogRecPtr)
{
nulls[12] = true;
}
values[13] = LSNGetDatum(targetLSN);
if (targetLSN == InvalidXLogRecPtr)
{
nulls[13] = true;
}
values[14] = PointerGetDatum(cstring_to_text(
PlacementUpdateStatusNames[
pg_atomic_read_u64(

View File

@ -32,9 +32,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -76,9 +76,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -115,9 +115,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -154,9 +154,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -197,9 +197,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -241,9 +241,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -284,9 +284,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -328,9 +328,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -371,9 +371,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -415,9 +415,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -458,9 +458,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -500,9 +500,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -543,9 +543,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -585,9 +585,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -629,9 +629,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -671,9 +671,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -715,9 +715,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -757,9 +757,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -800,9 +800,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -842,9 +842,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -885,9 +885,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -927,9 +927,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -971,9 +971,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -1013,9 +1013,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -1057,9 +1057,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -1099,9 +1099,9 @@ step s7-get-progress:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
@ -1145,9 +1145,9 @@ step s7-get-progress-ordered:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available
FROM get_rebalance_progress()
ORDER BY 1, 2, 3, 4, 5;
@ -1195,9 +1195,9 @@ step s7-get-progress-ordered:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available
FROM get_rebalance_progress()
ORDER BY 1, 2, 3, 4, 5;
@ -1241,9 +1241,9 @@ step s7-get-progress-ordered:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available
FROM get_rebalance_progress()
ORDER BY 1, 2, 3, 4, 5;
@ -1291,9 +1291,9 @@ step s7-get-progress-ordered:
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available
FROM get_rebalance_progress()
ORDER BY 1, 2, 3, 4, 5;

View File

@ -144,9 +144,9 @@ step "s7-get-progress"
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available,
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available,
status
FROM get_rebalance_progress();
}
@ -170,9 +170,9 @@ step "s7-get-progress-ordered"
( SELECT size FROM possible_sizes WHERE ABS(size - target_shard_size) = (SELECT MIN(ABS(size - target_shard_size)) FROM possible_sizes )) target_shard_size,
progress,
operation_type,
source_lsn >= target_lsn as lsn_sanity_check,
source_lsn > '0/0' as source_lsn_available,
target_lsn > '0/0' as target_lsn_available
target_lsn IS NULL OR source_lsn >= target_lsn AS lsn_sanity_check,
source_lsn IS NOT NULL AS source_lsn_available,
target_lsn IS NOT NULL AS target_lsn_available
FROM get_rebalance_progress()
ORDER BY 1, 2, 3, 4, 5;
}