Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance: Add hook to support different way to create/drop/alter wareh… #462

Merged
merged 1 commit into from
Jun 13, 2024
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
6 changes: 6 additions & 0 deletions src/backend/cdb/cdbvars.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,3 +619,9 @@ gp_execution_dbid(PG_FUNCTION_ARGS)
{
PG_RETURN_INT32(GpIdentity.dbid);
}


/*
* Warehouse hook for Create/Drop/Alter Warehouse
*/
WarehouseMethod *warehouse_method = NULL;
43 changes: 43 additions & 0 deletions src/include/cdb/cdbvars.h
Original file line number Diff line number Diff line change
Expand Up @@ -781,4 +781,47 @@ extern const char * lookup_autostats_mode_by_value(GpAutoStatsModeValue val);
*/
#define CDB_NOTIFY_ENDPOINT_ACK "ack_notify"

typedef enum WarehouseStatus
{
WAREHOUSE_STATUS_CREATING,
WAREHOUSE_STATUS_RUNNING,
WAREHOUSE_STATUS_SUSPENDED,
WAREHOUSE_STATUS_STOPPING
} WarehouseStatus;

typedef struct WarehouseSegmentConfig
{
char *hostname;
char *address;
int32 port;
char *data_directory;
int16 content_id;
} WarehouseSegmentConfig;

/*
* Warehouse hook for Create/Drop/Alter Warehouse.
* There are different implementations for different deployment methods.
*/
typedef struct WarehouseMethod{
bool (*CreateWarehouse_hook)(char *warehouse_name,
int warehouse_size,
char **warehouse_options,
int warehouse_options_size,
WarehouseSegmentConfig **seg_configs,
int *seg_configs_size,
WarehouseStatus *status);

bool (*DropWarehouse_hook)(char *warehouse_name,
WarehouseSegmentConfig *seg_configs,
int warehouse_size);

bool (*AlterWarehouse_hook)(char *warehouse_name,
int old_warehouse_size,
int new_warehouse_size,
WarehouseSegmentConfig **new_seg_configs,
int *seg_configs_size);
} WarehouseMethod;

extern WarehouseMethod *warehouse_method;

#endif /* CDBVARS_H */
Loading