Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated function usage #3528

Merged
merged 9 commits into from
Dec 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common/utils/test/MetaKeyUtilsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ TEST(MetaKeyUtilsTest, storeStrIpCodecTest) {
auto decodedVal = MetaKeyUtils::parsePartVal(encodedVal);
ASSERT_EQ(hosts.size(), decodedVal.size());
for (int i = 0; i < N; i++) {
LOG(INFO) << folly::format("hosts[{}]={}:{}", i, hostnames[i], ports[i]);
LOG(INFO) << folly::sformat("hosts[{}]={}:{}", i, hostnames[i], ports[i]);
ASSERT_EQ(hostnames[i], decodedVal[i].host);
ASSERT_EQ(ports[i], decodedVal[i].port);
}
Expand Down
3 changes: 1 addition & 2 deletions src/graph/service/CloudAuthenticator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ bool CloudAuthenticator::auth(const std::string& user, const std::string& passwo
}

// Second, use user + password authentication methods
StatusOr<std::string> result;
std::string userAndPasswd = user + ":" + password;
std::string base64Str = encryption::Base64::encode(userAndPasswd);

std::string header = "-H \"Content-Type: application/json\" -H \"Authorization:Nebula ";
header = header + base64Str + "\"";
result = http::HttpClient::post(FLAGS_cloud_http_url, header);
auto result = http::HttpClient::post(FLAGS_cloud_http_url, header);

if (!result.ok()) {
LOG(ERROR) << result.status();
Expand Down
2 changes: 1 addition & 1 deletion src/kvstore/NebulaSnapshotManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void NebulaSnapshotManager::accessAllRowsInSnapshot(GraphSpaceID spaceId,
std::vector<std::string> data;
int64_t totalSize = 0;
int64_t totalCount = 0;
LOG(INFO) << folly::format(
LOG(INFO) << folly::sformat(
"Space {} Part {} start send snapshot, rate limited to {}, batch size is {}",
spaceId,
partId,
Expand Down
18 changes: 9 additions & 9 deletions src/kvstore/test/NebulaListenerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,17 +669,17 @@ TEST_P(ListenerSnapshotTest, SnapshotRateLimitTest) {
}
}

INSTANTIATE_TEST_CASE_P(PartCount_Replicas_ListenerCount,
ListenerBasicTest,
::testing::Values(std::make_tuple(1, 1, 1)));
INSTANTIATE_TEST_SUITE_P(PartCount_Replicas_ListenerCount,
ListenerBasicTest,
::testing::Values(std::make_tuple(1, 1, 1)));

INSTANTIATE_TEST_CASE_P(PartCount_Replicas_ListenerCount,
ListenerAdvanceTest,
::testing::Values(std::make_tuple(1, 1, 1)));
INSTANTIATE_TEST_SUITE_P(PartCount_Replicas_ListenerCount,
ListenerAdvanceTest,
::testing::Values(std::make_tuple(1, 1, 1)));

INSTANTIATE_TEST_CASE_P(PartCount_Replicas_ListenerCount,
ListenerSnapshotTest,
::testing::Values(std::make_tuple(1, 1, 1)));
INSTANTIATE_TEST_SUITE_P(PartCount_Replicas_ListenerCount,
ListenerSnapshotTest,
::testing::Values(std::make_tuple(1, 1, 1)));

} // namespace kvstore
} // namespace nebula
Expand Down
18 changes: 9 additions & 9 deletions src/kvstore/test/RocksEngineTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -529,15 +529,15 @@ TEST_P(RocksEngineTest, PrefixBloomTest) {
}
}

INSTANTIATE_TEST_CASE_P(EnablePrefixExtractor_EnableWholeKeyFilter_TableFormat,
RocksEngineTest,
::testing::Values(std::make_tuple(false, false, "BlockBasedTable"),
std::make_tuple(false, true, "BlockBasedTable"),
std::make_tuple(true, false, "BlockBasedTable"),
std::make_tuple(true, true, "BlockBasedTable"),
// PlainTable will always enable prefix extractor
std::make_tuple(true, false, "PlainTable"),
std::make_tuple(true, true, "PlainTable")));
INSTANTIATE_TEST_SUITE_P(EnablePrefixExtractor_EnableWholeKeyFilter_TableFormat,
RocksEngineTest,
::testing::Values(std::make_tuple(false, false, "BlockBasedTable"),
std::make_tuple(false, true, "BlockBasedTable"),
std::make_tuple(true, false, "BlockBasedTable"),
std::make_tuple(true, true, "BlockBasedTable"),
// PlainTable will always enable prefix extractor
std::make_tuple(true, false, "PlainTable"),
std::make_tuple(true, true, "PlainTable")));

TEST(PlainTableTest, BackupRestoreWithoutData) {
fs::TempDir dataPath("/tmp/rocks_engine_test_data_path.XXXXXX");
Expand Down
2 changes: 1 addition & 1 deletion src/meta/MetaVersionMan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ bool MetaVersionMan::setMetaVersionToKV(kvstore::KVStore* kv) {
// static
Status MetaVersionMan::updateMetaV1ToV2(kvstore::KVStore* kv) {
CHECK_NOTNULL(kv);
auto snapshot = folly::format("META_UPGRADE_SNAPSHOT_{}", MetaKeyUtils::genTimestampStr()).str();
auto snapshot = folly::sformat("META_UPGRADE_SNAPSHOT_{}", MetaKeyUtils::genTimestampStr());
auto meteRet = kv->createCheckpoint(kDefaultSpaceId, snapshot);
if (meteRet.isLeftType()) {
LOG(ERROR) << "Create snapshot failed: " << snapshot;
Expand Down
2 changes: 1 addition & 1 deletion src/meta/http/MetaHttpReplaceHostHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void MetaHttpReplaceHostHandler::onRequest(std::unique_ptr<HTTPMessage> headers)

ipv4To_ = headers->getQueryParam("to");

LOG(INFO) << folly::format("change host info from {} to {}", ipv4From_, ipv4To_);
LOG(INFO) << folly::sformat("change host info from {} to {}", ipv4From_, ipv4To_);
}

void MetaHttpReplaceHostHandler::onBody(std::unique_ptr<folly::IOBuf>) noexcept {
Expand Down
2 changes: 1 addition & 1 deletion src/meta/processors/admin/CreateBackupProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void CreateBackupProcessor::process(const cpp2::CreateBackupReq& req) {
// The entire process follows mostly snapshot logic.
// step 1 : write a flag key to handle backup failed
std::vector<kvstore::KV> data;
auto backupName = folly::format("BACKUP_{}", MetaKeyUtils::genTimestampStr()).str();
auto backupName = folly::sformat("BACKUP_{}", MetaKeyUtils::genTimestampStr());
data.emplace_back(
MetaKeyUtils::snapshotKey(backupName),
MetaKeyUtils::snapshotVal(cpp2::SnapshotStatus::INVALID, NetworkUtils::toHostsStr(hosts)));
Expand Down
2 changes: 1 addition & 1 deletion src/meta/processors/admin/CreateSnapshotProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void CreateSnapshotProcessor::process(const cpp2::CreateSnapshotReq&) {
return;
}

auto snapshot = folly::format("SNAPSHOT_{}", MetaKeyUtils::genTimestampStr()).str();
auto snapshot = folly::sformat("SNAPSHOT_{}", MetaKeyUtils::genTimestampStr());
folly::SharedMutex::WriteHolder wHolder(LockUtils::snapshotLock());

auto activeHostsRet = ActiveHostsMan::getActiveHosts(kvstore_);
Expand Down
4 changes: 2 additions & 2 deletions src/meta/test/RestoreProcessorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ TEST(RestoreProcessorTest, RestoreTest) {
baton.wait();

std::unordered_set<GraphSpaceID> spaces = {id};
auto backupName = folly::format("BACKUP_{}", MetaKeyUtils::genTimestampStr()).str();
auto backupName = folly::sformat("BACKUP_{}", MetaKeyUtils::genTimestampStr());
auto spaceNames = std::make_unique<std::vector<std::string>>();
spaceNames->emplace_back("test_space");
auto backupFiles = MetaServiceUtils::backupTables(kv.get(), spaces, backupName, spaceNames.get());
Expand Down Expand Up @@ -301,7 +301,7 @@ TEST(RestoreProcessorTest, RestoreFullTest) {
baton.wait();

std::unordered_set<GraphSpaceID> spaces = {id};
auto backupName = folly::format("BACKUP_{}", MetaKeyUtils::genTimestampStr()).str();
auto backupName = folly::sformat("BACKUP_{}", MetaKeyUtils::genTimestampStr());
auto backupFiles = MetaServiceUtils::backupTables(kv.get(), spaces, backupName, nullptr);
DCHECK(nebula::hasValue(backupFiles));
{
Expand Down
2 changes: 1 addition & 1 deletion src/storage/BaseProcessor-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ meta::cpp2::ColumnDef BaseProcessor<RESP>::columnDef(std::string name,
nebula::cpp2::PropertyType type) {
nebula::meta::cpp2::ColumnDef column;
column.name_ref() = std::move(name);
column.type_ref() = type;
column.type_ref()->type_ref() = type;
return column;
}

Expand Down
26 changes: 13 additions & 13 deletions src/storage/mutate/AddEdgesProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void AddEdgesProcessor::doProcess(const cpp2::AddEdgesRequest& req) {
<< ", VertexID: " << *edgeKey.dst_ref();

if (!NebulaKeyUtils::isValidVidLen(
spaceVidLen_, (*edgeKey.src_ref()).getStr(), (*edgeKey.dst_ref()).getStr())) {
spaceVidLen_, edgeKey.src_ref()->getStr(), edgeKey.dst_ref()->getStr())) {
LOG(ERROR) << "Space " << spaceId_ << " vertex length invalid, "
<< "space vid len: " << spaceVidLen_ << ", edge srcVid: " << *edgeKey.src_ref()
<< ", dstVid: " << *edgeKey.dst_ref();
Expand All @@ -92,10 +92,10 @@ void AddEdgesProcessor::doProcess(const cpp2::AddEdgesRequest& req) {

auto key = NebulaKeyUtils::edgeKey(spaceVidLen_,
partId,
(*edgeKey.src_ref()).getStr(),
edgeKey.src_ref()->getStr(),
*edgeKey.edge_type_ref(),
*edgeKey.ranking_ref(),
(*edgeKey.dst_ref()).getStr());
edgeKey.dst_ref()->getStr());
if (ifNotExists_) {
if (!visited.emplace(key).second) {
continue;
Expand Down Expand Up @@ -167,17 +167,17 @@ void AddEdgesProcessor::doProcessWithIndex(const cpp2::AddEdgesRequest& req) {
auto edgeKey = *newEdge.key_ref();
auto l = std::make_tuple(spaceId_,
partId,
(*edgeKey.src_ref()).getStr(),
edgeKey.src_ref()->getStr(),
*edgeKey.edge_type_ref(),
*edgeKey.ranking_ref(),
(*edgeKey.dst_ref()).getStr());
edgeKey.dst_ref()->getStr());
if (std::find(dummyLock.begin(), dummyLock.end(), l) == dummyLock.end()) {
if (!env_->edgesML_->try_lock(l)) {
LOG(ERROR) << folly::format("edge locked : src {}, type {}, rank {}, dst {}",
(*edgeKey.src_ref()).getStr(),
*edgeKey.edge_type_ref(),
*edgeKey.ranking_ref(),
(*edgeKey.dst_ref()).getStr());
LOG(ERROR) << folly::sformat("edge locked : src {}, type {}, rank {}, dst {}",
edgeKey.src_ref()->getStr(),
*edgeKey.edge_type_ref(),
*edgeKey.ranking_ref(),
edgeKey.dst_ref()->getStr());
code = nebula::cpp2::ErrorCode::E_DATA_CONFLICT_ERROR;
break;
}
Expand All @@ -189,7 +189,7 @@ void AddEdgesProcessor::doProcessWithIndex(const cpp2::AddEdgesRequest& req) {
<< ", VertexID: " << *edgeKey.dst_ref();

if (!NebulaKeyUtils::isValidVidLen(
spaceVidLen_, (*edgeKey.src_ref()).getStr(), (*edgeKey.dst_ref()).getStr())) {
spaceVidLen_, edgeKey.src_ref()->getStr(), edgeKey.dst_ref()->getStr())) {
LOG(ERROR) << "Space " << spaceId_ << " vertex length invalid, "
<< "space vid len: " << spaceVidLen_ << ", edge srcVid: " << *edgeKey.src_ref()
<< ", dstVid: " << *edgeKey.dst_ref();
Expand All @@ -199,10 +199,10 @@ void AddEdgesProcessor::doProcessWithIndex(const cpp2::AddEdgesRequest& req) {

auto key = NebulaKeyUtils::edgeKey(spaceVidLen_,
partId,
(*edgeKey.src_ref()).getStr(),
edgeKey.src_ref()->getStr(),
*edgeKey.edge_type_ref(),
*edgeKey.ranking_ref(),
(*edgeKey.dst_ref()).getStr());
edgeKey.dst_ref()->getStr());
if (ifNotExists_ && !visited.emplace(key).second) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/storage/mutate/AddVerticesProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void AddVerticesProcessor::doProcessWithIndex(const cpp2::AddVerticesRequest& re
auto l = std::make_tuple(spaceId_, partId, tagId, vid);
if (std::find(dummyLock.begin(), dummyLock.end(), l) == dummyLock.end()) {
if (!env_->verticesML_->try_lock(l)) {
LOG(ERROR) << folly::format("The vertex locked : tag {}, vid {}", tagId, vid);
LOG(ERROR) << folly::sformat("The vertex locked : tag {}, vid {}", tagId, vid);
code = nebula::cpp2::ErrorCode::E_DATA_CONFLICT_ERROR;
break;
}
Expand Down
22 changes: 10 additions & 12 deletions src/storage/mutate/DeleteEdgesProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void DeleteEdgesProcessor::process(const cpp2::DeleteEdgesRequest& req) {
auto code = nebula::cpp2::ErrorCode::SUCCEEDED;
for (auto& edgeKey : part.second) {
if (!NebulaKeyUtils::isValidVidLen(
spaceVidLen_, (*edgeKey.src_ref()).getStr(), (*edgeKey.dst_ref()).getStr())) {
spaceVidLen_, edgeKey.src_ref()->getStr(), edgeKey.dst_ref()->getStr())) {
LOG(ERROR) << "Space " << spaceId_ << " vertex length invalid, "
<< "space vid len: " << spaceVidLen_ << ", edge srcVid: " << *edgeKey.src_ref()
<< " dstVid: " << *edgeKey.dst_ref();
Expand All @@ -67,10 +67,10 @@ void DeleteEdgesProcessor::process(const cpp2::DeleteEdgesRequest& req) {
// todo(doodle): delete lock in toss
auto edge = NebulaKeyUtils::edgeKey(spaceVidLen_,
partId,
(*edgeKey.src_ref()).getStr(),
edgeKey.src_ref()->getStr(),
*edgeKey.edge_type_ref(),
*edgeKey.ranking_ref(),
(*edgeKey.dst_ref()).getStr());
edgeKey.dst_ref()->getStr());
keys.emplace_back(edge.data(), edge.size());
}
if (code != nebula::cpp2::ErrorCode::SUCCEEDED) {
Expand All @@ -91,19 +91,17 @@ void DeleteEdgesProcessor::process(const cpp2::DeleteEdgesRequest& req) {
for (const auto& edgeKey : part.second) {
auto l = std::make_tuple(spaceId_,
partId,
(*edgeKey.src_ref()).getStr(),
edgeKey.src_ref()->getStr(),
*edgeKey.edge_type_ref(),
*edgeKey.ranking_ref(),
(*edgeKey.dst_ref()).getStr());
edgeKey.dst_ref()->getStr());
if (std::find(dummyLock.begin(), dummyLock.end(), l) == dummyLock.end()) {
if (!env_->edgesML_->try_lock(l)) {
LOG(ERROR) << folly::format(
"The edge locked : src {}, "
"type {}, tank {}, dst {}",
(*edgeKey.src_ref()).getStr(),
*edgeKey.edge_type_ref(),
*edgeKey.ranking_ref(),
(*edgeKey.dst_ref()).getStr());
LOG(ERROR) << folly::sformat("The edge locked : src {}, type {}, tank {}, dst {}",
edgeKey.src_ref()->getStr(),
*edgeKey.edge_type_ref(),
*edgeKey.ranking_ref(),
edgeKey.dst_ref()->getStr());
err = nebula::cpp2::ErrorCode::E_DATA_CONFLICT_ERROR;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/storage/mutate/DeleteTagsProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ ErrorOr<nebula::cpp2::ErrorCode, std::string> DeleteTagsProcessor::deleteTags(
continue;
}
if (!env_->verticesML_->try_lock(tup)) {
LOG(WARNING) << folly::format("The vertex locked : vId {}, tagId {}", vId, tagId);
LOG(WARNING) << folly::sformat("The vertex locked : vId {}, tagId {}", vId, tagId);
return nebula::cpp2::ErrorCode::E_DATA_CONFLICT_ERROR;
}

Expand Down
2 changes: 1 addition & 1 deletion src/storage/mutate/DeleteVerticesProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ ErrorOr<nebula::cpp2::ErrorCode, std::string> DeleteVerticesProcessor::deleteVer
auto l = std::make_tuple(spaceId_, partId, tagId, vertex.getStr());
if (std::find(target.begin(), target.end(), l) == target.end()) {
if (!env_->verticesML_->try_lock(l)) {
LOG(ERROR) << folly::format("The vertex locked : tag {}, vid {}", tagId, vertex.getStr());
LOG(ERROR) << folly::sformat("The vertex locked: tag {}, vid {}", tagId, vertex.getStr());
return nebula::cpp2::ErrorCode::E_DATA_CONFLICT_ERROR;
}
target.emplace_back(std::move(l));
Expand Down
2 changes: 1 addition & 1 deletion src/storage/test/LookupIndexTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2925,7 +2925,7 @@ TEST_P(LookupIndexTest, DedupEdgeIndexTest) {
}
}

INSTANTIATE_TEST_CASE_P(Lookup_concurrently, LookupIndexTest, ::testing::Values(false, true));
INSTANTIATE_TEST_SUITE_P(Lookup_concurrently, LookupIndexTest, ::testing::Values(false, true));

} // namespace storage
} // namespace nebula
Expand Down
12 changes: 6 additions & 6 deletions src/storage/test/ScanEdgePropBenchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,12 @@ TEST_P(ScanEdgePropBench, ProcessEdgeProps) {
// the parameter pair<int, int> is
// 1. count of edge schema version,
// 2. how many edges will be scanned
INSTANTIATE_TEST_CASE_P(ScanEdgePropBench,
ScanEdgePropBench,
::testing::Values(std::make_pair(1, 10000),
std::make_pair(10, 10000),
std::make_pair(1, 100),
std::make_pair(10, 100)));
INSTANTIATE_TEST_SUITE_P(ScanEdgePropBench,
ScanEdgePropBench,
::testing::Values(std::make_pair(1, 10000),
std::make_pair(10, 10000),
std::make_pair(1, 100),
std::make_pair(10, 100)));

} // namespace nebula

Expand Down