Skip to content
Open
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: 2 additions & 0 deletions gpAux/gpdemo/demo_cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ if [ "${ENABLE_COPY}" == "true" ]; then
ycmdb.yc_allow_copy_to_program=on
ycmdb.yc_allow_copy_from_file=on
ycmdb.yc_allow_copy_to_file=on
wal_level=hot_standby
hot_standby=on

EOF
fi
Expand Down
8 changes: 8 additions & 0 deletions gpcontrib/gp_aux_catalog/gp_aux_catalog--1.0--1.1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@ SELECT gpdb_binary_upgrade_catalog_1_0_to_1_1_m();

DROP FUNCTION gpdb_binary_upgrade_catalog_1_0_to_1_1_seg();
DROP FUNCTION gpdb_binary_upgrade_catalog_1_0_to_1_1_m();

CREATE OR REPLACE FUNCTION
gp_add_segment_aux_mirror(int2, text, text, int4, text)
RETURNS int2
AS 'MODULE_PATHNAME'
VOLATILE
EXECUTE ON MASTER
LANGUAGE C STRICT;
50 changes: 49 additions & 1 deletion gpcontrib/gp_aux_catalog/gp_aux_catalog.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "catalog/indexing.h"
#include "utils/builtins.h"
<<<<<<< HEAD
#include "utils/fmgroids.h"
#include "access/heapam.h"
#include "catalog/pg_proc.h"
Expand All @@ -16,6 +17,11 @@
#include "catalog/pg_amop.h"
#include "access/htup_details.h"
#include "../backend/commands/analyzefuncs.c"
=======

#include "cdb/cdbutil.h"

>>>>>>> c97cd21a41 (Add aux mirror)
PG_MODULE_MAGIC;
void _PG_init(void);

Expand Down Expand Up @@ -43,6 +49,7 @@ pg_event_trigger_table_rewrite_reason(PG_FUNCTION_ARGS)
return pg_event_trigger_table_rewrite_reason_internal(fcinfo);
}

<<<<<<< HEAD
static void
gpdb_binary_upgrade_insert_pro_tup(
Relation rel,
Expand Down Expand Up @@ -167,4 +174,45 @@ gp_acquire_sample_rows_vac(PG_FUNCTION_ARGS)
bool inherited = PG_GETARG_BOOL(2);
int32 vacopts = PG_GETARG_INT32(3);
return gp_acquire_sample_rows_int(fcinfo,relOid,targrows,inherited,vacopts);
}
}

Datum
gp_add_segment_aux_mirror(PG_FUNCTION_ARGS)
{
GpSegConfigEntry new;

if (PG_ARGISNULL(0))
elog(ERROR, "contentid cannot be NULL");
new.segindex = PG_GETARG_INT16(0);

if (PG_ARGISNULL(1))
elog(ERROR, "hostname cannot be NULL");
new.hostname = TextDatumGetCString(PG_GETARG_DATUM(1));

if (PG_ARGISNULL(2))
elog(ERROR, "address cannot be NULL");
new.address = TextDatumGetCString(PG_GETARG_DATUM(2));

if (PG_ARGISNULL(3))
elog(ERROR, "port cannot be NULL");
new.port = PG_GETARG_INT32(3);

if (PG_ARGISNULL(4))
elog(ERROR, "datadir cannot be NULL");
new.datadir = TextDatumGetCString(PG_GETARG_DATUM(4));

/* XXX: todo - check
mirroring_sanity_check(MASTER_ONLY | SUPERUSER, "gp_add_segment_aux_mirror");
*/


new.dbid = get_availableDbId();
new.mode = GP_SEGMENT_CONFIGURATION_MODE_NOTINSYNC;
new.status = GP_SEGMENT_CONFIGURATION_STATUS_DOWN;
new.role = GP_SEGMENT_CONFIGURATION_ROLE_AUX_MIRROR;
new.preferred_role = GP_SEGMENT_CONFIGURATION_ROLE_AUX_MIRROR;

add_segment(&new);

PG_RETURN_INT16(new.dbid);
}
12 changes: 12 additions & 0 deletions gpcontrib/gpdebug/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# gpcontrib/gpdebug/Makefile

MODULE_big = gpdebug
OBJS = gpdebug.o $(WIN32RES)

EXTENSION = gpdebug
DATA = gpdebug--1.0.sql
PGFILEDESC = "gpdebug - An debug logging for PostgreSQL"

PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
2 changes: 2 additions & 0 deletions gpcontrib/gpdebug/gpdebug--1.0.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CREATE OR REPLACE FUNCTION cleanupAllGangs() RETURNS BOOL
AS 'MODULE_PATHNAME','cleanupAllGangs' LANGUAGE C;
27 changes: 27 additions & 0 deletions gpcontrib/gpdebug/gpdebug.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@


/*------------------------------------------------------------------------------
* gpdebug.c
*
* Copyright (c) 2014-2021, PostgreSQL Global Development Group
*------------------------------------------------------------------------------
*/
#include "postgres.h"


#include "cdb/cdbvars.h"
#include "cdb/cdbgang.h"

PG_MODULE_MAGIC;

void _PG_init(void);

PG_FUNCTION_INFO_V1(cleanupAllGangs);
Datum
cleanupAllGangs(PG_FUNCTION_ARGS)
{
if (Gp_role != GP_ROLE_DISPATCH)
elog(ERROR, "cleanupAllGangs can only be executed on master");
DisconnectAndDestroyAllGangs(false);
PG_RETURN_BOOL(true);
}
5 changes: 5 additions & 0 deletions gpcontrib/gpdebug/gpdebug.control
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# gpdebug extension
comment = 'provides debug functionality'
default_version = '1.0'
module_pathname = '$libdir/gpdebug'
relocatable = true
1 change: 1 addition & 0 deletions src/backend/access/transam/distributedlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ DistributedLog_InitOldestXmin(void)

pg_atomic_write_u32((pg_atomic_uint32 *)&DistributedLogShared->oldestXmin, oldestXmin);
}

/*
* Advance the "oldest xmin" among distributed snapshots.
*
Expand Down
4 changes: 2 additions & 2 deletions src/backend/access/transam/twophase.c
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ StandbyTransactionIdIsPrepared(TransactionId xid)
* files, so we cannot use ReadTwoPhaseFile() here. Fortunately, this
* isn't needed until we try to use Hot Standby.
*/
elog(ERROR, "Hot Standby not supported");
//elog(ERROR, "Hot Standby not supported");
#if 0
char *buf;
TwoPhaseFileHeader *hdr;
Expand Down Expand Up @@ -1879,7 +1879,7 @@ GetOldestPreparedTransaction()
void
StandbyRecoverPreparedTransactions(bool overwriteOK)
{
elog(ERROR, "Hot Standby not supported");
// elog(ERROR, "Hot Standby not supported");
}

/*
Expand Down
4 changes: 2 additions & 2 deletions src/backend/access/transam/xact.c
Original file line number Diff line number Diff line change
Expand Up @@ -2329,8 +2329,8 @@ StartTransaction(void)
* hot standby is enabled. This mode is not supported in
* Greenplum yet.
*/
AssertImply(DistributedTransactionContext != DTX_CONTEXT_LOCAL_ONLY,
!s->startedInRecovery);
// AssertImply(DistributedTransactionContext != DTX_CONTEXT_LOCAL_ONLY,
// !s->startedInRecovery);
/*
* MPP Modification
*
Expand Down
11 changes: 10 additions & 1 deletion src/backend/access/transam/xlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -7200,11 +7200,20 @@ StartupXLOG(void)
oldestActiveXID = PrescanPreparedTransactions(&xids, &nxids);
else
oldestActiveXID = checkPoint.oldestActiveXid;
Assert(TransactionIdIsValid(oldestActiveXID));
// Assert(TransactionIdIsValid(oldestActiveXID));

/* Tell procarray about the range of xids it has to deal with */
ProcArrayInitRecovery(ShmemVariableCache->nextXid);

/* also initialize latestCompletedXid, to nextXid - 1 */
LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE);
ShmemVariableCache->latestCompletedXid = ShmemVariableCache->nextXid;
TransactionIdRetreat(ShmemVariableCache->latestCompletedXid);
elog(LOG, "latest completed transaction id is %u and next transaction id is %u",
ShmemVariableCache->latestCompletedXid,
ShmemVariableCache->nextXid);
LWLockRelease(ProcArrayLock);

/*
* Startup commit log and subtrans only. MultiXact has already
* been started up and other SLRUs are not maintained during
Expand Down
Loading
Loading