void init() { StringBuffer xpath("Software/ThorCluster[@name=\""); xpath.append(clusterName).append("\"]"); Owned<IRemoteConnection> conn = querySDS().connect("/Environment", myProcessSession(), RTM_LOCK_READ, SDS_LOCK_TIMEOUT); environment.setown(createPTreeFromIPT(conn->queryRoot())); options = environment->queryPropTree(xpath.str()); if (!options) throwUnexpected(); groupName.set(options->queryProp("@nodeGroup")); if (groupName.isEmpty()) groupName.set(options->queryProp("@name")); VStringBuffer spareS("%s_spares", groupName.get()); spareGroupName.set(spareS); group.setown(queryNamedGroupStore().lookup(groupName)); spareGroup.setown(queryNamedGroupStore().lookup(spareGroupName)); }
void processMessage(CMessageBuffer &mb) { ICoven &coven=queryCoven(); MemoryBuffer params; params.swapWith(mb); int fn; params.read(fn); switch (fn) { case MDR_GET_VALUE: { StringAttr id; StringBuffer buf; params.read(id); if (0 == stricmp(id,"threads")) { mb.append(getThreadList(buf).str()); } else if (0 == stricmp(id, "mpqueue")) { mb.append(getReceiveQueueDetails(buf).str()); } else if (0 == stricmp(id, "locks")) { mb.append(querySDS().getLocks(buf).str()); } else if (0 == stricmp(id, "sdsstats")) { mb.append(querySDS().getUsageStats(buf).str()); } else if (0 == stricmp(id, "connections")) { mb.append(querySDS().getConnections(buf).str()); } else if (0 == stricmp(id, "sdssubscribers")) { mb.append(querySDS().getSubscribers(buf).str()); } else if (0 == stricmp(id, "clients")) { mb.append(querySessionManager().getClientProcessList(buf).str()); } else if (0 == stricmp(id, "subscriptions")) { mb.append(getSubscriptionList(buf).str()); } else if (0 == stricmp(id, "mpverify")) { queryWorldCommunicator().verifyAll(buf); mb.append(buf.str()); } else if (0 == stricmp(id, "extconsistency")) { mb.append(querySDS().getExternalReport(buf).str()); } else if (0 == stricmp(id, "build")) { mb.append("$Id: dadiags.cpp 62376 2011-02-04 21:59:58Z sort $"); } else if (0 == stricmp(id, "sdsfetch")) { StringAttr branchpath; params.read(branchpath); Linked<IPropertyTree> sroot = querySDSServer().lockStoreRead(); try { sroot->queryPropTree(branchpath)->serialize(mb); } catch (...) { querySDSServer().unlockStoreRead(); throw; } querySDSServer().unlockStoreRead(); } else if (0 == stricmp(id, "perf")) { getSystemTraceInfo(buf,PerfMonStandard); mb.append(buf.str()); } else if (0 == stricmp(id, "sdssize")) { StringAttr branchpath; params.read(branchpath); Linked<IPropertyTree> sroot = querySDSServer().lockStoreRead(); StringBuffer sbuf; try { toXML(sroot->queryPropTree(branchpath),sbuf); DBGLOG("sdssize '%s' = %d",branchpath.get(),sbuf.length()); } catch (...) { querySDSServer().unlockStoreRead(); throw; } querySDSServer().unlockStoreRead(); mb.append(sbuf.length()); } else if (0 == stricmp(id, "disconnect")) { StringAttr client; params.read(client); SocketEndpoint ep(client); PROGLOG("Dalidiag request to close client connection: %s", client.get()); Owned<INode> node = createINode(ep); queryCoven().disconnect(node); } else if (0 == stricmp(id, "unlock")) { __int64 connectionId; bool disconnect; params.read(connectionId); params.read(disconnect); PROGLOG("Dalidiag request to unlock connection id: %" I64F "x", connectionId); StringBuffer connectionInfo; bool success = querySDSServer().unlock(connectionId, disconnect, connectionInfo); mb.append(success); if (success) mb.append(connectionInfo); } else if (0 == stricmp(id, "save")) { PROGLOG("Dalidiag requests SDS save"); querySDSServer().saveRequest(); } else if (0 == stricmp(id, "settracetransactions")) { PROGLOG("Dalidiag requests Trace Transactions"); if(traceAllTransactions(true)) mb.append("OK - no change"); else mb.append("OK - transaction tracing enabled"); } else if (0 == stricmp(id, "cleartracetransactions")) { PROGLOG("Dalidiag requests Trace Transactions stopped"); if(traceAllTransactions(false)) mb.append("OK - transaction tracing disabled"); else mb.append("OK - no change"); } else if (0 == stricmp(id, "setldapflags")) { unsigned f; params.read(f); PROGLOG("Dalidiag requests setldapflags %d",f); querySessionManager().setLDAPflags(f); } else if (0 == stricmp(id, "getldapflags")) { unsigned f=querySessionManager().getLDAPflags();; mb.append(f); } else if (0 == stricmp(id, "setsdsdebug")) { PROGLOG("Dalidiag setsdsdebug"); unsigned p; params.read(p); StringArray arr; while (p--) { StringAttr s; params.read(s); arr.append(s); } StringBuffer reply; bool success = querySDSServer().setSDSDebug(arr, reply); mb.append(success).append(reply); } else mb.append(StringBuffer("UNKNOWN OPTION: ").append(id).str()); } break; } coven.reply(mb); }