diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2021-01-26 14:16:56 +0000 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2021-01-26 14:16:56 +0000 |
commit | 3639e4ee775700cbccb6d2f602de6c5e23e5c86e (patch) | |
tree | 390c90931a52edef4c7c79430116b5c93ef3a8bf | |
parent | d9ba2a8100f1fa6b6844f58b884595c123770a8a (diff) |
SL-14570 - inventory validation info to ViewerStats, added QA mode setting to exercise failure cases
-rw-r--r-- | indra/newview/app_settings/settings.xml | 13 | ||||
-rw-r--r-- | indra/newview/llinventorymodel.cpp | 47 | ||||
-rw-r--r-- | indra/newview/llinventorymodel.h | 8 | ||||
-rw-r--r-- | indra/newview/llviewerstats.cpp | 6 |
4 files changed, 70 insertions, 4 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 52dc4744f2..535f1d24e1 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8315,7 +8315,18 @@ <key>QAModeMetrics</key> <map> <key>Comment</key> - <string>"Enables QA features (logging, faster cycling) for metrics collector"</string> + <string>Enables QA features (logging, faster cycling) for metrics collector</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> + <key>QAModeFakeSystemFolderIssues</key> + <map> + <key>Comment</key> + <string>Simulates system folder issues in inventory</string> <key>Persist</key> <integer>1</integer> <key>Type</key> diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index ff007c2f39..6e30a31e6d 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -27,6 +27,7 @@ #include "llviewerprecompiledheaders.h" #include <typeinfo> +#include <random> #include "llinventorymodel.h" @@ -136,7 +137,8 @@ bool LLCanCache::operator()(LLInventoryCategory* cat, LLInventoryItem* item) ///---------------------------------------------------------------------------- LLInventoryValidationInfo::LLInventoryValidationInfo(): mFatalErrorCount(0), - mWarningCount(0) + mWarningCount(0), + mInitialized(false) { } @@ -145,12 +147,38 @@ void LLInventoryValidationInfo::toOstream(std::ostream& os) const os << "mFatalErrorCount " << mFatalErrorCount << " mWarningCount " << mWarningCount; } + std::ostream& operator<<(std::ostream& os, const LLInventoryValidationInfo& v) { v.toOstream(os); return os; } +void LLInventoryValidationInfo::asLLSD(LLSD& sd) const +{ + sd["fatal_error_count"] = mFatalErrorCount; + sd["warning_count"] = mWarningCount; + sd["initialized"] = mInitialized; + sd["missing_system_folders_count"] = LLSD::Integer(mMissingRequiredSystemFolders.size()); + if (mMissingRequiredSystemFolders.size()>0) + { + sd["missing_system_folders"] = LLSD::emptyArray(); + for(auto ft: mMissingRequiredSystemFolders) + { + sd["missing_system_folders"].append(LLFolderType::lookup(ft)); + } + } + sd["duplicate_system_folders_count"] = LLSD::Integer(mDuplicateRequiredSystemFolders.size()); + if (mDuplicateRequiredSystemFolders.size()>0) + { + sd["duplicate_system_folders"] = LLSD::emptyArray(); + for(auto ft: mDuplicateRequiredSystemFolders) + { + sd["duplicate_system_folders"].append(LLFolderType::lookup(ft)); + } + } + +} ///---------------------------------------------------------------------------- /// Class LLInventoryModel @@ -184,7 +212,8 @@ LLInventoryModel::LLInventoryModel() mHttpPriorityFG(0), mHttpPriorityBG(0), mCategoryLock(), - mItemLock() + mItemLock(), + mValidationInfo(new LLInventoryValidationInfo) {} @@ -2628,6 +2657,8 @@ void LLInventoryModel::buildParentChildMap() { mIsAgentInvUsable = true; } + validation_info->mInitialized = true; + mValidationInfo = validation_info; // notifyObservers() has been moved to // llstartup/idle_startup() after this func completes. @@ -4092,6 +4123,10 @@ LLPointer<LLInventoryValidationInfo> LLInventoryModel::validate() const { LL_DEBUGS("Inventory") << "Folder type " << fit->first << " count " << fit->second << " elsewhere" << LL_ENDL; } + + static LLCachedControl<bool> fake_system_folder_issues(gSavedSettings, "QAModeFakeSystemFolderIssues", false); + static std::default_random_engine e{}; + static std::uniform_int_distribution<> distrib(0, 1); for (S32 ft=LLFolderType::FT_TEXTURE; ft<LLFolderType::FT_COUNT; ft++) { LLFolderType::EType folder_type = static_cast<LLFolderType::EType>(ft); @@ -4103,6 +4138,12 @@ LLPointer<LLInventoryValidationInfo> LLInventoryModel::validate() const bool is_singleton = LLFolderType::lookupIsSingletonType(folder_type); S32 count_under_root = ft_counts_under_root[folder_type]; S32 count_elsewhere = ft_counts_elsewhere[folder_type]; + if (fake_system_folder_issues) + { + // Force all counts to be either 0 or 2, thus flagged as an error. + count_under_root = 2*distrib(e); + count_elsewhere = 2*distrib(e); + } if (is_singleton) { if (count_under_root==0) @@ -4113,6 +4154,7 @@ LLPointer<LLInventoryValidationInfo> LLInventoryModel::validate() const { LL_WARNS("Inventory") << "Fatal inventory corruption: cannot create system folder of type " << ft << LL_ENDL; fatalities++; + validation_info->mMissingRequiredSystemFolders.insert(LLFolderType::EType(ft)); } else { @@ -4123,6 +4165,7 @@ LLPointer<LLInventoryValidationInfo> LLInventoryModel::validate() const else if (count_under_root > 1) { LL_WARNS("Inventory") << "Fatal inventory corruption: system folder type has excess copies under root, type " << ft << " count " << count_under_root << LL_ENDL; + validation_info->mDuplicateRequiredSystemFolders.insert(LLFolderType::EType(ft)); fatalities++; } if (count_elsewhere > 0) diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h index caba78988e..bddaf3a147 100644 --- a/indra/newview/llinventorymodel.h +++ b/indra/newview/llinventorymodel.h @@ -56,16 +56,21 @@ class LLMessageSystem; class LLInventoryCollectFunctor; ///---------------------------------------------------------------------------- -/// LLInventoryValidationInfo +/// LLInventoryValidationInfo ///---------------------------------------------------------------------------- class LLInventoryValidationInfo: public LLRefCount { public: LLInventoryValidationInfo(); void toOstream(std::ostream& os) const; + void asLLSD(LLSD& sd) const; + S32 mFatalErrorCount; S32 mWarningCount; + bool mInitialized; + std::set<LLFolderType::EType> mMissingRequiredSystemFolders; + std::set<LLFolderType::EType> mDuplicateRequiredSystemFolders; }; std::ostream& operator<<(std::ostream& s, const LLInventoryValidationInfo& v); @@ -671,6 +676,7 @@ private: public: void dumpInventory() const; LLPointer<LLInventoryValidationInfo> validate() const; + LLPointer<LLInventoryValidationInfo> mValidationInfo; std::string getFullPath(const LLInventoryObject *obj) const; /** Miscellaneous diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index f7ded00318..fc706c6f2c 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -62,6 +62,7 @@ #include "llsdserialize.h" #include "llcorehttputil.h" #include "llvoicevivox.h" +#include "llinventorymodel.h" namespace LLStatViewer { @@ -573,6 +574,11 @@ void send_stats() fail["off_circuit"] = (S32) gMessageSystem->mOffCircuitPackets; fail["invalid"] = (S32) gMessageSystem->mInvalidOnCircuitPackets; + LLSD &inventory = body["inventory"]; + inventory["usable"] = gInventory.isInventoryUsable(); + LLSD& validation_info = inventory["validation_info"]; + gInventory.mValidationInfo->asLLSD(validation_info); + body["stats"]["voice"] = LLVoiceVivoxStats::getInstance()->read(); // Misc stats, two strings and two ints |