diff --git a/src/mock/MockData.cpp b/src/mock/MockData.cpp index 664f6582de9..99fb127a2a1 100644 --- a/src/mock/MockData.cpp +++ b/src/mock/MockData.cpp @@ -6,7 +6,6 @@ #include "mock/MockData.h" #include "common/expression/ConstantExpression.h" -#include "common/time/WallClock.h" #include "common/utils/IndexKeyUtils.h" #include "interface/gen-cpp2/meta_types.h" @@ -686,7 +685,7 @@ std::vector MockData::mockVertices(bool upper) { // Use insert time as ttl col if (FLAGS_mock_ttl_col) { - props.emplace_back(time::WallClock::fastNowInSec()); + props.emplace_back(std::time(NULL)); } // Use default value and nullable if (player.country_.compare("") != 0) { @@ -809,7 +808,7 @@ std::vector MockData::mockEdges(bool upper, bool hasInEdges) { // Use insert time as ttl col if (FLAGS_mock_ttl_col) { - props.emplace_back(time::WallClock::fastNowInSec()); + props.emplace_back(std::time(NULL)); } // Use default value and nullable if (!serve.type_.empty()) { @@ -929,7 +928,7 @@ std::unordered_map> MockData::mockmMultiRankServ // Use insert time as ttl col if (FLAGS_mock_ttl_col) { - props.emplace_back(time::WallClock::fastNowInSec()); + props.emplace_back(std::time(NULL)); } // Use default value and nullable if (!serve.type_.empty()) { diff --git a/src/storage/CommonUtils.cpp b/src/storage/CommonUtils.cpp index 0e748280b6e..f1693b8e5f9 100644 --- a/src/storage/CommonUtils.cpp +++ b/src/storage/CommonUtils.cpp @@ -5,8 +5,6 @@ #include "storage/CommonUtils.h" -#include "common/time/WallClock.h" - namespace nebula { namespace storage { @@ -27,7 +25,7 @@ bool CommonUtils::checkDataExpiredForTTL(const meta::SchemaProviderIf* schema, ftype != nebula::cpp2::PropertyType::INT64) { return false; } - auto now = time::WallClock::fastNowInSec(); + auto now = std::time(NULL); // if the value is not INT type (sush as NULL), it will never expire. // TODO (sky) : DateTime diff --git a/src/storage/test/IndexWithTTLTest.cpp b/src/storage/test/IndexWithTTLTest.cpp index 6c3de4015a0..86f6e9ae7d6 100644 --- a/src/storage/test/IndexWithTTLTest.cpp +++ b/src/storage/test/IndexWithTTLTest.cpp @@ -46,7 +46,7 @@ int64_t verifyResultNum(GraphSpaceID spaceId, std::unique_ptr iter; EXPECT_EQ(nebula::cpp2::ErrorCode::SUCCEEDED, kv->prefix(spaceId, partId, prefix, &iter)); int64_t rowCount = 0; - auto now = time::WallClock::fastNowInSec(); + auto now = std::time(NULL); while (iter->valid()) { if (ts > 0) { EXPECT_TRUE(!iter->val().empty()); @@ -111,7 +111,7 @@ void insertVertex(storage::StorageEnv* env, size_t vIdLen, TagID tagId) { newTag.tag_id_ref() = tagId; std::vector props; props.emplace_back(Value(1L)); - props.emplace_back(Value(time::WallClock::fastNowInSec())); + props.emplace_back(Value(std::time(NULL))); newTag.props_ref() = std::move(props); std::vector newTags; newTags.push_back(std::move(newTag)); @@ -140,7 +140,7 @@ void insertEdge(storage::StorageEnv* env, size_t vIdLen, EdgeType edgeType) { newEdge.key_ref() = std::move(edgeKey); std::vector props; props.emplace_back(Value(1L)); - props.emplace_back(Value(time::WallClock::fastNowInSec())); + props.emplace_back(Value(std::time(NULL))); newEdge.props_ref() = std::move(props); (*req.parts_ref())[partId].emplace_back(newEdge); (*newEdge.key_ref()).edge_type_ref() = -edgeType; @@ -160,7 +160,7 @@ TEST(IndexWithTTLTest, AddVerticesIndexWithTTL) { auto* env = cluster.storageEnv_.get(); auto vIdLen = env->schemaMan_->getSpaceVidLen(1).value(); - auto beginTime = time::WallClock::fastNowInSec(); + auto beginTime = std::time(NULL); createSchema(env->schemaMan_, 2021001, 1, false); createIndex(env->indexMan_, 2021001, 2021002, false); insertVertex(env, vIdLen, 2021001); @@ -207,7 +207,7 @@ TEST(IndexWithTTLTest, AddEdgesIndexWithTTL) { auto* env = cluster.storageEnv_.get(); auto vIdLen = env->schemaMan_->getSpaceVidLen(1).value(); - auto beginTime = time::WallClock::fastNowInSec(); + auto beginTime = std::time(NULL); createSchema(env->schemaMan_, 2021001, 1, true); createIndex(env->indexMan_, 2021001, 2021002, true); insertEdge(env, vIdLen, 2021001); @@ -254,7 +254,7 @@ TEST(IndexWithTTLTest, UpdateVerticesIndexWithTTL) { auto* env = cluster.storageEnv_.get(); auto vIdLen = env->schemaMan_->getSpaceVidLen(1).value(); - auto beginTime = time::WallClock::fastNowInSec(); + auto beginTime = std::time(NULL); createSchema(env->schemaMan_, 2021001, 1800, false); createIndex(env->indexMan_, 2021001, 2021002, false); insertVertex(env, vIdLen, 2021001); @@ -325,7 +325,7 @@ TEST(IndexWithTTLTest, UpdateEdgesIndexWithTTL) { auto* env = cluster.storageEnv_.get(); auto vIdLen = env->schemaMan_->getSpaceVidLen(1).value(); - auto beginTime = time::WallClock::fastNowInSec(); + auto beginTime = std::time(NULL); createSchema(env->schemaMan_, 2021001, 1800, true); createIndex(env->indexMan_, 2021001, 2021002, true); insertEdge(env, vIdLen, 2021001); @@ -402,7 +402,7 @@ TEST(IndexWithTTLTest, RebuildTagIndexWithTTL) { auto* env = cluster.storageEnv_.get(); auto vIdLen = env->schemaMan_->getSpaceVidLen(1).value(); - auto beginTime = time::WallClock::fastNowInSec(); + auto beginTime = std::time(NULL); createSchema(env->schemaMan_, 2021001, 180000, false); insertVertex(env, vIdLen, 2021001); @@ -471,7 +471,7 @@ TEST(IndexWithTTLTest, RebuildEdgeIndexWithTTL) { auto* env = cluster.storageEnv_.get(); auto vIdLen = env->schemaMan_->getSpaceVidLen(1).value(); - auto beginTime = time::WallClock::fastNowInSec(); + auto beginTime = std::time(NULL); createSchema(env->schemaMan_, 2021001, 180000, true); insertEdge(env, vIdLen, 2021001); @@ -540,7 +540,7 @@ TEST(IndexWithTTLTest, RebuildTagIndexWithTTLExpired) { auto* env = cluster.storageEnv_.get(); auto vIdLen = env->schemaMan_->getSpaceVidLen(1).value(); - auto beginTime = time::WallClock::fastNowInSec(); + auto beginTime = std::time(NULL); createSchema(env->schemaMan_, 2021001, 1, false); insertVertex(env, vIdLen, 2021001); @@ -611,7 +611,7 @@ TEST(IndexWithTTLTest, RebuildEdgeIndexWithTTLExpired) { auto* env = cluster.storageEnv_.get(); auto vIdLen = env->schemaMan_->getSpaceVidLen(1).value(); - auto beginTime = time::WallClock::fastNowInSec(); + auto beginTime = std::time(NULL); createSchema(env->schemaMan_, 2021001, 1, true); insertEdge(env, vIdLen, 2021001); diff --git a/src/storage/test/QueryTestUtils.h b/src/storage/test/QueryTestUtils.h index 0f5a2ea6661..ef6abb5b2ce 100644 --- a/src/storage/test/QueryTestUtils.h +++ b/src/storage/test/QueryTestUtils.h @@ -261,7 +261,7 @@ class QueryTestUtils { } auto indexes = IndexKeyUtils::vertexIndexKeys(spaceVidLen, partId, indexId, vId, {std::move(row)}); - auto val = FLAGS_mock_ttl_col ? IndexKeyUtils::indexVal(time::WallClock::fastNowInSec()) : ""; + auto val = FLAGS_mock_ttl_col ? IndexKeyUtils::indexVal(std::time(NULL)) : ""; for (auto& index : indexes) { data.emplace_back(std::move(index), std::move(val)); } @@ -287,7 +287,7 @@ class QueryTestUtils { } auto indexes = IndexKeyUtils::edgeIndexKeys( spaceVidLen, partId, indexId, srcId, rank, dstId, {std::move(row)}); - auto val = FLAGS_mock_ttl_col ? IndexKeyUtils::indexVal(time::WallClock::fastNowInSec()) : ""; + auto val = FLAGS_mock_ttl_col ? IndexKeyUtils::indexVal(std::time(NULL)) : ""; for (auto& index : indexes) { data.emplace_back(std::move(index), val); }