diff --git a/src/backend/cdb/cdbutil.c b/src/backend/cdb/cdbutil.c index 0d6f7147d30..ecdc1df6f08 100644 --- a/src/backend/cdb/cdbutil.c +++ b/src/backend/cdb/cdbutil.c @@ -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); + } } } diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index b558ae1db4d..6d5c8b5f5f6 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -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: {