From 7efdd9ef4db90728b85085e05aa367a6ea727b0f Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Mon, 7 Apr 2014 10:25:38 -0700 Subject: [PATCH] Options::wal_dir shouldn't end in '/' Summary: If a client specifies wal_dir with trailing '/', we will fail in deleting obsolete log files. See task #4083746 Test Plan: make check Reviewers: haobo, sdong Reviewed By: haobo CC: leveldb Differential Revision: https://reviews.facebook.net/D17535 --- db/db_impl.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db/db_impl.cc b/db/db_impl.cc index a63a00f22..bb35dd49f 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -322,6 +322,9 @@ Options SanitizeOptions(const std::string& dbname, // Use dbname as default result.wal_dir = dbname; } + if (result.wal_dir.back() == '/') { + result.wal_dir = result.wal_dir.substr(result.wal_dir.size() - 1); + } // -- Sanitize the table properties collector // All user defined properties collectors will be wrapped by