提交 551d30f5 编写于 作者: H Heikki Linnakangas 提交者: Xin Zhang

gp_activate_standby() doesn't need to be callable from SQL.

上级 9ca6ebd0
......@@ -6558,7 +6558,7 @@ UpdateCatalogForStandbyPromotion(void)
Gp_role = GP_ROLE_UTILITY;
StartTransactionCommand();
GetTransactionSnapshot();
DirectFunctionCall1(gp_activate_standby, (Datum) 0);
gp_activate_standby();
/* close the transaction we started above */
CommitTransactionCommand();
Gp_role = old_role;
......
......@@ -850,8 +850,8 @@ catalog_activate_standby(int16 standbydbid, int16 olddbid)
* Returns:
* true upon success, otherwise throws error.
*/
Datum
gp_activate_standby(PG_FUNCTION_ARGS)
bool
gp_activate_standby(void)
{
int16 olddbid = GpIdentity.dbid;
int16 newdbid;
......@@ -872,7 +872,7 @@ gp_activate_standby(PG_FUNCTION_ARGS)
* Job is already done, nothing needs to be done. We mostly crashed
* after updating the catalogs.
*/
PG_RETURN_BOOL(true);
return true;
}
mirroring_sanity_check(SUPERUSER | UTILITY_MODE | STANDBY_ONLY,
......@@ -888,7 +888,7 @@ gp_activate_standby(PG_FUNCTION_ARGS)
primaryMirrorSetNewDbid(newdbid);
/* done */
PG_RETURN_BOOL(true);
return true;
}
Datum
......
......@@ -362,8 +362,6 @@
CREATE FUNCTION gp_remove_segment(int2) RETURNS bool LANGUAGE internal VOLATILE AS 'gp_remove_segment' WITH (OID=5051, DESCRIPTION="Remove a primary segment from the system catalog");
CREATE FUNCTION gp_activate_standby() RETURNS bool LANGUAGE internal VOLATILE AS 'gp_activate_standby' WITH (OID=5053, DESCRIPTION="Activate a standby");
CREATE FUNCTION gp_request_fts_probe_scan() RETURNS bool LANGUAGE internal VOLATILE AS 'gp_request_fts_probe_scan' EXECUTE ON MASTER WITH (OID=5035, DESCRIPTION="Request a FTS probe scan and wait for response");
......
......@@ -22,7 +22,7 @@
WARNING: DO NOT MODIFY THE FOLLOWING SECTION:
Generated by catullus.pl version 8
on Wed Jan 10 14:47:24 2018
on Thu Jan 11 14:21:56 2018
Please make your changes in pg_proc.sql
*/
......@@ -725,10 +725,6 @@ DESCR("Perform the catalog operations necessary for adding a new segment");
DATA(insert OID = 5051 ( gp_remove_segment PGNSP PGUID 12 1 0 0 f f f f f v 1 0 16 "21" _null_ _null_ _null_ _null_ gp_remove_segment _null_ _null_ _null_ n a ));
DESCR("Remove a primary segment from the system catalog");
/* gp_activate_standby() => bool */
DATA(insert OID = 5053 ( gp_activate_standby PGNSP PGUID 12 1 0 0 f f f f f v 0 0 16 "" _null_ _null_ _null_ _null_ gp_activate_standby _null_ _null_ _null_ n a ));
DESCR("Activate a standby");
/* gp_request_fts_probe_scan() => bool */
DATA(insert OID = 5035 ( gp_request_fts_probe_scan PGNSP PGUID 12 1 0 0 f f f f f v 0 0 16 "" _null_ _null_ _null_ _null_ gp_request_fts_probe_scan _null_ _null_ _null_ n m ));
DESCR("Request a FTS probe scan and wait for response");
......
......@@ -1175,7 +1175,7 @@ extern Datum gp_deprecated(PG_FUNCTION_ARGS);
extern Datum gp_add_master_standby_port(PG_FUNCTION_ARGS);
extern Datum gp_add_master_standby(PG_FUNCTION_ARGS);
extern Datum gp_remove_master_standby(PG_FUNCTION_ARGS);
extern Datum gp_activate_standby(PG_FUNCTION_ARGS);
extern bool gp_activate_standby(void);
extern Datum gp_add_segment_primary(PG_FUNCTION_ARGS);
extern Datum gp_add_segment_mirror(PG_FUNCTION_ARGS);
......
set gp_role = utility;
SET
select gp_activate_standby();
psql:/path/sql_file:1: ERROR: gp_activate_standby can only be run on the standby master (segadmin.c:303)
-- start_ignore
SET gp_create_table_random_default_distribution=off;
-- end_ignore
set gp_role = utility;
select gp_activate_standby();
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from tinctest import logger
from mpp.lib.PSQL import PSQL
from mpp.models import SQLTestCase
class Segadmin(SQLTestCase):
"""
@gucs gp_create_table_random_default_distribution=off
"""
sql_dir = 'sql'
ans_dir = 'ans'
out_dir = 'output'
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册