Correctly handle tablespace for GPexpand
GPexpand should take tablespaces into consideration. This means: 1. during the interview step stage, if there are user-created tablespaces in GreeplumDB cluster, we should generate a tablespace input file for GPexpand. User can modify it to use customized tablespace location on each new segment (Since we support create tablespace ... with (contentid=loc) syntax). 2. during the template generatition stage, we should pack tablespace files generated by pg_basebackup into the template, and saves the restore paths into a json config file which is also a part of the template. 3. During the stage of config a new segment, we should restore the tablespace files for primary. For mirrors, we just invoke pg_basebackup which has already handled tablespace cases. An example of the whole process is shown below: * suppose there are tablespaces in the GreenplumDB cluster * tbs1 (oid1) -> location1; tbs2 (oid2) -> location2 * and new segments are dbid1(primary), dbid2(mirror) The tablespace input file will be: ``` line1: tableSpaceNameOrders=tbs1:tbs2 line2: tableSpaceOidOrders=oid1:oid2 dbid1:loc1:loc2 ``` The template's pg_tblspc dir will be: oid1 oid2 dumps |_ oid1 | |__ xxx_dbDummyID | |_ oid2 |__ xxx_dbDummyID newTableSpaceInfo.json
Showing
想要评论请 注册 或 登录