返回首页

gbase数据、南大通用产品文档:GBase8a虚拟集群

更新日期:2024年09月11日

一个虚拟集群中包含一个或多个VC(虚拟集群)。各VC 在整个虚拟集群范围内
独立运行,共享统一的入口。权限许可的情况下,各虚拟集群间可以相互访问。支
持Coordinator node 和Data node 部署在同一个物理节点上。
统一管理

GBase 8a MPP Cluster 产品手册
2 产品概述
文档版本953(2022-09-15)
南大通用数据技术股份有限公司
35
在集群内部进行虚拟集群划分,在增强集群扩展能力的同时,还提供了统一的管理
视图。
统一入口
图2- 6 集群访问入口示意图
说明

用户选择Coordinator Cluster 中的任意一个节点作为集群入口;

Coordinator node 根据连接用户的设置连接和操作用户指定的VC。
业务隔离
虚拟集群对集群进行垂直资源隔离,在实际的业务场景中,可以实现对不同业务的
资源进行物理隔离。
透明访问
虚拟集群的访问对应用是透明的,对应用来说就是一个统一的集群。

此程序取得 advert_descr 列非空的目录项的价格,并将该价格追加到描述。
EXEC SQL include sqltypes;
EXEC SQL define BUFSZ 10;
extern char statement[80];
main()
{
int error, isize;
char format[] = "<<<,<<<.&&";
char decdsply[20], buf[50000], *end;

EXEC SQL BEGIN DECLARE SECTION;
dec_t price;
fixed binary 'clob' ifx_lo_t descr;
smallint stockno;
char srvr_name[256], mancd[4], unit[5];
ifx_lo_stat_t *stats;
ifx_int8_t size, offset, pos;
int lofd, ic_num;
EXEC SQL END DECLARE SECTION;

void nullterm(char *);

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 968 -
void handle_lo_error(int);

isize = 0;
EXEC SQL whenever sqlerror call whenexp_chk;
EXEC SQL whenever sqlwarning call whenexp_chk;

printf("UPD_LO_DESCR Sample ESQL program running.\n\n");
strcpy(statement, "CONNECT stmt");
EXEC SQL connect to 'stores7';
EXEC SQL get diagnostics exception 1
:srvr_name = server_name;
nullterm(srvr_name);

/* Selects each row where the advert.picure column is not null and
* displays
* status information for the smart large object.
*/
EXEC SQL declare ifxcursor cursor for
select catalog_num, stock_num, manu_code, unit, advert_descr
into :ic_num, :stockno, :mancd, :unit, :descr
from catalog
where advert_descr is not null;

EXEC SQL open ifxcursor;
while(1)
{
EXEC SQL fetch ifxcursor;
if (strncmp(SQLSTATE, "00", 2) != 0)
{
if(strncmp(SQLSTATE, "02", 2) != 0)
printf("SQLSTATE after fetch is %s\n", SQLSTATE);
break;
}
EXEC SQL select unit_price into :price
from stock
where stock_num = :stockno
and manu_code = :mancd
and unit = :unit;
if (strncmp(SQLSTATE, "00", 2) != 0)
{
printf("SQLSTATE after select on stock: %s\n", SQLSTATE);
break;
}
if(risnull(CDECIMALTYPE, (char *) &price)) /* NULL? */
continue; /* skip to next row */
rfmtdec(&price, format, decdsply); /* format unit_price */
/* Use the returned LO-pointer structure to open a smart
* large object and get an LO file descriptor.
*/

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 969 -
lofd = ifx_lo_open(&descr, LO_RDWR, &error);
if (error < 0)
{
strcpy(statement, "ifx_lo_open()");
handle_lo_error(error);
}
ifx_int8cvint(0, &offset);
if(ifx_lo_seek(lofd, &offset, LO_SEEK_SET, &pos) < 0)
{
printf("\nifx_lo_seek() < 0\n");
break;
}
if(ifx_lo_stat(lofd, &stats) < 0)
{
printf("\nifx_lo_stat() < 0");
break;
}
if((ifx_lo_stat_size(stats, &size)) < 0)
{
printf("\nCan't get size, isize = 0");
isize = 0;
}
else
if(ifx_int8soint(&size, &isize) != 0)
{
printf("\nFailed to convert size");
isize = 0;
}
if(ifx_lo_read(lofd, buf, isize, &error) < 0)
{
printf("Read operation failed\n");
break;
}
end = buf + isize;
strcpy(end++, "(");
strcat(end, decdsply);
end += strlen(decdsply);
strcat(end++, ")");
if(ifx_lo_writewithseek(lofd, buf, (end - buf), &offset,
LO_SEEK_SET,
&error) < 0)
{
printf("Write error on LO: %d", error);
continue;
}
printf("\nNew description for catalog_num %d is: \n%s\n", ic_num,
buf);
}
/* Close smart large object */

GBase 8s ESQL/C 编程指南
南大通用数据技术股份有限公司
- 970 -
ifx_lo_close(lofd);
ifx_lo_stat_free(stats);
/* Free LO-specification structure */
EXEC SQL close ifxcursor;
EXEC SQL free ifxcursor;
}

void handle_lo_error(error_num)
int error_num;
{
printf("%s generated error %d\n", statement, error_num);
exit(1);
}

void nullterm(str)
char *str;
{
char *end;

end = str + 256;
while(*str != ' ' && *str != '\0' && str < end)
{
++str;
}
if(str >= end)
printf("Error: end of str reached\n");
if(*str == ' ')
*str = '\0';
}

/* Include source code for whenexp_chk() exception-checking
* routine
*/

EXEC SQL include exp_chk.ec;





gbase_stmt_execute
...........................
59