diff --git a/ChaosMetadataService/api/control_unit/SendStorageBurst.cpp b/ChaosMetadataService/api/control_unit/SendStorageBurst.cpp index fc934e43f115a320aefe560aaff3f0a90c00726f..6dcf9ff84c338e56517f7b2dd526c63f438e227e 100644 --- a/ChaosMetadataService/api/control_unit/SendStorageBurst.cpp +++ b/ChaosMetadataService/api/control_unit/SendStorageBurst.cpp @@ -95,6 +95,8 @@ CDataWrapper *SendStorageBurst::execute(CDataWrapper *api_data, batch_data->addStringValue(chaos::RpcActionDefinitionKey::CS_CMDM_ACTION_NAME, chaos::ControlUnitNodeDomainAndActionRPC::ACTION_STORAGE_BURST); batch_data->addCSDataValue(chaos::RpcActionDefinitionKey::CS_CMDM_ACTION_MESSAGE, *burst_ser); //launch the batch command + CU_RNU_DBG<<"Sending Command:"<<batch_data->getCompliantJSONString(); + command_id = getBatchExecutor()->submitCommand(std::string(GET_MDS_COMMAND_ALIAS(batch::node::SendRpcCommand)), batch_data.release()); } diff --git a/ChaosMetadataService/cache_system/CouchbaseCacheDriver.cpp b/ChaosMetadataService/cache_system/CouchbaseCacheDriver.cpp index ec97fc69909a9b3056eb2c74c680655b26aeeed8..8c5068fdac0e8f0eb6fc5719308cb5e3527382a0 100644 --- a/ChaosMetadataService/cache_system/CouchbaseCacheDriver.cpp +++ b/ChaosMetadataService/cache_system/CouchbaseCacheDriver.cpp @@ -315,7 +315,7 @@ int CouchbaseCacheDriver::updateConfig() { CCDLDBG_ << "session params:"<<create_options.v.v3.connstr; } - lcb_U32 newval = 2000000; // Set to 4 seconds + lcb_U32 newval = COUCHBASE_DEFAULT_TIMEOUT; if((last_err=lcb_cntl(instance, LCB_CNTL_SET, LCB_CNTL_OP_TIMEOUT, &newval))!=LCB_SUCCESS){ CCDLERR_<< "Cannot set OP Timeout -> " << lcb_strerror(NULL, last_err); return -2; diff --git a/ChaosMetadataService/cache_system/CouchbaseCacheDriver.h b/ChaosMetadataService/cache_system/CouchbaseCacheDriver.h index b4d42efa5e42545f49b94d21be92ddc18eda2946..e4d39ced68376cd5c59670378117988b2ba2764f 100644 --- a/ChaosMetadataService/cache_system/CouchbaseCacheDriver.h +++ b/ChaosMetadataService/cache_system/CouchbaseCacheDriver.h @@ -32,7 +32,7 @@ #include <boost/lockfree/queue.hpp> #include <boost/thread.hpp> - +#define COUCHBASE_DEFAULT_TIMEOUT 5000000 namespace chaos { namespace data_service { namespace cache_system { diff --git a/chaos/common/data/CDataWrapper.h b/chaos/common/data/CDataWrapper.h index ed8bfcb8d011596eee5bf14d7795d90f9300c093..81b0ed98065b758a53391740b3be3015beba39a9 100644 --- a/chaos/common/data/CDataWrapper.h +++ b/chaos/common/data/CDataWrapper.h @@ -61,12 +61,12 @@ namespace chaos { buffer = 0L; disposeOnDelete = true; if(iBuff && iSize){ - buffer = (char*)malloc(iSize); + buffer = (char*)new char[iSize]; std::memcpy(buffer, iBuff, iSize); } } ~SerializationBuffer(){ - if(disposeOnDelete && buffer) free(buffer); + if(disposeOnDelete && buffer) delete [](buffer); } size_t getBufferLen(){return bSize;}; const char *getBufferPtr(){return buffer;}; diff --git a/chaos/common/data/cache/AttributeValue.cpp b/chaos/common/data/cache/AttributeValue.cpp index eb6657f7f8fe66840245ef2516110367d465131a..80f1296cf7daa9e70373d80cb62a32a9ccd65de9 100644 --- a/chaos/common/data/cache/AttributeValue.cpp +++ b/chaos/common/data/cache/AttributeValue.cpp @@ -123,7 +123,7 @@ bool AttributeValue::setStringValue(const std::string& value, CHAOS_ASSERT(value_buffer) std::strncpy(static_cast<char*>(value_buffer), value.c_str(), - size-1); + size); return true; } diff --git a/chaos/common/message/MultiAddressMessageChannel.cpp b/chaos/common/message/MultiAddressMessageChannel.cpp index 0646d83d154342a748850d9297cf82d8d0a7a887..94e872e6cbce61b7fc7af0a0be04cae6cb624995 100644 --- a/chaos/common/message/MultiAddressMessageChannel.cpp +++ b/chaos/common/message/MultiAddressMessageChannel.cpp @@ -154,12 +154,12 @@ void MultiAddressMessageChannel::sendMessage(const std::string& action_domain, CDataWrapper *message_pack, bool on_this_thread) { MMCFeederService *service = static_cast<MMCFeederService*>(service_feeder.getService()); - if(service) { + if(service ) { MessageChannel::sendMessage(service->ip_port, action_domain, action_name, message_pack); - DEBUG_CODE(MAMC_DBG << "Sent message to:" << service->ip_port;) + DEBUG_CODE(MAMC_DBG << "Sent message dom:'"<<action_domain<<"' action:'"<<action_name<<"' port:'" << service->ip_port<<"'" " msg:"<<(message_pack?message_pack->getCompliantJSONString():"NULL");) } } @@ -172,12 +172,13 @@ ChaosUniquePtr<MessageRequestFuture> MultiAddressMessageChannel::_sendRequestWit ChaosUniquePtr<MessageRequestFuture> result; MMCFeederService *service = static_cast<MMCFeederService*>(service_feeder.getService()); bool has_been_found_a_server = (service!=NULL); - if(has_been_found_a_server) { + if(has_been_found_a_server ) { result = MessageChannel::sendRequestWithFuture((used_remote_address = service->ip_port), action_domain, action_name, request_pack); - DEBUG_CODE(MAMC_DBG << "Sent request to:" << used_remote_address;) + DEBUG_CODE(MAMC_DBG << "Sent Future message dom:'"<<action_domain<<"' action:'"<<action_name<<"' port:'" << service->ip_port<<"'" " msg:"<<(request_pack?request_pack->getCompliantJSONString():"NULL");) + } else { used_remote_address.clear(); } diff --git a/chaos/common/metric/MetricCollector.cpp b/chaos/common/metric/MetricCollector.cpp index afd76a61d4dcfc5dafad228e667cc56fcec1a9ec..099a59b1698e70a34c8ec477236426470d838fcb 100644 --- a/chaos/common/metric/MetricCollector.cpp +++ b/chaos/common/metric/MetricCollector.cpp @@ -57,7 +57,10 @@ stat_intervall(update_time_in_sec*1000){ } if(!on_console && !on_file) { - throw CException(-1, "No metric backdend selected for collector", __PRETTY_FUNCTION__); + MC_INFO<< "% No metric output selected for collector, redirecting to default. To redirect output use options:'"<<InitOption::OPT_LOG_METRIC_ON_FILE<<"' and '"<<InitOption::OPT_LOG_METRIC_ON_FILE_PATH<<"'" ; + addBackend(metric::MetricBackendPointer(new metric::ConsoleMetricBackend(collector_name))); + // per una cavolata non parte l'MDS + //throw CException(-1, "No metric output selected for collector", __PRETTY_FUNCTION__); } } diff --git a/chaos/cu_toolkit/control_manager/AbstractControlUnit.cpp b/chaos/cu_toolkit/control_manager/AbstractControlUnit.cpp index e954177132831b9cd67630d131df03212a7aa4a2..6bb3cba429318a90318da1117d8890574ca8e9f7 100644 --- a/chaos/cu_toolkit/control_manager/AbstractControlUnit.cpp +++ b/chaos/cu_toolkit/control_manager/AbstractControlUnit.cpp @@ -369,7 +369,7 @@ void AbstractControlUnit::_defineActionAndDataset(CDataWrapper& setup_configurat &AbstractControlUnit::_submitStorageBurst, ControlUnitNodeDomainAndActionRPC::ACTION_STORAGE_BURST, "Execute a storage burst on control unit"); - action_description->addParam(ControlUnitNodeDefinitionKey::CONTROL_UNIT_DATASET_HISTORY_BURST_TAG, DataType::TYPE_STRING, "Tag asosciated to the stored data during burst"); + action_description->addParam(ControlUnitNodeDefinitionKey::CONTROL_UNIT_DATASET_HISTORY_BURST_TAG, DataType::TYPE_STRING, "Tag associated to the stored data during burst"); action_description->addParam(ControlUnitNodeDefinitionKey::CONTROL_UNIT_DATASET_HISTORY_BURST_TYPE, DataType::TYPE_INT32, "The type of burst"); action_description->addParam(ControlUnitNodeDefinitionKey::CONTROL_UNIT_DATASET_HISTORY_BURST_VALUE, DataType::TYPE_UNDEFINED, "The value of the burst is defined by the type"); @@ -1473,7 +1473,7 @@ chaos::common::data::CDataWrapper* AbstractControlUnit::_submitStorageBurst(CDat ACULERR_ << CHAOS_FORMAT("The value is mandatory for burst %1%", %data->getJSONString()); return NULL; } - + ACULDBG_<<"Enabling burst:"<<data->getCompliantJSONString(); LQueueBurstWriteLock wl = burst_queue.getWriteLockObject(); burst_queue().push(burst); return NULL; @@ -2025,6 +2025,7 @@ void AbstractControlUnit::manageBurstQueue() { } burst_queue().pop(); //set the tag for burst + ACULDBG_<<"===Start Burst tag:'"<<current_burst->dataset_burst->tag<<"' ===="; key_data_storage->addTag(current_burst->dataset_burst->tag); key_data_storage->setTimingConfigurationBehaviour(false); key_data_storage->setOverrideStorageType(DataServiceNodeDefinitionType::DSStorageTypeHistory); @@ -2037,6 +2038,8 @@ void AbstractControlUnit::manageBurstQueue() { if(!current_burst->active(timestamp_acq_cached_value->getValuePtr<int64_t>())) { //remove the tag for the burst + ACULDBG_<<"=== End Burst tag:'"<<current_burst->dataset_burst->tag<<"' ======="; + key_data_storage->removeTag(current_burst->dataset_burst->tag); key_data_storage->setTimingConfigurationBehaviour(true); key_data_storage->setOverrideStorageType(DataServiceNodeDefinitionType::DSStorageTypeUndefined); diff --git a/tools/chaos_services.sh b/tools/chaos_services.sh index 2ad8740ffddd5d36a8430ce6b02a5d1d6a9ea9c2..06c68b8a520d34bbe4f8aeff5e42dbc779d1669b 100755 --- a/tools/chaos_services.sh +++ b/tools/chaos_services.sh @@ -72,7 +72,7 @@ start_mds(){ else info_mesg "starting MDS..." "($CHAOS_LIVE_SERVERS)($CHAOS_DB_SERVERS)" - run_proc "$CHAOS_PREFIX/bin/$MDS_EXEC --conf-file $CHAOS_PREFIX/etc/mds.cfg $CHAOS_OVERALL_OPT $CHAOS_MDS_OPT --log-file $CHAOS_PREFIX/log/$MDS_EXEC.$MYPID.log > $CHAOS_PREFIX/log/$MDS_EXEC.$MYPID.std.out 2>&1 &" "$MDS_EXEC" + run_proc "$CHAOS_SERVICE_ENV $CHAOS_PREFIX/bin/$MDS_EXEC --conf-file $CHAOS_PREFIX/etc/mds.cfg $CHAOS_OVERALL_OPT $CHAOS_MDS_OPT --log-file $CHAOS_PREFIX/log/$MDS_EXEC.$MYPID.log > $CHAOS_PREFIX/log/$MDS_EXEC.$MYPID.std.out 2>&1 &" "$MDS_EXEC" # echo "$CHAOS_PREFIX/bin/$MDS_EXEC --conf-file $CHAOS_PREFIX/etc/mds.cfg $CHAOS_OVERALL_OPT $CHAOS_MDS_OPT --log-file $CHAOS_PREFIX/log/$MDS_EXEC.log" >> $CHAOS_PREFIX/log/$MDS_EXEC.std.out if execute_command_until_ok "grep \"Data Service published\" $CHAOS_PREFIX/log/$MDS_EXEC.$MYPID.log" 120;then @@ -104,7 +104,7 @@ start_ui(){ info_mesg "starting " "webui.." # check_proc_then_kill "$CHAOS_PREFIX/bin/$UI_EXEC" - run_proc "$CHAOS_PREFIX/bin/$UI_EXEC --conf-file $CHAOS_PREFIX/etc/webui.cfg $port $CHAOS_OVERALL_OPT --log-file $CHAOS_PREFIX/log/webui.$MYPID.log > $CHAOS_PREFIX/log/$UI_EXEC.$MYPID.std.out 2>&1 &" "$UI_EXEC" + run_proc "$CHAOS_SERVICE_ENV $CHAOS_PREFIX/bin/$UI_EXEC --conf-file $CHAOS_PREFIX/etc/webui.cfg $port $CHAOS_OVERALL_OPT --log-file $CHAOS_PREFIX/log/webui.$MYPID.log > $CHAOS_PREFIX/log/$UI_EXEC.$MYPID.std.out 2>&1 &" "$UI_EXEC" fi # echo "$CHAOS_PREFIX/bin/$UI_EXEC --conf-file $CHAOS_PREFIX/etc/webui.cfg $port $CHAOS_OVERALL_OPT --log-file $CHAOS_PREFIX/log/webui.log" >> $CHAOS_PREFIX/log/$UI_EXEC.std.out } @@ -115,7 +115,7 @@ start_agent(){ else info_mesg "starting " "agent" - run_proc "$CHAOS_PREFIX/bin/$AGENT_EXEC --conf-file $CHAOS_PREFIX/etc/agent.cfg $CHAOS_OVERALL_OPT --log-on-file --log-file $CHAOS_PREFIX/log/agent.$MYPID.log > $CHAOS_PREFIX/log/$AGENT_EXEC.$MYPID.std.out 2>&1 &" "$AGENT_EXEC" + run_proc "$CHAOS_SERVICE_ENV $CHAOS_PREFIX/bin/$AGENT_EXEC --conf-file $CHAOS_PREFIX/etc/agent.cfg $CHAOS_OVERALL_OPT --log-on-file --log-file $CHAOS_PREFIX/log/agent.$MYPID.log > $CHAOS_PREFIX/log/$AGENT_EXEC.$MYPID.std.out 2>&1 &" "$AGENT_EXEC" fi } diff --git a/tools/common_util.sh b/tools/common_util.sh index a3cd5604d6f78c11bd8eaa65eba01407254aa41b..144ec5c8f324b7670e95bf184f16b6d3a7cba00b 100644 --- a/tools/common_util.sh +++ b/tools/common_util.sh @@ -12,8 +12,11 @@ export LC_ALL="en_US.UTF-8" export CHAOS_OVERALL_OPT="--event-disable 1 --log-max-size 200" export CHAOS_MDS_OPT="" export CHAOS_DEBUG_CMD="" -export CHAOS_RUN_ENV="" ## envirnoment to apply to run appliction i.e checkers +## CHAOS_RUN_ENV="" ## environment to apply to run appliction i.e checkers +## CHAOS_SERVICE_ENV ## environment to apply to services (mds,webui,agent) export CHAOS_EXTERNAL_MDS="" + + if [ -n "$CHAOS_DEBUG_CMD_TOOL" ];then CHAOS_DEBUG_CMD=$CHAOS_DEBUG_CMD_TOOL fi @@ -537,26 +540,34 @@ test_services(){ return 1 fi } -start_services(){ - - if $tools/chaos_services.sh start mds; then - ok_mesg "chaos start MDS/CDS" +services(){ + command_line="$1" + if $tools/chaos_services.sh $command_line mds; then + ok_mesg "chaos $command_line MDS/CDS" else - nok_mesg "chaos start MDS/CDS" + nok_mesg "chaos $command_line MDS/CDS" return 1 fi - if $tools/chaos_services.sh start webui; then - ok_mesg "chaos start WEBUI, sleeping 10s" + if $tools/chaos_services.sh $command_line webui; then + ok_mesg "chaos $command_line WEBUI, sleeping 10s" sleep 10 else - nok_mesg "chaos start WEBUI" + nok_mesg "chaos $command_line WEBUI" return 1 fi return 0 } +stop_services(){ + services "stop" +} + +start_services(){ + services "start" + +} start_mds(){ if $tools/chaos_services.sh start mds; then ok_mesg "chaos start mds" diff --git a/tools/generateGoogleProfilePdf.sh b/tools/generateGoogleProfilePdf.sh index 83f1b9d507f281e3c71f924b8505ab7d3f1ef296..b43d50b41c9ab481382648bb93b27c4fab452592 100755 --- a/tools/generateGoogleProfilePdf.sh +++ b/tools/generateGoogleProfilePdf.sh @@ -17,5 +17,10 @@ for heapf in $heapls;do else echo "## error processing $heapf" fi + if google-pprof $2/$pname "$heapf" --inuse_objects --lines --heapcheck --edgefraction=1e-10 --nodefraction=1e-10 --web > $pname.$ppid.svg;then + echo "* generated $pname.$ppid.svg" + else + echo "## error processing $heapf" + fi fi done