EC_BOOL __test_cscore_cbgt_root_server_runner() { UINT32 cbgt_md_id; CSTRING *cbgt_db_root_dir; CBYTES root_table_name; cbgt_db_root_dir = task_brd_default_get_hsbgt_root_table_dir(); ASSERT(NULL_PTR != cbgt_db_root_dir); cbytes_mount(&root_table_name, strlen("root"), (UINT8 *)"root"); cbgt_md_id = cbgt_start(CBGT_TYPE_ROOT_SERVER, CBGT_ROOT_TABLE_ID, &root_table_name, NULL_PTR, cbgt_db_root_dir, CBGT_O_RDWR | CBGT_O_CREAT); test_case_cbgt_create_table_on_root(cbgt_md_id, CSCORE_MD_DEFAULT_TABLE_NAME, 1, CSCORE_MD_DEFAULT_COLF_NAME ); ASSERT(ERR_MODULE_ID != cbgt_md_id); dbg_log(SEC_0137_DEMO, 9)(LOGSTDOUT, "[DEBUG] __test_cscore_cbgt_root_server_runner: ============================ root server started ====================\n"); return (EC_TRUE); }
EC_BOOL __test_cbgt_delete_client_1_runner() { UINT32 cbgt_md_id; CSTRING *cbgt_db_root_dir; cbgt_db_root_dir = task_brd_default_get_hsbgt_root_table_dir(); ASSERT(NULL_PTR != cbgt_db_root_dir); cbgt_md_id = cbgt_start(CBGT_TYPE_USER_CLIENT, CBGT_ERR_TABLE_ID, NULL_PTR, NULL_PTR, cbgt_db_root_dir, CBGT_O_UNDEF); ASSERT(ERR_MODULE_ID != cbgt_md_id); sys_log(LOGSTDOUT, "[DEBUG] __test_cbgt_delete_client_1_runner: ============================ user client started ====================\n"); test_case_cbgt_delete_group_p(cbgt_md_id, "hansoul", 10101021); cbgt_end(cbgt_md_id); return (EC_TRUE); }
EC_BOOL __test_cbgt_root_runner() { UINT32 cbgt_md_id; CSTRING *cbgt_db_root_dir; CBYTES root_table_name; extern UINT32 g_cbtree_key_cmp_counter; extern UINT32 g_do_slave_usleep_counter; cbgt_db_root_dir = task_brd_default_get_hsbgt_root_table_dir(); ASSERT(NULL_PTR != cbgt_db_root_dir); cbytes_mount(&root_table_name, strlen("root"), (UINT8 *)"root"); cbgt_md_id = cbgt_start(CBGT_TYPE_ROOT_SERVER, CBGT_ROOT_TABLE_ID, &root_table_name, NULL_PTR, cbgt_db_root_dir, CBGT_O_RDWR | CBGT_O_CREAT); ASSERT(ERR_MODULE_ID != cbgt_md_id); #if 1 sys_log(LOGSTDOUT, "[DEBUG] __test_cbgt_root_runner: ============================ root server started ====================\n"); test_case_cbgt_create_table_on_root(cbgt_md_id, "hansoul", 3, "colf-0", "colf-1", "colf-2"); g_cbtree_key_cmp_counter = 0; g_do_slave_usleep_counter = 0; __test_cbgt_insert_client_1_runner(); //sys_log(LOGCONSOLE, "[DEBUG] __test_cbgt_root_runner: after insert, g_cbtree_key_cmp_counter = %ld\n", g_cbtree_key_cmp_counter); //sys_log(LOGCONSOLE, "[DEBUG] __test_cbgt_root_runner: after insert, g_do_slave_usleep_counter = %ld\n", g_do_slave_usleep_counter); #endif //g_cbtree_key_cmp_counter = 0; //g_do_slave_usleep_counter = 0; //__test_cbgt_delete_client_1_runner(); //sys_log(LOGCONSOLE, "[DEBUG] __test_cbgt_root_runner: after delete, g_cbtree_key_cmp_counter = %ld\n", g_cbtree_key_cmp_counter); //sys_log(LOGCONSOLE, "[DEBUG] __test_cbgt_root_runner: after insert, g_do_slave_usleep_counter = %ld\n", g_do_slave_usleep_counter); g_cbtree_key_cmp_counter = 0; g_do_slave_usleep_counter = 0; __test_cbgt_fetch_client_1_runner(); sys_log(LOGCONSOLE, "[DEBUG] __test_cbgt_root_runner: after fetch, g_cbtree_key_cmp_counter = %ld\n", g_cbtree_key_cmp_counter); sys_log(LOGCONSOLE, "[DEBUG] __test_cbgt_root_runner: after insert, g_do_slave_usleep_counter = %ld\n", g_do_slave_usleep_counter); return (EC_TRUE); }
int main_cscore0(int argc, char **argv) { UINT32 this_tcid; UINT32 this_comm; UINT32 this_rank; task_brd_default_init(argc, argv); if(EC_FALSE == task_brd_default_check_validity()) { dbg_log(SEC_0137_DEMO, 0)(LOGSTDOUT, "error:main_cscore: validity checking failed\n"); task_brd_default_abort(); return (-1); } this_tcid = task_brd_default_get_tcid(); this_comm = task_brd_default_get_comm(); this_rank = task_brd_default_get_rank(); if (EC_TRUE == task_brd_check_is_dbg_tcid(this_tcid) && CMPI_DBG_RANK == this_rank) { do_cmd_default(); } else if (EC_TRUE == task_brd_check_is_monitor_tcid(this_tcid) && CMPI_MON_RANK == this_rank) { void * mod_mgr_def; mod_mgr_def = mod_mgr_new(CMPI_ERROR_MODI, LOAD_BALANCING_LOOP); mod_mgr_default_init(mod_mgr_def, CMPI_ANY_TCID, CMPI_ANY_RANK); //mod_mgr_excl(this_tcid, CMPI_ANY_COMM, this_rank, CMPI_ANY_MODI, mod_mgr_def); dbg_log(SEC_0137_DEMO, 5)(LOGSTDOUT, "======================================================================\n"); dbg_log(SEC_0137_DEMO, 5)(LOGSTDOUT, " mod_mgr_default_init finished \n"); dbg_log(SEC_0137_DEMO, 5)(LOGSTDOUT, "======================================================================\n"); mod_mgr_print(LOGSTDOUT, mod_mgr_def); mod_mgr_free(mod_mgr_def); do_slave_wait_default(); } else if (c_ipv4_to_word("10.10.10.1") == this_tcid && 1 == this_rank) { UINT32 cbgt_md_id; CSTRING *cbgt_db_root_dir; CBYTES root_table_name; cbgt_db_root_dir = task_brd_default_get_hsbgt_root_table_dir(); ASSERT(NULL_PTR != cbgt_db_root_dir); cbytes_mount(&root_table_name, strlen("root"), (UINT8 *)"root"); cbgt_md_id = cbgt_start(CBGT_TYPE_ROOT_SERVER, CBGT_ROOT_TABLE_ID, &root_table_name, NULL_PTR, cbgt_db_root_dir, CBGT_O_RDWR | CBGT_O_CREAT); test_case_cbgt_create_table_on_root(cbgt_md_id, CSCORE_MD_DEFAULT_TABLE_NAME, 1, CSCORE_MD_DEFAULT_COLF_NAME ); ASSERT(ERR_MODULE_ID != cbgt_md_id); dbg_log(SEC_0137_DEMO, 9)(LOGSTDOUT, "[DEBUG] main_cbgt: ============================ root server started ====================\n"); do_slave_wait_default(); } /*fwd rank entrance*/ else if (c_ipv4_to_word("10.10.10.2") == this_tcid && 1 == this_rank) { UINT32 cscore_md_id; dbg_log(SEC_0137_DEMO, 5)(LOGSTDOUT,"======================================================================\n"); dbg_log(SEC_0137_DEMO, 5)(LOGSTDOUT," taskc_mgr in (tcid %s, rank %ld) \n", c_word_to_ipv4(this_tcid), this_rank); super_show_work_client(task_brd_default_get_super(), LOGSTDOUT);/*debug only*/ dbg_log(SEC_0137_DEMO, 5)(LOGSTDOUT,"======================================================================\n"); cscore_md_id = cscore_start(); ASSERT(ERR_MODULE_ID != cscore_md_id ); dbg_log(SEC_0137_DEMO, 9)(LOGSTDOUT, "[DEBUG] main_cscore: cscore_md_id = %ld\n", cscore_md_id); //test_case_cscore_001(cscore_md_id); //test_case_cscore_002(cscore_md_id); //test_case_cscore_003(cscore_md_id); //test_case_cscore_004(cscore_md_id); test_case_cscore_005(cscore_md_id); cscore_end(cscore_md_id); do_slave_wait_default(); } /*work process*/ else { do_slave_wait_default(); } return (0); }