fix shrink bug and misspelling

This commit is contained in:
gentle_hu
2024-07-26 10:15:58 +08:00
parent 6d1a4a8c98
commit b372df81e4
5 changed files with 19 additions and 11 deletions

View File

@ -32530,7 +32530,7 @@ void ShrinkCfsChunkRestore(Oid relationId, LOCKMODE lockmode, bool nowait)
relation_close(relation, lockmode);
}
void ShrinkRealtionChunk(ShrinkStmt* shrink)
void ShrinkRelationChunk(ShrinkStmt* shrink)
{
ListCell* cell = NULL;
foreach (cell, shrink->relations) {
@ -32544,9 +32544,11 @@ void ShrinkRealtionChunk(ShrinkStmt* shrink)
reloid = RangeVarGetRelid(r, AccessShareLock, true);
if (!OidIsValid(reloid)) {
continue;
ereport(ERROR, (errmsg("[shrink] relation %s%s%s does not exist.",
r->schemaname == NULL ? "" : r->schemaname,
r->schemaname == NULL ? "" : ".",
r->relname)));
}
ShrinkCfsChunkRestore(reloid, AccessShareLock, shrink->nowait);
}
}

View File

@ -2527,7 +2527,7 @@ ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
#endif
}
void ExecShrinkRealtionChunkStmt(Node* parse_tree, const char* query_string, bool sent_to_remote)
void ExecShrinkRelationChunkStmt(Node* parse_tree, const char* query_string, bool sent_to_remote)
{
#ifdef PGXC
if (IS_PGXC_COORDINATOR) {
@ -2537,18 +2537,18 @@ void ExecShrinkRealtionChunkStmt(Node* parse_tree, const char* query_string, boo
if (u_sess->attr.attr_sql.enable_parallel_ddl && !is_first_node) {
ExecUtilityStmtOnNodes_ParallelDDLMode(
query_string, NULL, sent_to_remote, false, EXEC_ON_COORDS, false, first_exec_node);
ShrinkRealtionChunk((ShrinkStmt*)(void *)parse_tree);
ShrinkRelationChunk((ShrinkStmt*)(void *)parse_tree);
ExecUtilityStmtOnNodes_ParallelDDLMode(
query_string, NULL, sent_to_remote, false, EXEC_ON_DATANODES, false, first_exec_node);
} else {
ShrinkRealtionChunk((ShrinkStmt*)(void *)parse_tree);
ShrinkRelationChunk((ShrinkStmt*)(void *)parse_tree);
ExecUtilityStmtOnNodes(query_string, NULL, sent_to_remote, false, EXEC_ON_ALL_NODES, false);
}
} else {
ShrinkRealtionChunk((ShrinkStmt*)(void *)parse_tree);
ShrinkRelationChunk((ShrinkStmt*)(void *)parse_tree);
}
#else
ShrinkRealtionChunk((ShrinkStmt*)(void *)parse_tree);
ShrinkRelationChunk((ShrinkStmt*)(void *)parse_tree);
#endif
}
@ -4932,7 +4932,7 @@ void standard_ProcessUtility(processutility_context* processutility_cxt,
break;
#endif
case T_ShrinkStmt: {
ExecShrinkRealtionChunkStmt(parse_tree, query_string, sent_to_remote);
ExecShrinkRelationChunkStmt(parse_tree, query_string, sent_to_remote);
break;
}
case T_ReindexStmt: {

View File

@ -114,7 +114,7 @@ extern void RemoveRelationsonMainExecCN(DropStmt* drop, ObjectAddresses* objects
extern void RemoveRelations(DropStmt* drop, StringInfo tmp_queryString, RemoteQueryExecType* exec_type);
extern void ShrinkRealtionChunk(ShrinkStmt *shrink);
extern void ShrinkRelationChunk(ShrinkStmt *shrink);
extern void RemoveObjectsonMainExecCN(DropStmt* drop, ObjectAddresses* objects, bool isFirstNode);

View File

@ -408,6 +408,10 @@ shrink table row_compression_test_tbl1_kkk;
shrink table row_compression_test_tbl1_kkk nowait;
shrink table row_compression_test_tbl1_kkk_idx;
shrink table row_compression_test_tbl1_kkk_idx nowait;
shrink table row_compression_test_not_exist;
ERROR: [shrink] relation row_compression_test_not_exist does not exist.
shrink table row_compression_test_not_exist nowait;
ERROR: [shrink] relation row_compression_test_not_exist does not exist.
-- test truncate
truncate table row_compression_test_tbl1_kkk;
checkpoint;
@ -889,4 +893,4 @@ select * from compress_normal_user.hash_range order by month_code, dept_code;
(6 rows)
drop table if exists compress_normal_user.hash_range cascade;
drop schema if exists compress_normal_user cascade;
drop schema if exists compress_normal_user cascade;

View File

@ -229,6 +229,8 @@ shrink table row_compression_test_tbl1_kkk;
shrink table row_compression_test_tbl1_kkk nowait;
shrink table row_compression_test_tbl1_kkk_idx;
shrink table row_compression_test_tbl1_kkk_idx nowait;
shrink table row_compression_test_not_exist;
shrink table row_compression_test_not_exist nowait;
-- test truncate
truncate table row_compression_test_tbl1_kkk;