Skip to content

Commit

Permalink
[SYS-5571] Stop constructing string to check isManifest
Browse files Browse the repository at this point in the history
  • Loading branch information
JiaJie Ye committed Jul 11, 2023
1 parent bded6cd commit 0c260da
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cloud/filename.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <string>
#include <cstring>

#include <rocksdb/slice.h>

//
// These are inlined methods to deal with pathnames and filenames.

Expand Down Expand Up @@ -150,14 +152,14 @@ inline bool IsWalFile(const std::string& pathname) {

inline bool IsManifestFile(const std::string& pathname) {
// extract last component of the path
std::string fname;
rocksdb::Slice fname;
size_t offset = pathname.find_last_of(pathsep);
if (offset != std::string::npos) {
fname = pathname.substr(offset + 1, pathname.size());
fname = rocksdb::Slice(&pathname[offset + 1], pathname.size() - offset - 1);
} else {
fname = pathname;
}
if (fname.find("MANIFEST") == 0) {
if (fname.starts_with("MANIFEST")) {
return true;
}
return false;
Expand Down

0 comments on commit 0c260da

Please sign in to comment.