小型化删除共享存储

This commit is contained in:
chendong76
2023-01-03 19:24:36 +08:00
parent aef96219b4
commit cc44099d9e
13 changed files with 76 additions and 6 deletions

View File

@ -193,7 +193,7 @@ endif()
if("${ENABLE_MULTIPLE_NODES}" STREQUAL "OFF")
install(DIRECTORY ${DCF_LIB_PATH} DESTINATION .)
endif()
if(${ENABLE_MULTIPLE_NODES}_${ENABLE_PRIVATEGAUSS} STREQUAL OFF_OFF)
if(${ENABLE_MULTIPLE_NODES}_${ENABLE_PRIVATEGAUSS} STREQUAL OFF_OFF AND NOT ${ENABLE_LITE_MODE} STREQUAL ON)
if(EXISTS ${DMS_LIB_PATH})
install(DIRECTORY ${DMS_LIB_PATH} DESTINATION .)
endif()

View File

@ -3797,7 +3797,9 @@ static void usage(const char* prog_name)
#ifndef ENABLE_MULTIPLE_NODES
printf(_(" -c, --enable-dcf enable DCF mode\n"));
#endif
#ifndef ENABLE_LITE_MODE
printf(_(" --enable-dss enable shared storage mode\n"));
#endif
printf(_(" [-D, --pgdata=]DATADIR location for this database cluster\n"));
#ifdef ENABLE_MULTIPLE_NODES
printf(_(" --nodename=NODENAME name of openGauss node initialized\n"));
@ -3805,9 +3807,11 @@ static void usage(const char* prog_name)
#else
printf(_(" --nodename=NODENAME name of single node initialized\n"));
#endif
#ifndef ENABLE_LITE_MODE
printf(_(" --vgname=VGNAME name of dss volume group\n"));
printf(_(" --socketpath=SOCKETPATH\n"
" dss connect socket file path\n"));
#endif
printf(_(" -E, --encoding=ENCODING set default encoding for new databases\n"));
printf(_(" --locale=LOCALE set default locale for new databases\n"));
printf(_(" --dbcompatibility=DBCOMPATIBILITY set default dbcompatibility for new database\n"));
@ -3891,6 +3895,7 @@ static bool is_file_exist(const char* path)
return isExist;
}
#ifndef ENABLE_LITE_MODE
static void parse_vgname_args(char* args)
{
vgname = xstrdup(args);
@ -3920,6 +3925,7 @@ static void parse_vgname_args(char* args)
exit(1);
}
}
#endif
int main(int argc, char* argv[])
{
@ -4255,6 +4261,7 @@ int main(int argc, char* argv[])
}
g_bucket_len = atoi(optarg);
break;
#ifndef ENABLE_LITE_MODE
case 15:
FREE_NOT_STATIC_ZERO_STRING(vgname);
FREE_NOT_STATIC_ZERO_STRING(vgdata);
@ -4274,6 +4281,7 @@ int main(int argc, char* argv[])
check_input_spec_char(optarg);
ss_nodedatainfo = xstrdup(optarg);
break;
#endif
default:
/* getopt_long already emitted a complaint */
write_stderr(_("Try \"%s --help\" for more information.\n"), progname);

View File

@ -43,11 +43,13 @@ static void usage(const char* prog_name)
printf(_("Usage:\n"));
printf(_(" %s [OPTION] [DATADIR]\n"), prog_name);
printf(_("\nOptions:\n"));
#ifndef ENABLE_LITE_MODE
printf(_(" -I, --instance-id=INSTANCE_ID\n"));
printf(_(" display information of specified instance (default all)\n"));
printf(_(" --enable-dss enable shared storage mode\n"));
printf(_(" --socketpath=SOCKETPATH\n"));
printf(_(" dss connect socket file path\n"));
#endif
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -?, --help show this help, then exit\n"));
printf(_("\nIf no data directory (DATADIR) is specified, "
@ -263,6 +265,7 @@ int main(int argc, char* argv[])
while ((option_value = getopt_long(argc, argv, "I:V", long_options, &option_index)) != -1) {
switch (option_value) {
#ifndef ENABLE_LITE_MODE
case 'I':
if (atoi(optarg) < MIN_INSTANCEID || atoi(optarg) > MAX_INSTANCEID) {
fprintf(stderr, _("%s: unexpected node id specified, valid range is %d - %d\n"),
@ -279,6 +282,7 @@ int main(int argc, char* argv[])
enable_dss = true;
socketpath = strdup(optarg);
break;
#endif
default:
/* getopt_long already emitted a complaint */
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);

View File

@ -86,8 +86,10 @@ void help_pg_probackup(void)
printf(_(" [--remote-path=path] [--remote-user=username]\n"));
printf(_(" [--remote-port=port] [--ssh-options=ssh_options]\n"));
printf(_(" [--remote-libpath=libpath]\n"));
#ifndef ENABLE_LITE_MODE
printf(_(" [--enable-dss] [--instance-id=instance_id]\n"));
printf(_(" [--vgname=\"vgdata,vglog\"] [--socketpath=socketpath]\n"));
#endif
printf(_(" [--help]\n"));
printf(_("\n %s del-instance -B backup-path --instance=instance_name\n"), PROGRAM_NAME);
@ -113,8 +115,10 @@ void help_pg_probackup(void)
printf(_(" [--remote-path=path] [--remote-user=username]\n"));
printf(_(" [--remote-port=port] [--ssh-options=ssh_options]\n"));
printf(_(" [--remote-libpath=libpath]\n"));
#ifndef ENABLE_LITE_MODE
printf(_(" [--enable-dss] [--instance-id=instance_id]\n"));
printf(_(" [--vgname=\"vgdata,vglog\"] [--socketpath=socketpath]\n"));
#endif
printf(_(" [--help]\n"));
printf(_("\n %s set-backup -B backup-path --instance=instance_name -i backup-id\n"), PROGRAM_NAME);
@ -157,8 +161,10 @@ void help_pg_probackup(void)
printf(_(" [--remote-path=path] [--remote-user=username]\n"));
printf(_(" [--remote-port=port] [--ssh-options=ssh_options]\n"));
printf(_(" [--remote-libpath=libpath]\n"));
#ifndef ENABLE_LITE_MODE
printf(_(" [--enable-dss] [--instance-id=instance_id]\n"));
printf(_(" [--vgname=\"vgdata,vglog\"] [--socketpath=socketpath]\n"));
#endif
printf(_(" [--ttl=interval] [--expire-time=time]\n"));
printf(_(" [--backup-pg-replslot]\n"));
printf(_(" [--help]\n"));
@ -175,8 +181,10 @@ void help_pg_probackup(void)
printf(_(" [--remote-path=path] [--remote-user=username]\n"));
printf(_(" [--remote-port=port] [--ssh-options=ssh_options]\n"));
printf(_(" [--remote-libpath=libpath]\n"));
#ifndef ENABLE_LITE_MODE
printf(_(" [--enable-dss] [--instance-id=instance_id]\n"));
printf(_(" [--vgname=\"vgdata,vglog\"] [--socketpath=socketpath]\n"));
#endif
printf(_(" [--log-level-console=log-level-console]\n"));
printf(_(" [--log-level-file=log-level-file]\n"));
printf(_(" [--log-filename=log-filename]\n"));
@ -246,8 +254,10 @@ static void help_add_instance(void)
printf(_(" [--remote-port=port] [--ssh-options=ssh_options]\n\n"));
printf(_(" [--remote-libpath=libpath]\n"));
printf(_(" [--remote-port=port] [--ssh-options=ssh_options]\n"));
#ifndef ENABLE_LITE_MODE
printf(_(" [--enable-dss] [--instance-id=instance_id]\n"));
printf(_(" [--vgname=\"vgdata,vglog\"] [--socketpath=socketpath]\n\n"));
#endif
printf(_(" -B, --backup-path=backup-path location of the backup storage area\n"));
printf(_(" -D, --pgdata=pgdata-path location of the database storage area\n"));
@ -268,11 +278,13 @@ static void help_add_instance(void)
printf(_(" --ssh-options=ssh_options additional ssh options (default: none)\n"));
printf(_(" (example: --ssh-options='-c cipher_spec -F configfile')\n"));
#ifndef ENABLE_LITE_MODE
printf(_("\n DSS options:\n"));
printf(_(" --enable-dss enable shared storage mode\n"));
printf(_(" --vgname=\"vgdata,vglog\" name of dss volume group\n"));
printf(_(" --instance-id=instance_id instance id of backup node\n"));
printf(_(" --socketpath=socketpath dss connect socket file path\n\n"));
#endif
}
static void help_del_instance(void)
@ -306,8 +318,10 @@ static void help_set_config(void)
printf(_(" [--remote-port=port] [--ssh-options=ssh_options]\n\n"));
printf(_(" [--remote-libpath=libpath]\n"));
printf(_(" [--remote-port=port] [--ssh-options=ssh_options]\n"));
#ifndef ENABLE_LITE_MODE
printf(_(" [--enable-dss] [--instance-id=instance_id]\n"));
printf(_(" [--vgname=\"vgdata,vglog\"] [--socketpath=socketpath]\n\n"));
#endif
printf(_(" -B, --backup-path=backup-path location of the backup storage area\n"));
printf(_(" --instance=instance_name name of the instance\n"));
@ -370,11 +384,13 @@ static void help_set_config(void)
printf(_(" --ssh-options=ssh_options additional ssh options (default: none)\n"));
printf(_(" (example: --ssh-options='-c cipher_spec -F configfile')\n"));
#ifndef ENABLE_LITE_MODE
printf(_("\n DSS options:\n"));
printf(_(" --enable-dss enable shared storage mode\n"));
printf(_(" --vgname=\"vgdata,vglog\" name of dss volume group\n"));
printf(_(" --instance-id=instance_id instance id of backup node\n"));
printf(_(" --socketpath=socketpath dss connect socket file path\n\n"));
#endif
}
static void help_set_backup(void)
@ -446,8 +462,10 @@ static void help_backup(void)
printf(_(" [--remote-path=path] [--remote-user=username]\n"));
printf(_(" [--remote-port=port] [--ssh-options=ssh_options]\n"));
printf(_(" [--remote-libpath=libpath]\n"));
#ifndef ENABLE_LITE_MODE
printf(_(" [--enable-dss] [--instance-id=instance_id]\n"));
printf(_(" [--vgname=\"vgdata,vglog\"] [--socketpath=socketpath]\n"));
#endif
printf(_(" [--ttl=interval] [--expire-time=time]\n\n"));
printf(_(" [--backup-pg-replslot]\n"));
@ -535,11 +553,13 @@ static void help_backup(void)
printf(_(" --ssh-options=ssh_options additional ssh options (default: none)\n"));
printf(_(" (example: --ssh-options='-c cipher_spec -F configfile')\n"));
#ifndef ENABLE_LITE_MODE
printf(_("\n DSS options:\n"));
printf(_(" --enable-dss enable shared storage mode\n"));
printf(_(" --vgname=\"vgdata,vglog\" name of dss volume group\n"));
printf(_(" --instance-id=instance_id instance id of backup node\n"));
printf(_(" --socketpath=socketpath dss connect socket file path\n"));
#endif
printf(_("\n Pinning options:\n"));
printf(_(" --ttl=interval pin backup for specified amount of time; 0 unpin\n"));
@ -563,8 +583,10 @@ static void help_restore(void)
printf(_(" [--remote-path=path] [--remote-user=username]\n"));
printf(_(" [--remote-port=port] [--ssh-options=ssh_options]\n"));
printf(_(" [--remote-libpath=libpath]\n"));
#ifndef ENABLE_LITE_MODE
printf(_(" [--enable-dss] [--instance-id=instance_id]\n"));
printf(_(" [--vgname=\"vgdata,vglog\"] [--socketpath=socketpath]\n"));
#endif
printf(_(" [--log-level-console=log-level-console]\n"));
printf(_(" [--log-level-file=log-level-file]\n"));
printf(_(" [--log-filename=log-filename]\n"));
@ -613,11 +635,13 @@ static void help_restore(void)
printf(_(" --ssh-options=ssh_options additional ssh options (default: none)\n"));
printf(_(" (example: --ssh-options='-c cipher_spec -F configfile')\n"));
#ifndef ENABLE_LITE_MODE
printf(_("\n DSS options:\n"));
printf(_(" --enable-dss enable shared storage mode\n"));
printf(_(" --vgname=\"vgdata,vglog\" name of dss volume group\n"));
printf(_(" --instance-id=instance_id instance id of backup node\n"));
printf(_(" --socketpath=socketpath dss connect socket file path\n"));
#endif
printf(_("\n Logging options:\n"));
printf(_(" --log-level-console=log-level-console\n"));

View File

@ -927,14 +927,14 @@ compress_init(void)
static void dss_init(void)
{
if (instance_config.dss.enable_dss) {
if (IsDssMode()) {
/* skip in some special backup modes */
if (backup_subcmd == DELETE_CMD || backup_subcmd == DELETE_INSTANCE_CMD) {
return;
}
/* register for dssapi */
if (dss_device_init(instance_config.dss.socketpath, instance_config.dss.enable_dss) != DSS_SUCCESS) {
if (dss_device_init(instance_config.dss.socketpath, IsDssMode()) != DSS_SUCCESS) {
elog(ERROR, "fail to init dss device");
return;
}

View File

@ -26,7 +26,11 @@
strspn(fname, "0123456789ABCDEF") == XLOG_FNAME_LEN && \
strcmp((fname) + XLOG_FNAME_LEN, ".gz.part") == 0)
#ifdef ENABLE_LITE_MODE
#define IsDssMode() false
#else
#define IsDssMode() (instance_config.dss.enable_dss == true)
#endif
#define IsSshProtocol() (instance_config.remote.host && strcmp(instance_config.remote.proto, "ssh") == 0)
/* directory options */

View File

@ -225,6 +225,7 @@ int main(int argc, char* argv[])
minXlogSegNo = (uint64)log_temp * XLogSegmentsPerXLogId + seg_temp;
break;
#ifndef ENABLE_LITE_MODE
case 1:
dss.enable_dss = true;
break;
@ -236,6 +237,7 @@ int main(int argc, char* argv[])
case 3:
dss.vgname = strdup(optarg);
break;
#endif
default:
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
@ -1182,11 +1184,13 @@ static void usage(void)
printf(_(" -V, --version output version information, then exit\n"));
printf(_(" -x XID set next transaction ID\n"));
printf(_(" -?, --help show this help, then exit\n"));
#ifndef ENABLE_LITE_MODE
printf(_(" --vgname\n"));
printf(_(" the dss data on dss mode\n"));
printf(_(" --enable-dss enable shared storage mode\n"));
printf(_(" --socketpath=SOCKETPATH\n"));
printf(_(" dss connect socket file path\n"));
#endif
#if ((defined(ENABLE_MULTIPLE_NODES)) || (defined(ENABLE_PRIVATEGAUSS)))
printf("\nReport bugs to GaussDB support.\n");
#else

View File

@ -671,6 +671,7 @@ endif
ifneq ($(with_openeuler_os), yes)
cp '$(LIBOPENSSL_BIN_PATH)/openssl' '$(DESTDIR)$(bindir)/openssl'
ifeq ($(enable_multiple_nodes), no)
ifeq ($(enable_lite_mode), no)
cp '$(DCF_LIB_PATH)/libdcf.so' '$(DESTDIR)$(libdir)/libdcf.so'
@if test -f $(DSS_LIB_PATH)/libdssaio.so; then cp $(DSS_LIB_PATH)/libdssaio.so $(DESTDIR)$(libdir)/libdssaio.so; fi
@if test -f $(DSS_LIB_PATH)/libdssapi.so; then cp $(DSS_LIB_PATH)/libdssapi.so $(DESTDIR)$(libdir)/libdssapi.so; fi
@ -681,6 +682,7 @@ ifeq ($(enable_multiple_nodes), no)
@if test -f $(DMS_LIB_PATH)/libdms.so; then cp $(DMS_LIB_PATH)/libdms.so $(DESTDIR)$(libdir)/libdms.so; fi
@if test -f $(top_builddir)/src/gausskernel/ddes/script/dms_contrl.sh; then cp $(top_builddir)/src/gausskernel/ddes/script/dms_contrl.sh $(DESTDIR)$(bindir)/dms_contrl.sh; fi
@if test -f $(top_builddir)/src/gausskernel/ddes/script/dss_contrl.sh; then cp $(top_builddir)/src/gausskernel/ddes/script/dss_contrl.sh $(DESTDIR)$(bindir)/dss_contrl.sh; fi
endif
endif
cp '$(ZSTD_LIB_PATH)'/libzstd.so* '$(DESTDIR)$(libdir)/'

View File

@ -8,7 +8,9 @@ set(CMAKE_MODULE_PATH
${PROJECT_OPENGS_DIR}/src/gausskernel/ddes/adapter
)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/script/dms_contrl.sh DESTINATION bin)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/script/dss_contrl.sh DESTINATION bin)
if(NOT "${ENABLE_LITE_MODE}" STREQUAL "ON")
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/script/dms_contrl.sh DESTINATION bin)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/script/dss_contrl.sh DESTINATION bin)
endif()
add_subdirectory(adapter)

View File

@ -25,6 +25,7 @@
#include "ddes/dms/ss_aio.h"
#include "utils/elog.h"
#ifndef ENABLE_LITE_MODE
static void WaitDSSAioComplete(DSSAioCxt *aio_cxt, int index)
{
AioUtil *aio = &aio_cxt->aio[index];
@ -59,9 +60,11 @@ static void WaitDSSAioComplete(DSSAioCxt *aio_cxt, int index)
0, sizeof(struct io_event) * DSS_AIO_BATCH_SIZE);
securec_check_c(ret, "\0", "\0");
}
#endif
void DSSAioFlush(DSSAioCxt *aio_cxt)
{
#ifndef ENABLE_LITE_MODE
bool need_wait = false;
AioUtil *aio = &aio_cxt->aio[aio_cxt->index];
if (aio->iocount > 0) {
@ -81,10 +84,12 @@ void DSSAioFlush(DSSAioCxt *aio_cxt)
if (need_wait) {
WaitDSSAioComplete(aio_cxt, aio_cxt->index);
}
#endif
}
void DSSAioAppendIOCB(DSSAioCxt *aio_cxt, struct iocb *iocb_ptr)
{
#ifndef ENABLE_LITE_MODE
AioUtil *aio = &aio_cxt->aio[aio_cxt->index];
aio->iocbs_ptr[aio->iocount] = iocb_ptr;
aio->iocount++;
@ -100,6 +105,7 @@ void DSSAioAppendIOCB(DSSAioCxt *aio_cxt, struct iocb *iocb_ptr)
WaitDSSAioComplete(aio_cxt, aio_cxt->index);
}
}
#endif
}
struct iocb* DSSAioGetIOCB(DSSAioCxt *aio_cxt)
@ -116,6 +122,7 @@ int DSSAioGetIOCBIndex(DSSAioCxt *aio_cxt)
void DSSAioInitialize(DSSAioCxt *aio_cxt, aio_callback callback)
{
#ifndef ENABLE_LITE_MODE
errno_t err = memset_s(aio_cxt, sizeof(DSSAioCxt), 0, sizeof(DSSAioCxt));
securec_check_ss(err, "\0", "\0");
@ -131,10 +138,12 @@ void DSSAioInitialize(DSSAioCxt *aio_cxt, aio_callback callback)
aio_cxt->initialized = true;
aio_cxt->aiocb = callback;
aio_cxt->index = 0;
#endif
}
void DSSAioDestroy(DSSAioCxt *aio_cxt)
{
#ifndef ENABLE_LITE_MODE
if (aio_cxt->initialized) {
(void)io_destroy(aio_cxt->aio[0].handle);
(void)io_destroy(aio_cxt->aio[1].handle);
@ -142,5 +151,6 @@ void DSSAioDestroy(DSSAioCxt *aio_cxt)
errno_t err = memset_s(aio_cxt, sizeof(DSSAioCxt), 0, sizeof(DSSAioCxt));
securec_check_ss(err, "\0", "\0");
}
#endif
}

View File

@ -737,7 +737,7 @@ static SyncStandbyNumState check_sync_standbys_num(const SyncRepStandbyData* syn
{
int i;
int* num_group_standbys;
const SyncRepStandbyData* stby;
const SyncRepStandbyData* stby = sync_standbys;
SyncStandbyNumState res = STANDBIES_ENOUGH;

View File

@ -31,10 +31,17 @@
#include "dms_api.h"
#include "ss_init.h"
#ifdef ENABLE_LITE_MODE
#define ENABLE_DMS false
#define ENABLE_SS_LOG false
#define ENABLE_REFORM false
#define ENABLE_VERIFY_PAGE_VERSION false
#else
#define ENABLE_DMS (g_instance.attr.attr_storage.dms_attr.enable_dms && !IsInitdb)
#define ENABLE_SS_LOG (g_instance.attr.attr_storage.dms_attr.enable_log_level)
#define ENABLE_REFORM (g_instance.attr.attr_storage.dms_attr.enable_reform)
#define ENABLE_VERIFY_PAGE_VERSION (g_instance.attr.attr_storage.dms_attr.enable_verify_page)
#endif
#define SS_REFORM_REFORMER \
(ENABLE_DMS && (g_instance.dms_cxt.SSReformInfo.in_reform == true) \

View File

@ -467,8 +467,13 @@ extern bool CheckExecDirectPrivilege(const char* query); /* check user have priv
u_sess->misc_cxt.Mode = (mode); \
} while (0)
#ifdef ENABLE_LITE_MODE
#define ENABLE_DSS false
#define ENABLE_DSS_AIO false
#else
#define ENABLE_DSS (g_instance.attr.attr_storage.dss_attr.ss_enable_dss)
#define ENABLE_DSS_AIO (ENABLE_DSS && g_instance.attr.attr_storage.dms_attr.enable_dss_aio && !IsInitdb)
#endif
/*
* Auxiliary-process type identifiers.