Skip to content
Merged
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
103 changes: 54 additions & 49 deletions src/backend/cdb/cdbutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,69 +261,74 @@ readGpSegConfigFromCatalog(int *total_dbs)
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_warehouseid, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
warehouseid = DatumGetObjectId(attr);
if (OidIsValid(warehouseid) && warehouseid != GetCurrentWarehouseId())
continue;

config = &configs[idx];

/* dbid */
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_dbid, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
config->dbid = DatumGetInt16(attr);

/* content */
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_content, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
config->segindex= DatumGetInt16(attr);

/* role */
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_role, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
config->role = DatumGetChar(attr);
if (warehouseid == GetCurrentWarehouseId() || DatumGetInt16(attr) == MASTER_CONTENT_ID)
{
config = &configs[idx];

/* preferred-role */
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_preferred_role, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
config->preferred_role = DatumGetChar(attr);
/* dbid */
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_dbid, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
config->dbid = DatumGetInt16(attr);

/* mode */
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_mode, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
config->mode = DatumGetChar(attr);
/* content */
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_content, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
config->segindex= DatumGetInt16(attr);

/* status */
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_status, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
config->status = DatumGetChar(attr);
/* role */
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_role, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
config->role = DatumGetChar(attr);

/* hostname */
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_hostname, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
config->hostname = TextDatumGetCString(attr);
/* preferred-role */
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_preferred_role, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
config->preferred_role = DatumGetChar(attr);

/* address */
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_address, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
config->address = TextDatumGetCString(attr);
/* mode */
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_mode, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
config->mode = DatumGetChar(attr);

/* port */
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_port, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
config->port = DatumGetInt32(attr);
/* status */
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_status, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
config->status = DatumGetChar(attr);

/* datadir is not dumped*/
/* hostname */
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_hostname, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
config->hostname = TextDatumGetCString(attr);

idx++;
/* address */
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_address, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
config->address = TextDatumGetCString(attr);

/*
* Expand CdbComponentDatabaseInfo array if we've used up
* currently allocated space
*/
if (idx >= array_size)
{
array_size = array_size * 2;
configs = (GpSegConfigEntry *)
repalloc(configs, sizeof(GpSegConfigEntry) * array_size);
/* port */
attr = heap_getattr(gp_seg_config_tuple, Anum_gp_segment_configuration_port, RelationGetDescr(gp_seg_config_rel), &isNull);
Assert(!isNull);
config->port = DatumGetInt32(attr);

/* datadir is not dumped*/

idx++;

/*
* Expand CdbComponentDatabaseInfo array if we've used up
* currently allocated space
*/
if (idx >= array_size)
{
array_size = array_size * 2;
configs = (GpSegConfigEntry *)
repalloc(configs, sizeof(GpSegConfigEntry) * array_size);
}
}
}

Expand Down
9 changes: 8 additions & 1 deletion src/backend/tcop/utility.c
Original file line number Diff line number Diff line change
Expand Up @@ -1788,7 +1788,14 @@ ProcessUtilitySlow(ParseState *pstate,

case T_DropTaskStmt:
address = DropTask(pstate, (DropTaskStmt *) parsetree);
break;
break;

case T_CreateWarehouseStmt:
case T_DropWarehouseStmt:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("warehouse feature is not supported")));
break;

case T_CreateExternalStmt:
{
Expand Down