int main_exec(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()) { sys_log(LOGSTDOUT, "error:main_exec: 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); sys_log(LOGSTDOUT, "======================================================================\n"); sys_log(LOGSTDOUT, " mod_mgr_default_init finished \n"); sys_log(LOGSTDOUT, "======================================================================\n"); mod_mgr_print(LOGSTDOUT, mod_mgr_def); mod_mgr_free(mod_mgr_def); do_slave_wait_default(); } #if 1 /*fwd rank entrance*/ else if (CMPI_FWD_RANK == this_rank) { sys_log(LOGSTDOUT,"======================================================================\n"); sys_log(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*/ sys_log(LOGSTDOUT,"======================================================================\n"); do_slave_wait_default(); } #endif /*work process*/ else { do_slave_wait_default(); } return (0); }
/** * * start CCURL module * **/ UINT32 ccurl_start() { CCURL_MD *ccurl_md; UINT32 ccurl_md_id; ccurl_md_id = cbc_md_new(MD_CCURL, sizeof(CCURL_MD)); if(ERR_MODULE_ID == ccurl_md_id) { return (ERR_MODULE_ID); } /* initilize new one CCURL module */ ccurl_md = (CCURL_MD *)cbc_md_get(MD_CCURL, ccurl_md_id); ccurl_md->usedcounter = 0; /* create a new module node */ init_static_mem(); CCURL_MD_MOD_MGR(ccurl_md) = mod_mgr_new(ccurl_md_id, /*LOAD_BALANCING_LOOP*//*LOAD_BALANCING_MOD*/LOAD_BALANCING_QUE); ccurl_md->usedcounter = 1; dbg_log(SEC_0030_CCURL, 5)(LOGSTDOUT, "ccurl_start: start CCURL module #%u\n", ccurl_md_id); return ( ccurl_md_id ); }
/** * * start VMATRIXR module * **/ UINT32 vmatrix_r_start( ) { VMATRIXR_MD *vmatrixr_md; UINT32 vmatrixr_md_id; UINT32 matrixr_md_id; UINT32 vmm_md_id; MOD_MGR *mod_mgr; TASK_BRD *task_brd; MOD_NODE *local_mod_node; vmatrixr_md_id = cbc_md_new(MD_VMATRIXR, sizeof(VMATRIXR_MD)); if(ERR_MODULE_ID == vmatrixr_md_id) { return (ERR_MODULE_ID); } /* initilize new one VMATRIXR module */ vmatrixr_md = (VMATRIXR_MD *)cbc_md_get(MD_VMATRIXR, vmatrixr_md_id); vmatrixr_md->usedcounter = 0; vmatrixr_md->matrixr_md_id = ERR_MODULE_ID; vmatrixr_md->vmm_md_id = ERR_MODULE_ID; /* create a new module node */ matrixr_md_id = ERR_MODULE_ID; vmm_md_id = ERR_MODULE_ID; init_static_mem(); /*default setting which will be override after vmatrix_r_set_mod_mgr calling*/ mod_mgr = mod_mgr_new(vmatrixr_md_id, LOAD_BALANCING_LOOP); task_brd = task_brd_default_get(); local_mod_node = &(vmatrixr_md->local_mod_node); MOD_NODE_TCID(local_mod_node) = TASK_BRD_TCID(task_brd); MOD_NODE_COMM(local_mod_node) = TASK_BRD_COMM(task_brd); MOD_NODE_RANK(local_mod_node) = TASK_BRD_RANK(task_brd); MOD_NODE_MODI(local_mod_node) = vmatrixr_md_id; matrixr_md_id = matrix_r_start(); vmm_md_id = vmm_start(); vmatrixr_md->mod_mgr = mod_mgr; vmatrixr_md->task_brd = task_brd; vmatrixr_md->matrixr_md_id = matrixr_md_id; vmatrixr_md->vmm_md_id = vmm_md_id; vmatrixr_md->usedcounter = 1; return ( vmatrixr_md_id ); }
int main_udp(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()) { sys_log(LOGSTDOUT, "error:main_trans: 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); sys_log(LOGSTDOUT, "======================================================================\n"); sys_log(LOGSTDOUT, " mod_mgr_default_init finished \n"); sys_log(LOGSTDOUT, "======================================================================\n"); mod_mgr_print(LOGSTDOUT, mod_mgr_def); mod_mgr_free(mod_mgr_def); do_slave_wait_default(); } /*fwd rank entrance*/ else if (c_ipv4_to_word("10.10.10.1") == this_tcid && CMPI_FWD_RANK == this_rank) { int sockfd; const char *mcast_ipaddr_str = "239.2.11.71";/*239.0.0.0бл239.255.255.255*/ UINT32 mcast_ipaddr; UINT32 mcast_port = 8888; mcast_ipaddr = c_ipv4_to_word(mcast_ipaddr_str); if(EC_FALSE == csocket_start_udp_mcast_recver(mcast_ipaddr, mcast_port, &sockfd)) { sys_log(LOGCONSOLE, "error:start udp server %s:%ld failed\n", mcast_ipaddr_str, mcast_port); } else { UINT8 data[256]; UINT32 dlen; sys_log(LOGCONSOLE, "start udp server %s:%ld\n", mcast_ipaddr_str, mcast_port); for(;EC_TRUE == csocket_udp_mcast_recvfrom(sockfd, mcast_ipaddr, mcast_port, data, sizeof(data)/sizeof(data[0]), &dlen);) { sys_log(LOGCONSOLE, "[DEBUG] recv udp data: %.*s\n", dlen, (char *)data); } csocket_stop_udp_mcast_recver(sockfd, mcast_ipaddr); } do_slave_wait_default(); } else if (c_ipv4_to_word("10.10.10.7") == this_tcid && CMPI_FWD_RANK == this_rank) { int sockfd; const char *mcast_ipaddr_str = "239.2.11.71"; UINT32 mcast_ipaddr; UINT32 mcast_port = 8888; UINT32 loop; mcast_ipaddr = c_ipv4_to_word(mcast_ipaddr_str); csocket_start_udp_mcast_sender(mcast_ipaddr, mcast_port, &sockfd); for(loop = 0; loop < 5; loop ++) { UINT8 data[256]; UINT32 dlen; snprintf((char *)data, sizeof(data)/sizeof(data[0]), "[loop %ld] hello world!", loop); dlen = strlen((char *)data); //dlen = sizeof(data)/sizeof(data[0]); if(EC_FALSE == csocket_udp_mcast_sendto(sockfd, mcast_ipaddr, mcast_port, data, dlen)) { sys_log(LOGSTDOUT, "error:send udp data to %s:%ld failed\n", mcast_ipaddr_str, mcast_port); break; } sys_log(LOGCONSOLE, "send udp data: %.*s\n", dlen, (char *)data); c_sleep(5); } csocket_stop_udp_mcast_sender(sockfd, c_ipv4_to_word(mcast_ipaddr_str)); do_slave_wait_default(); } else if (CMPI_FWD_RANK == this_rank) { sys_log(LOGSTDOUT,"======================================================================\n"); sys_log(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*/ sys_log(LOGSTDOUT,"======================================================================\n"); do_slave_wait_default(); } /*work process*/ else { do_slave_wait_default(); } return (0); }
int main_trans(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()) { sys_log(LOGSTDOUT, "error:main_trans: 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); sys_log(LOGSTDOUT, "======================================================================\n"); sys_log(LOGSTDOUT, " mod_mgr_default_init finished \n"); sys_log(LOGSTDOUT, "======================================================================\n"); mod_mgr_print(LOGSTDOUT, mod_mgr_def); mod_mgr_free(mod_mgr_def); do_slave_wait_default(); } /*fwd rank entrance*/ else if (c_ipv4_to_word("10.10.10.2") == this_tcid && CMPI_FWD_RANK == this_rank) { CSTRING *src_fname; CSTRING *des_fname; UINT32 des_tcid; src_fname = cstring_new((UINT8 *)"/home/ezhocha/bgn/bin/CentOS_4.4_DVD.iso", 0); des_fname = cstring_new((UINT8 *)"/home/ezhocha/bgn/bin/CentOS_4.4_DVD_des.iso", 0); des_tcid = c_ipv4_to_word("10.10.10.1"); super_transfer(0, src_fname, des_tcid, des_fname); do_slave_wait_default(); } else if (CMPI_FWD_RANK == this_rank) { sys_log(LOGSTDOUT,"======================================================================\n"); sys_log(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*/ sys_log(LOGSTDOUT,"======================================================================\n"); do_slave_wait_default(); } /*work process*/ else { do_slave_wait_default(); } return (0); }
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); }
/*check replica files*/ EC_BOOL test_case_85_crfs_check_file_content(const char *home, const UINT32 crfs_tcid, const UINT32 crfs_rank, const UINT32 crfs_modi, const UINT32 max_test_data_files, UINT32 *counter) { MOD_MGR *mod_mgr; TASK_MGR *task_mgr; UINT32 index; CSTRING *path[CRFS_TEST_READ_MAX_FILES]; EC_BOOL ret[CRFS_TEST_READ_MAX_FILES]; EC_BOOL continue_flag; for(index = 0; index < CRFS_TEST_READ_MAX_FILES; index ++) { path[ index ] = NULL_PTR; ret[ index ] = EC_FALSE; } mod_mgr = mod_mgr_new(CMPI_ERROR_MODI, LOAD_BALANCING_LOOP); mod_mgr_incl(crfs_tcid, CMPI_ANY_COMM, crfs_rank, crfs_modi, mod_mgr); sys_log(LOGSTDOUT, "test_case_85_crfs_check_file_content: npp mod mgr is\n"); mod_mgr_print(LOGSTDOUT, crfs_get_npp_mod_mgr(crfs_modi)); sys_log(LOGSTDOUT, "test_case_85_crfs_check_file_content: dn mod mgr is\n"); mod_mgr_print(LOGSTDOUT, crfs_get_dn_mod_mgr(crfs_modi)); task_mgr = task_new(mod_mgr, TASK_PRIO_NORMAL, TASK_NEED_RSP_FLAG, TASK_NEED_ALL_RSP); for(index = 0; index < CRFS_TEST_READ_MAX_FILES; index ++, (*counter) ++) { CBYTES *cbytes_des; cbytes_des = __test_crfs_fetch_g_cbytes(max_test_data_files, ((*counter) % max_test_data_files)); path[ index ] = cstring_new(NULL_PTR, 0); cstring_format(path[ index ], "%s/%ld.dat", home, (*counter)); ret[ index ] = EC_FALSE; task_inc(task_mgr, &(ret[ index ]), FI_crfs_check_file_is, ERR_MODULE_ID, path[ index ], cbytes_des); } task_wait(task_mgr, TASK_DEFAULT_LIVE, TASK_NEED_RESCHEDULE_FLAG, NULL_PTR); continue_flag = EC_TRUE; for(index = 0; index < CRFS_TEST_READ_MAX_FILES; index ++) { if(EC_TRUE == ret[ index ]) { sys_log(LOGSTDOUT, "[SUCC] path: %s\n", (char *)cstring_get_str(path[ index ])); } else { continue_flag = EC_FALSE; sys_log(LOGCONSOLE, "[FAIL] path: %s\n", (char *)cstring_get_str(path[ index ])); } if(NULL_PTR != path[ index ]) { cstring_free(path[ index ]); path[ index ] = NULL_PTR; } if(NULL_PTR != path[ index ]) { cstring_free(path[ index ]); path[ index ] = NULL_PTR; } } mod_mgr_free(mod_mgr); return (continue_flag); }
EC_BOOL test_case_83_crfs_write(const char *home, const UINT32 crfs_tcid, const UINT32 crfs_rank, const UINT32 crfs_modi, const UINT32 max_test_data_files, UINT32 *counter) { void *mod_mgr; void *task_mgr; UINT32 index; EC_BOOL continue_flag; CSTRING *path[CRFS_TEST_WRITE_MAX_FILES]; EC_BOOL ret[CRFS_TEST_WRITE_MAX_FILES]; for(index = 0; index < CRFS_TEST_WRITE_MAX_FILES; index ++) { path[ index ] = NULL_PTR; ret[ index ] = EC_FALSE; } mod_mgr = mod_mgr_new(CMPI_ERROR_MODI, LOAD_BALANCING_LOOP); mod_mgr_incl(crfs_tcid, CMPI_ANY_COMM, crfs_rank, crfs_modi, mod_mgr); #if 0 sys_log(LOGSTDOUT, "test_case_83_crfs_write: npp mod mgr is\n"); mod_mgr_print(LOGSTDOUT, crfs_get_npp_mod_mgr(crfs_modi)); sys_log(LOGSTDOUT, "test_case_83_crfs_write: dn mod mgr is\n"); mod_mgr_print(LOGSTDOUT, crfs_get_dn_mod_mgr(crfs_modi)); #endif task_mgr = task_new(mod_mgr, TASK_PRIO_NORMAL, TASK_NEED_RSP_FLAG, TASK_NEED_ALL_RSP); for(index = 0; index < CRFS_TEST_WRITE_MAX_FILES; index ++, (*counter) ++) { void *cbytes; path[ index ] = cstring_new(NULL_PTR, 0); cstring_format(path[ index ], "%s/%ld.dat", home, (*counter)); ret[ index ] = EC_FALSE; cbytes = __test_crfs_fetch_g_cbytes(max_test_data_files, ((*counter) % max_test_data_files)); if(NULL_PTR == cbytes) { sys_log(LOGSTDOUT, "error:test_case_83_crfs_write: crfs buff is null where index = %ld, max_test_data_files = %ld\n", index, max_test_data_files); cstring_free(path[ index ]); path[ index ] = NULL_PTR; break; } task_inc(task_mgr, &(ret[ index ]), FI_crfs_write, ERR_MODULE_ID, path[ index ], cbytes); } task_wait(task_mgr, TASK_DEFAULT_LIVE, TASK_NOT_NEED_RESCHEDULE_FLAG, NULL_PTR); continue_flag = EC_TRUE; for(index = 0; index < CRFS_TEST_WRITE_MAX_FILES; index ++) { if(EC_FALSE == ret[ index ] && NULL_PTR != path[ index ]) { continue_flag = EC_FALSE; sys_log(LOGCONSOLE, "test_case_83_crfs_write: [FAIL] %s\n", (char *)cstring_get_str(path[ index ])); } if(NULL_PTR != path[ index ]) { cstring_free(path[ index ]); path[ index ] = NULL_PTR; } } mod_mgr_free(mod_mgr); return (continue_flag); }
EC_BOOL test_case_82_crfs_read(const char *home, const UINT32 crfs_tcid, const UINT32 crfs_rank, const UINT32 crfs_modi, const UINT32 max_test_data_files, UINT32 *counter) { void *mod_mgr; void *task_mgr; UINT32 index; CSTRING *path[CRFS_TEST_READ_MAX_FILES]; CBYTES *cbytes[CRFS_TEST_READ_MAX_FILES];/*read from dn*/ CBYTES *cbytes_des[CRFS_TEST_READ_MAX_FILES];/*benchmark*/ EC_BOOL ret[CRFS_TEST_READ_MAX_FILES]; EC_BOOL continue_flag; for(index = 0; index < CRFS_TEST_READ_MAX_FILES; index ++) { path[ index ] = NULL_PTR; cbytes[ index ] = NULL_PTR; cbytes_des[ index ] = NULL_PTR; ret[ index ] = EC_FALSE; } mod_mgr = mod_mgr_new(CMPI_ERROR_MODI, LOAD_BALANCING_LOOP); mod_mgr_incl(crfs_tcid, CMPI_ANY_COMM, crfs_rank, crfs_modi, mod_mgr); #if 0 sys_log(LOGSTDOUT, "test_case_82_crfs_read: npp mod mgr is\n"); mod_mgr_print(LOGSTDOUT, crfs_get_npp_mod_mgr(crfs_modi)); sys_log(LOGSTDOUT, "test_case_82_crfs_read: dn mod mgr is\n"); mod_mgr_print(LOGSTDOUT, crfs_get_dn_mod_mgr(crfs_modi)); #endif task_mgr = task_new(mod_mgr, TASK_PRIO_NORMAL, TASK_NEED_RSP_FLAG, TASK_NEED_ALL_RSP); for(index = 0; index < CRFS_TEST_READ_MAX_FILES; index ++, (*counter) ++) { path[ index ] = cstring_new(NULL_PTR, 0); cstring_format(path[ index ], "%s/%ld.dat", home, (*counter)); cbytes[ index ] = cbytes_new(0); cbytes_des[ index ] = __test_crfs_fetch_g_cbytes(max_test_data_files, ((*counter) % max_test_data_files)); ret[ index ] = EC_FALSE; task_inc(task_mgr, &(ret[ index ]), FI_crfs_read, ERR_MODULE_ID, path[ index ], cbytes[ index ]); } task_wait(task_mgr, TASK_DEFAULT_LIVE, TASK_NEED_RESCHEDULE_FLAG, NULL_PTR); continue_flag = EC_TRUE; for(index = 0; index < CRFS_TEST_READ_MAX_FILES; index ++) { if(NULL_PTR != cbytes[ index ]) { if(EC_TRUE == cbytes_ncmp(cbytes[ index ], cbytes_des[ index ], 16)) { sys_log(LOGSTDOUT, "[SUCC] path: %s, len = %ld ", (char *)cstring_get_str(path[ index ]), cbytes_len(cbytes[ index ])); sys_print(LOGSTDOUT, "text = %.*s\n", cbytes_len(cbytes[ index ]) > 16 ? 16 : cbytes_len(cbytes[ index ]), /*output up to 16 chars*/ (char *)cbytes_buf(cbytes[ index ])); } else { continue_flag = EC_FALSE; sys_log(LOGCONSOLE, "[FAIL] path: %s, read len = %ld ", (char *)cstring_get_str(path[ index ]), cbytes_len(cbytes[ index ])); sys_print(LOGCONSOLE, "text = %.*s <--> ", cbytes_len(cbytes[ index ]) > 16 ? 16 : cbytes_len(cbytes[ index ]), /*output up to 16 chars*/ (char *)cbytes_buf(cbytes[ index ])); sys_print(LOGCONSOLE, "expect len = %ld ", cbytes_len(cbytes_des[ index ])); sys_print(LOGCONSOLE, "text = %.*s\n", cbytes_len(cbytes_des[ index ]) > 16 ? 16 : cbytes_len(cbytes_des[ index ]), (char *)cbytes_buf(cbytes_des[ index ])); } } if(NULL_PTR != path[ index ]) { cstring_free(path[ index ]); path[ index ] = NULL_PTR; } if(NULL_PTR != cbytes[ index ]) { cbytes_free(cbytes[ index ], 0); cbytes[ index ] = NULL_PTR; } if(NULL_PTR != cbytes_des[ index ]) { cbytes_des[ index ] = NULL_PTR; } } mod_mgr_free(mod_mgr); return (continue_flag); }
void test_case_cbgt_delete_group_p(const UINT32 cbgt_md_id, const char *table_name, const UINT32 row_tag) { UINT32 row_idx; UINT32 colf_idx; UINT32 colq_idx; CBYTES table_name_bytes; void *mod_mgr; EC_BOOL continue_flag; ASSERT(mod_mgr = mod_mgr_new(cbgt_md_id, LOAD_BALANCING_OBJ)); mod_mgr_incl(CMPI_LOCAL_TCID, CMPI_LOCAL_COMM, CMPI_LOCAL_RANK, cbgt_md_id, mod_mgr); mod_mgr_print(LOGCONSOLE, mod_mgr); cbytes_mount(&table_name_bytes, strlen(table_name), (UINT8 *)table_name); continue_flag = EC_TRUE; for(row_idx = 0; row_idx < CBGT_TEST_ROW_NUM && EC_TRUE == continue_flag; row_idx ++) { char *row; CBYTES *row_bytes; ASSERT(row = (char *)safe_malloc(CBGT_STR_MAX_LEN, 0)); snprintf(row, CBGT_STR_MAX_LEN, "row-%08ld-%08ld", row_tag, row_idx); ASSERT(row_bytes = cbytes_new(0)); cbytes_mount(row_bytes , strlen(row) , (UINT8 *)row ); //cvector_push(bytes_vec, (void *)row_bytes); for(colf_idx = 0; colf_idx < CBGT_TEST_COLF_NUM && EC_TRUE == continue_flag; colf_idx ++) { char *colf; CBYTES *colf_bytes; void *task_mgr; void *bytes_vec; EC_BOOL ret[CBGT_TEST_COLQ_NUM]; ASSERT(bytes_vec = cvector_new(0, MM_CBYTES, 0)); ASSERT(colf = (char *)safe_malloc(CBGT_STR_MAX_LEN, 0)); snprintf(colf, CBGT_STR_MAX_LEN, "colf-%ld", colf_idx); ASSERT(colf_bytes = cbytes_new(0)); cbytes_mount(colf_bytes , strlen(colf) , (UINT8 *)colf ); task_mgr = task_new(mod_mgr, TASK_PRIO_NORMAL, TASK_NEED_RSP_FLAG, TASK_NEED_ALL_RSP); for(colq_idx = 0; colq_idx < CBGT_TEST_COLQ_NUM && EC_TRUE == continue_flag; colq_idx ++) { char *colq; CBYTES *colq_bytes; ASSERT(colq = (char *)safe_malloc(CBGT_STR_MAX_LEN, 0)); snprintf(colq, CBGT_STR_MAX_LEN, "colq-%08ld-%08ld-%08ld", row_idx, colf_idx, colq_idx); ASSERT(colq_bytes = cbytes_new(0)); cbytes_mount(colq_bytes , strlen(colq) , (UINT8 *)colq ); cvector_push(bytes_vec, (void *)colq_bytes); ret[ colq_idx ] = EC_FALSE; task_inc(task_mgr, &(ret[ colq_idx ]), FI_cbgt_delete, ERR_MODULE_ID, &table_name_bytes, row_bytes, colf_bytes, colq_bytes); } task_wait(task_mgr, TASK_DEFAULT_LIVE, TASK_NEED_RESCHEDULE_FLAG, NULL_PTR); for(colq_idx = 0; colq_idx < CBGT_TEST_COLQ_NUM; colq_idx ++) { if(EC_TRUE == ret[ colq_idx ]) { sys_log(LOGSTDNULL, "[DEBUG] test_case_cbgt_delete_group_p: [SUCC] delete %s %s:%s:colq-%08ld-%08ld-%08ld\n", table_name, row, colf, row_idx, colf_idx, colq_idx); } else { //continue_flag = EC_FALSE; sys_log(LOGCONSOLE, "[DEBUG] test_case_cbgt_delete_group_p: [FAIL] delete %s %s:%s:colq-%08ld-%08ld-%08ld\n", table_name, row, colf, row_idx, colf_idx, colq_idx); } } cbytes_free(colf_bytes, 0); cvector_clean_with_location(bytes_vec, (CVECTOR_DATA_LOCATION_CLEANER)cbytes_free, 0); cvector_free(bytes_vec, 0); } cbytes_free(row_bytes, 0); if(EC_TRUE == continue_flag) { sys_log(LOGCONSOLE, "[DEBUG] test_case_cbgt_delete_group_p: [SUCC] row tag %ld, row no. %ld\n", row_tag, row_idx); } else { sys_log(LOGCONSOLE, "[DEBUG] test_case_cbgt_delete_group_p: [FAIL] row tag %ld, row no. %ld\n", row_tag, row_idx); } } sys_log(LOGCONSOLE, "[DEBUG] test_case_cbgt_delete_group_p: row tag %ld end\n", row_tag); return; }
int main_csolr(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: 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); //test_case_61(mod_mgr_def); //test_case_62(mod_mgr_def); //test_case_63(mod_mgr_def); //test_case_64(mod_mgr_def); //test_case_66(mod_mgr_def); //test_case_67(mod_mgr_def); mod_mgr_free(mod_mgr_def); do_slave_wait_default(); } #if 0 /*fwd rank entrance*/ else if (CMPI_FWD_RANK == this_rank) { 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"); do_slave_wait_default(); } #endif /*user define the master process*/ else if (c_ipv4_to_word("10.10.10.1") == this_tcid && 1 == this_rank) { UINT32 csolr_md_id; csolr_md_id = csolr_start(); task_brd_default_start_csolr_srv(csolr_md_id, task_brd_default_get_srv_ipaddr(), 58111); csolr_add_mod(csolr_md_id, c_ipv4_to_word("10.10.10.1")); csolr_add_mod(csolr_md_id, c_ipv4_to_word("10.10.10.2")); do_slave_wait_default(); } else if (c_ipv4_to_word("10.10.10.2") == this_tcid && 1 == this_rank) { UINT32 csolr_md_id; csolr_md_id = csolr_start(); task_brd_default_start_csolr_srv(csolr_md_id, task_brd_default_get_srv_ipaddr(), 58112); csolr_add_mod(csolr_md_id, c_ipv4_to_word("10.10.10.1")); csolr_add_mod(csolr_md_id, c_ipv4_to_word("10.10.10.2")); do_slave_wait_default(); } #if 1 /*fwd rank entrance*/ else if (CMPI_FWD_RANK == this_rank) { 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"); do_slave_wait_default(); } #endif /*work process*/ else { do_slave_wait_default(); } return (0); }