提交 efed2fcc 编写于 作者: X Xin Zhang 提交者: Xin Zhang

Add new primary and mirror in gp_segment_configuration as not-in-sync.

Under SEGWALREP, the mode for gp_segment_configuration is 'n' for
not-in-sync and 's' for in-sync.

When new primary or mirror is added to the cluster, the initial state of
the mode should be 'n' instead of 's' (in the original filerep mode.)

If mirror exists and synchronized with the primary, then the mode will
be updated to 's' to indicate the primary-mirror pair are in-sync.
Signed-off-by: NAshwin Agrawal <aagrawal@pivotal.io>
上级 aecb8e69
......@@ -782,7 +782,11 @@ gp_add_segment_primary(PG_FUNCTION_ARGS)
new.db.dbid = get_availableDbId();
new.db.role = SEGMENT_ROLE_PRIMARY;
new.db.preferred_role = SEGMENT_ROLE_PRIMARY;
#ifdef USE_SEGWALREP
new.db.mode = GP_SEGMENT_CONFIGURATION_MODE_NOTINSYNC;
#else
new.db.mode = GP_SEGMENT_CONFIGURATION_MODE_INSYNC;
#endif
new.db.status = GP_SEGMENT_CONFIGURATION_STATUS_UP;
new.db.filerep_port = -1;
......@@ -853,6 +857,11 @@ gp_add_segment(PG_FUNCTION_ARGS)
mirroring_sanity_check(MASTER_ONLY | SUPERUSER, "gp_add_segment");
#ifdef USE_SEGWALREP
new.db.mode = GP_SEGMENT_CONFIGURATION_MODE_NOTINSYNC;
elog(NOTICE, "mode is changed to GP_SEGMENT_CONFIGURATION_MODE_NOTINSYNC under walrep.");
#endif
add_segment(new, fsmap);
PG_RETURN_INT16(new.db.dbid);
......@@ -941,7 +950,11 @@ gp_add_segment_mirror(PG_FUNCTION_ARGS)
mirroring_sanity_check(MASTER_ONLY | SUPERUSER, "gp_add_segment_mirror");
new.db.dbid = get_availableDbId();
#ifdef USE_SEGWALREP
new.db.mode = GP_SEGMENT_CONFIGURATION_MODE_NOTINSYNC;
#else
new.db.mode = GP_SEGMENT_CONFIGURATION_MODE_INSYNC;
#endif
new.db.status = GP_SEGMENT_CONFIGURATION_STATUS_UP;
new.db.role = SEGMENT_ROLE_MIRROR;
new.db.preferred_role = SEGMENT_ROLE_MIRROR;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册