This is an automated email from the ASF dual-hosted git repository. zwoop pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/trafficserver.git
commit 1e938dd22287ea0e807d65089d1567a92cb49e33 Author: Leif Hedstrom <[email protected]> AuthorDate: Fri May 24 15:09:33 2019 -0600 Step 5: Remove removeVersion() and removeVersion_ml() --- mgmt/Rollback.cc | 54 ------------------------------------------------------ mgmt/Rollback.h | 5 ----- 2 files changed, 59 deletions(-) diff --git a/mgmt/Rollback.cc b/mgmt/Rollback.cc index e4aa1e7..8bcac70 100644 --- a/mgmt/Rollback.cc +++ b/mgmt/Rollback.cc @@ -489,60 +489,6 @@ Rollback::extractVersionInfo(ExpandingArray *listNames, const char *testFileName return version; } -RollBackCodes -Rollback::removeVersion(version_t version) -{ - RollBackCodes r; - - ink_mutex_acquire(&fileAccessLock); - r = this->removeVersion_ml(version); - ink_mutex_release(&fileAccessLock); - - return r; -} - -RollBackCodes -Rollback::removeVersion_ml(version_t version) -{ - struct stat statInfo; - char *versionPath; - versionInfo *removeInfo = nullptr; - bool infoFound = false; - - if (this->statFile(version, &statInfo) < 0) { - mgmt_log("[Rollback::removeVersion] Stat failed on %s version %d\n", fileName, version); - return FILE_NOT_FOUND_ROLLBACK; - } - - versionPath = createPathStr(version); - if (unlink(versionPath) < 0) { - ats_free(versionPath); - mgmt_log("[Rollback::removeVersion] Unlink failed on %s version %d: %s\n", fileName, version, strerror(errno)); - return SYS_CALL_ERROR_ROLLBACK; - } - // Take the version we just removed off of the backup queue - // We are doing a linear search but since we almost always - // are deleting the oldest version, the head of the queue - // should be what we are looking for - for (removeInfo = versionQ.head; removeInfo != nullptr; removeInfo = removeInfo->link.next) { - if (removeInfo->version == version) { - infoFound = true; - break; - } - } - if (infoFound == true) { - versionQ.remove(removeInfo); - delete removeInfo; - } else { - mgmt_log("[Rollback::removeVersion] Unable to find info about %s version %d\n", fileName, version); - } - - numVersions--; - - ats_free(versionPath); - return OK_ROLLBACK; -} - time_t Rollback::versionTimeStamp(version_t version) { diff --git a/mgmt/Rollback.h b/mgmt/Rollback.h index 5ce3548..692dc25 100644 --- a/mgmt/Rollback.h +++ b/mgmt/Rollback.h @@ -64,9 +64,6 @@ struct versionInfo { // simply grab the lock, call the corresponding _ml function, // and then release the lock // -// removeVersion(version_t ) - removes the specified version from the -// configuration directory -// // getVersion(version_t version, TextBuffer** buffer, version_t) - // creates a new TextBuffer that contains the contents of the specified // version. CALLEE MUST DELETE the buffer @@ -135,7 +132,6 @@ public: { ink_mutex_release(&fileAccessLock); }; - RollBackCodes removeVersion_ml(version_t version); RollBackCodes getVersion_ml(version_t version, TextBuffer **buffer); RollBackCodes updateVersion_ml(TextBuffer *buf, version_t basedOn, version_t newVersion = -1, bool notifyChange = true, bool incVersion = true); @@ -144,7 +140,6 @@ public: // Automatically take out lock bool checkForUserUpdate(RollBackCheckType); - RollBackCodes removeVersion(version_t version); RollBackCodes getVersion(version_t version, TextBuffer **buffer); RollBackCodes updateVersion(TextBuffer *buf, version_t basedOn, version_t newVersion = -1, bool notifyChange = true, bool incVersion = true);
