From: <m-k...@us...> - 2015-01-05 08:07:36
|
Revision: 9384 http://sourceforge.net/p/gfarm/code/9384 Author: m-kasahr Date: 2015-01-05 08:07:34 +0000 (Mon, 05 Jan 2015) Log Message: ----------- At startup, gfmd does multi-master check before applying journal. (#807) Modified Paths: -------------- gfarm_v2/branches/2.6/server/gfmd/gfmd.c Modified: gfarm_v2/branches/2.6/server/gfmd/gfmd.c =================================================================== --- gfarm_v2/branches/2.6/server/gfmd/gfmd.c 2015-01-05 02:10:35 UTC (rev 9383) +++ gfarm_v2/branches/2.6/server/gfmd/gfmd.c 2015-01-05 08:07:34 UTC (rev 9384) @@ -1557,7 +1557,8 @@ int syslog_facility = GFARM_DEFAULT_FACILITY; int ch, sock, table_size; sigset_t sigs; - int is_master, file_trace = 0; + int is_master, replication_enabled; + int file_trace = 0; if (argc >= 1) program_name = basename(argv[0]); @@ -1775,9 +1776,15 @@ "create_detached_thread(resumer): %s", gfarm_error_string(e)); - if (gfarm_get_metadb_replication_enabled()) + replication_enabled = gfarm_get_metadb_replication_enabled(); + is_master = mdhost_self_is_master(); + if (replication_enabled) start_db_journal_threads(); - if (mdhost_self_is_master()) { + if (is_master) { + if (replication_enabled && gfmdc_is_master_gfmd_running()) { + gflog_fatal(GFARM_MSG_1003840, + "another master gfmd is already running"); + } /* these functions write db, thus, must be after db_thread */ inode_remove_orphan(); /* should be before inode_check_and_repair() */ @@ -1785,20 +1792,15 @@ quota_check(); } inode_free_orphan(); - if (gfarm_get_metadb_replication_enabled()) { - is_master = mdhost_self_is_master(); + if (replication_enabled) { gflog_info(GFARM_MSG_1002737, "metadata replication %s mode", is_master ? "master" : "slave"); start_gfmdc_threads(); gfmd_startup_state_notify_ready(); - if (is_master) { - if (gfmdc_is_master_gfmd_running()) { - gflog_fatal(GFARM_MSG_1003840, - "another master gfmd is already running"); - } + if (is_master) sock = open_accepting_socket(gfmd_port); - } else + else sock = wait_transform_to_master(gfmd_port); } else sock = open_accepting_socket(gfmd_port); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |