From c3ad43f997b2815383cb201efeaea6604c2cd07c Mon Sep 17 00:00:00 2001 From: levy Date: Tue, 25 May 2021 17:01:32 +0800 Subject: [PATCH 01/13] feat: implement value_schema_v0 --- rdsn | 2 +- src/base/pegasus_value_schema.h | 3 +- src/base/test/value_manager_test.cpp | 4 +- src/base/test/value_schema_test.cpp | 5 ++ src/base/value_schema_manager.cpp | 2 + src/base/value_schema_v1.cpp | 123 +++++++++++++++++++++++++++ src/base/value_schema_v1.h | 48 +++++++++++ 7 files changed, 184 insertions(+), 3 deletions(-) create mode 100644 src/base/value_schema_v1.cpp create mode 100644 src/base/value_schema_v1.h diff --git a/rdsn b/rdsn index b4b9a4ecc4..cd0a237b20 160000 --- a/rdsn +++ b/rdsn @@ -1 +1 @@ -Subproject commit b4b9a4ecc499289fe651b2bd1f3ab114baa88604 +Subproject commit cd0a237b20a2fb120ec9b32d4b133e04518def8a diff --git a/src/base/pegasus_value_schema.h b/src/base/pegasus_value_schema.h index 3bd2f9fe4a..f278e466f2 100644 --- a/src/base/pegasus_value_schema.h +++ b/src/base/pegasus_value_schema.h @@ -239,8 +239,9 @@ class pegasus_value_generator enum data_version { VERSION_0 = 0, + VERSION_1 = 1, VERSION_COUNT, - VERSION_MAX = VERSION_0, + VERSION_MAX = VERSION_1, /// TBD(zlw) }; diff --git a/src/base/test/value_manager_test.cpp b/src/base/test/value_manager_test.cpp index 30ed3c1548..570b20b6ca 100644 --- a/src/base/test/value_manager_test.cpp +++ b/src/base/test/value_manager_test.cpp @@ -40,7 +40,9 @@ TEST(value_schema_manager, get_value_schema) uint32_t version; bool schema_exist; } tests[] = { - {pegasus::data_version::VERSION_0, true}, {pegasus::data_version::VERSION_MAX + 1, false}, + {pegasus::data_version::VERSION_0, true}, + {pegasus::data_version::VERSION_1, true}, + {pegasus::data_version::VERSION_MAX + 1, false}, }; for (const auto &t : tests) { diff --git a/src/base/test/value_schema_test.cpp b/src/base/test/value_schema_test.cpp index aa1a40e0ca..33a5c0480f 100644 --- a/src/base/test/value_schema_test.cpp +++ b/src/base/test/value_schema_test.cpp @@ -72,6 +72,10 @@ TEST(value_schema, generate_and_extract) {0, std::numeric_limits::max(), 0, "pegasus"}, {0, std::numeric_limits::max(), 0, ""}, {0, 0, 0, "a"}, + + {1, 1000, 10001, ""}, + {1, std::numeric_limits::max(), std::numeric_limits::max(), "pegasus"}, + {1, std::numeric_limits::max(), std::numeric_limits::max(), ""}, }; for (const auto &t : tests) { @@ -97,6 +101,7 @@ TEST(value_schema, update_expire_ts) uint32_t update_expire_ts; } tests[] = { {0, 1000, 10086}, + {1, 1000, 10086}, }; for (const auto &t : tests) { diff --git a/src/base/value_schema_manager.cpp b/src/base/value_schema_manager.cpp index 4caaffe69e..d2a8aa6ed0 100644 --- a/src/base/value_schema_manager.cpp +++ b/src/base/value_schema_manager.cpp @@ -19,6 +19,7 @@ #include "value_schema_manager.h" #include "value_schema_v0.h" +#include "value_schema_v1.h" namespace pegasus { value_schema_manager::value_schema_manager() @@ -28,6 +29,7 @@ value_schema_manager::value_schema_manager() * and register it here. */ value_schema_manager::instance().register_schema(dsn::make_unique()); + value_schema_manager::instance().register_schema(dsn::make_unique()); } void value_schema_manager::register_schema(std::unique_ptr schema) diff --git a/src/base/value_schema_v1.cpp b/src/base/value_schema_v1.cpp new file mode 100644 index 0000000000..d4c62dccc2 --- /dev/null +++ b/src/base/value_schema_v1.cpp @@ -0,0 +1,123 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#include "value_schema_v1.h" + +#include +#include +#include +#include + +namespace pegasus { +std::unique_ptr value_schema_v1::extract_field(dsn::string_view value, + value_field_type type) +{ + std::unique_ptr field = nullptr; + switch (type) { + case value_field_type::EXPIRE_TIMESTAMP: + field = extract_timestamp(value); + break; + case value_field_type::TIME_TAG: + field = extract_time_tag(value); + break; + default: + dassert_f(false, "Unsupported field type: {}", type); + } + return field; +} + +dsn::blob value_schema_v1::extract_user_data(std::string &&value) +{ + auto *s = new std::string(std::move(value)); + dsn::data_input input(*s); + input.skip(sizeof(uint32_t)); + input.skip(sizeof(uint64_t)); + dsn::string_view view = input.read_str(); + + // tricky code to avoid memory copy + dsn::blob user_data; + std::shared_ptr buf(const_cast(view.data()), [s](char *) { delete s; }); + user_data.assign(std::move(buf), 0, static_cast(view.length())); + return user_data; +} + +void value_schema_v1::update_field(std::string &value, std::unique_ptr field) +{ + auto type = field->type(); + switch (field->type()) { + case value_field_type::EXPIRE_TIMESTAMP: + update_expire_ts(value, std::move(field)); + break; + default: + dassert_f(false, "Unsupported update field type: {}", type); + } +} + +rocksdb::SliceParts value_schema_v1::generate_value(const value_params ¶ms) +{ + auto expire_ts_field = static_cast( + params.fields[value_field_type::EXPIRE_TIMESTAMP].get()); + auto timetag_field = + static_cast(params.fields[value_field_type::TIME_TAG].get()); + auto data_field = + static_cast(params.fields[value_field_type::USER_DATA].get()); + if (dsn_unlikely(expire_ts_field == nullptr || data_field == nullptr || + timetag_field == nullptr)) { + dassert_f(false, "USER_DATA or EXPIRE_TIMESTAMP or TIME_TAG is not provided"); + return {nullptr, 0}; + } + + params.write_buf.resize(sizeof(uint32_t) + sizeof(uint64_t)); + dsn::data_output(params.write_buf) + .write_u32(expire_ts_field->expire_ts) + .write_u64(timetag_field->time_tag); + params.write_slices.clear(); + params.write_slices.emplace_back(params.write_buf.data(), params.write_buf.size()); + + dsn::string_view user_data = data_field->user_data; + if (user_data.length() > 0) { + params.write_slices.emplace_back(user_data.data(), user_data.length()); + } + return {¶ms.write_slices[0], static_cast(params.write_slices.size())}; +} + +std::unique_ptr value_schema_v1::extract_timestamp(dsn::string_view value) +{ + uint32_t expire_ts = dsn::data_input(value).read_u32(); + return dsn::make_unique(expire_ts); +} + +std::unique_ptr value_schema_v1::extract_time_tag(dsn::string_view value) +{ + dsn::data_input input(value); + input.skip(sizeof(uint32_t)); + uint64_t time_tag = input.read_u64(); + return dsn::make_unique(time_tag); +} + +void value_schema_v1::update_expire_ts(std::string &value, std::unique_ptr field) +{ + dassert_f(value.length() >= sizeof(uint32_t), "value must include 'expire_ts' header"); + auto expire_field = static_cast(field.get()); + + auto new_expire_ts = dsn::endian::hton(expire_field->expire_ts); + memcpy(const_cast(value.data()), &new_expire_ts, sizeof(uint32_t)); +} + +} // namespace pegasus diff --git a/src/base/value_schema_v1.h b/src/base/value_schema_v1.h new file mode 100644 index 0000000000..d9db61a5ed --- /dev/null +++ b/src/base/value_schema_v1.h @@ -0,0 +1,48 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#pragma once + +#include "pegasus_value_schema.h" + +#include + +namespace pegasus { +/** + * rocksdb value: |- expire_ts(4bytes) -|- timetag(8 bytes) -|- user value(bytes) -| + */ +class value_schema_v1 : public value_schema +{ +public: + value_schema_v1() = default; + + std::unique_ptr extract_field(dsn::string_view value, value_field_type type); + dsn::blob extract_user_data(std::string &&value); + void update_field(std::string &value, std::unique_ptr field); + rocksdb::SliceParts generate_value(const value_params ¶ms); + + data_version version() const override { return VERSION_1; } + +protected: + std::unique_ptr extract_timestamp(dsn::string_view value); + std::unique_ptr extract_time_tag(dsn::string_view value); + void update_expire_ts(std::string &value, std::unique_ptr field); +}; + +} // namespace pegasus From 1b25afa8de7e49ec325f07a06b760a6fcfc003b9 Mon Sep 17 00:00:00 2001 From: levy Date: Tue, 25 May 2021 17:07:53 +0800 Subject: [PATCH 02/13] fix --- src/base/value_schema_v1.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/base/value_schema_v1.h b/src/base/value_schema_v1.h index d9db61a5ed..b718c0aec6 100644 --- a/src/base/value_schema_v1.h +++ b/src/base/value_schema_v1.h @@ -36,7 +36,6 @@ class value_schema_v1 : public value_schema dsn::blob extract_user_data(std::string &&value); void update_field(std::string &value, std::unique_ptr field); rocksdb::SliceParts generate_value(const value_params ¶ms); - data_version version() const override { return VERSION_1; } protected: From d935d4a8084840009e7ebd96aac53159287182e9 Mon Sep 17 00:00:00 2001 From: levy Date: Tue, 25 May 2021 17:14:47 +0800 Subject: [PATCH 03/13] fix --- src/base/value_schema_v0.h | 2 +- src/base/value_schema_v1.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base/value_schema_v0.h b/src/base/value_schema_v0.h index 5d7712b4e0..5e1737dd92 100644 --- a/src/base/value_schema_v0.h +++ b/src/base/value_schema_v0.h @@ -37,7 +37,7 @@ class value_schema_v0 : public value_schema dsn::blob extract_user_data(std::string &&value) override; void update_field(std::string &value, std::unique_ptr field) override; rocksdb::SliceParts generate_value(const value_params ¶ms) override; - data_version version() const override { return VERSION_0; } + data_version version() const override { return data_version::VERSION_0; } private: std::unique_ptr extract_timestamp(dsn::string_view value); diff --git a/src/base/value_schema_v1.h b/src/base/value_schema_v1.h index b718c0aec6..d942c1dcc3 100644 --- a/src/base/value_schema_v1.h +++ b/src/base/value_schema_v1.h @@ -36,7 +36,7 @@ class value_schema_v1 : public value_schema dsn::blob extract_user_data(std::string &&value); void update_field(std::string &value, std::unique_ptr field); rocksdb::SliceParts generate_value(const value_params ¶ms); - data_version version() const override { return VERSION_1; } + data_version version() const override { return data_version::VERSION_1; } protected: std::unique_ptr extract_timestamp(dsn::string_view value); From 2f198e84ffaa6f800ed8bd9d94c0a9246278c8fd Mon Sep 17 00:00:00 2001 From: levy Date: Tue, 25 May 2021 17:32:23 +0800 Subject: [PATCH 04/13] fix --- src/base/value_schema_manager.cpp | 4 ++-- src/base/value_schema_v1.cpp | 14 +++----------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/base/value_schema_manager.cpp b/src/base/value_schema_manager.cpp index d2a8aa6ed0..ca381ef687 100644 --- a/src/base/value_schema_manager.cpp +++ b/src/base/value_schema_manager.cpp @@ -28,8 +28,8 @@ value_schema_manager::value_schema_manager() * If someone wants to add a new data version, he only need to implement the new value schema, * and register it here. */ - value_schema_manager::instance().register_schema(dsn::make_unique()); - value_schema_manager::instance().register_schema(dsn::make_unique()); + register_schema(dsn::make_unique()); + register_schema(dsn::make_unique()); } void value_schema_manager::register_schema(std::unique_ptr schema) diff --git a/src/base/value_schema_v1.cpp b/src/base/value_schema_v1.cpp index d4c62dccc2..153ee6319c 100644 --- a/src/base/value_schema_v1.cpp +++ b/src/base/value_schema_v1.cpp @@ -44,17 +44,9 @@ std::unique_ptr value_schema_v1::extract_field(dsn::string_view val dsn::blob value_schema_v1::extract_user_data(std::string &&value) { - auto *s = new std::string(std::move(value)); - dsn::data_input input(*s); - input.skip(sizeof(uint32_t)); - input.skip(sizeof(uint64_t)); - dsn::string_view view = input.read_str(); - - // tricky code to avoid memory copy - dsn::blob user_data; - std::shared_ptr buf(const_cast(view.data()), [s](char *) { delete s; }); - user_data.assign(std::move(buf), 0, static_cast(view.length())); - return user_data; + auto ret = dsn::blob::create_from_bytes(std::move(value)); + ret.range(sizeof(uint32_t) + sizeof(uint64_t)); + return ret; } void value_schema_v1::update_field(std::string &value, std::unique_ptr field) From 1ca9bcd8491a8096374fe59128a9fedd76f54012 Mon Sep 17 00:00:00 2001 From: levy Date: Tue, 25 May 2021 17:56:35 +0800 Subject: [PATCH 05/13] fix --- src/base/value_schema_v0.cpp | 13 ++++++++++--- src/base/value_schema_v1.cpp | 14 +++++++++++--- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/base/value_schema_v0.cpp b/src/base/value_schema_v0.cpp index 220c3b6219..ea112ac4cb 100644 --- a/src/base/value_schema_v0.cpp +++ b/src/base/value_schema_v0.cpp @@ -39,9 +39,16 @@ std::unique_ptr value_schema_v0::extract_field(dsn::string_view val dsn::blob value_schema_v0::extract_user_data(std::string &&value) { - auto ret = dsn::blob::create_from_bytes(std::move(value)); - ret.range(sizeof(uint32_t)); - return ret; + auto *s = new std::string(std::move(value)); + dsn::data_input input(*s); + input.skip(sizeof(uint32_t)); + dsn::string_view view = input.read_str(); + + // tricky code to avoid memory copy + dsn::blob user_data; + std::shared_ptr buf(const_cast(view.data()), [s](char *) { delete s; }); + user_data.assign(std::move(buf), 0, static_cast(view.length())); + return user_data; } void value_schema_v0::update_field(std::string &value, std::unique_ptr field) diff --git a/src/base/value_schema_v1.cpp b/src/base/value_schema_v1.cpp index 153ee6319c..d4c62dccc2 100644 --- a/src/base/value_schema_v1.cpp +++ b/src/base/value_schema_v1.cpp @@ -44,9 +44,17 @@ std::unique_ptr value_schema_v1::extract_field(dsn::string_view val dsn::blob value_schema_v1::extract_user_data(std::string &&value) { - auto ret = dsn::blob::create_from_bytes(std::move(value)); - ret.range(sizeof(uint32_t) + sizeof(uint64_t)); - return ret; + auto *s = new std::string(std::move(value)); + dsn::data_input input(*s); + input.skip(sizeof(uint32_t)); + input.skip(sizeof(uint64_t)); + dsn::string_view view = input.read_str(); + + // tricky code to avoid memory copy + dsn::blob user_data; + std::shared_ptr buf(const_cast(view.data()), [s](char *) { delete s; }); + user_data.assign(std::move(buf), 0, static_cast(view.length())); + return user_data; } void value_schema_v1::update_field(std::string &value, std::unique_ptr field) From 7104468de4d62340a4203543c1f5d1998a1da503 Mon Sep 17 00:00:00 2001 From: levy Date: Tue, 25 May 2021 18:09:11 +0800 Subject: [PATCH 06/13] fix --- src/base/value_schema_v0.cpp | 12 ++---------- src/base/value_schema_v1.cpp | 13 ++----------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/src/base/value_schema_v0.cpp b/src/base/value_schema_v0.cpp index ea112ac4cb..8c41eac9ae 100644 --- a/src/base/value_schema_v0.cpp +++ b/src/base/value_schema_v0.cpp @@ -39,16 +39,8 @@ std::unique_ptr value_schema_v0::extract_field(dsn::string_view val dsn::blob value_schema_v0::extract_user_data(std::string &&value) { - auto *s = new std::string(std::move(value)); - dsn::data_input input(*s); - input.skip(sizeof(uint32_t)); - dsn::string_view view = input.read_str(); - - // tricky code to avoid memory copy - dsn::blob user_data; - std::shared_ptr buf(const_cast(view.data()), [s](char *) { delete s; }); - user_data.assign(std::move(buf), 0, static_cast(view.length())); - return user_data; + auto ret = dsn::blob::create_from_bytes(std::move(value)); + return ret.range(sizeof(uint32_t)); } void value_schema_v0::update_field(std::string &value, std::unique_ptr field) diff --git a/src/base/value_schema_v1.cpp b/src/base/value_schema_v1.cpp index d4c62dccc2..c5ab0eb9ff 100644 --- a/src/base/value_schema_v1.cpp +++ b/src/base/value_schema_v1.cpp @@ -44,17 +44,8 @@ std::unique_ptr value_schema_v1::extract_field(dsn::string_view val dsn::blob value_schema_v1::extract_user_data(std::string &&value) { - auto *s = new std::string(std::move(value)); - dsn::data_input input(*s); - input.skip(sizeof(uint32_t)); - input.skip(sizeof(uint64_t)); - dsn::string_view view = input.read_str(); - - // tricky code to avoid memory copy - dsn::blob user_data; - std::shared_ptr buf(const_cast(view.data()), [s](char *) { delete s; }); - user_data.assign(std::move(buf), 0, static_cast(view.length())); - return user_data; + auto ret = dsn::blob::create_from_bytes(std::move(value)); + return ret.range(sizeof(uint32_t) + sizeof(uint64_t)); } void value_schema_v1::update_field(std::string &value, std::unique_ptr field) From 0dc197a64f9337bf23675d6988419f636ede0b87 Mon Sep 17 00:00:00 2001 From: levy Date: Tue, 25 May 2021 18:13:49 +0800 Subject: [PATCH 07/13] fix --- src/base/test/value_schema_test.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/base/test/value_schema_test.cpp b/src/base/test/value_schema_test.cpp index 33a5c0480f..13f019f2c4 100644 --- a/src/base/test/value_schema_test.cpp +++ b/src/base/test/value_schema_test.cpp @@ -100,8 +100,7 @@ TEST(value_schema, update_expire_ts) uint32_t expire_ts; uint32_t update_expire_ts; } tests[] = { - {0, 1000, 10086}, - {1, 1000, 10086}, + {0, 1000, 10086}, {1, 1000, 10086}, }; for (const auto &t : tests) { From 00a0f957eb7c916e6af36b3be96a2597760d7e55 Mon Sep 17 00:00:00 2001 From: levy Date: Tue, 25 May 2021 18:24:22 +0800 Subject: [PATCH 08/13] fix --- src/base/value_schema_v1.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/base/value_schema_v1.h b/src/base/value_schema_v1.h index d942c1dcc3..3e5c77c2eb 100644 --- a/src/base/value_schema_v1.h +++ b/src/base/value_schema_v1.h @@ -32,10 +32,10 @@ class value_schema_v1 : public value_schema public: value_schema_v1() = default; - std::unique_ptr extract_field(dsn::string_view value, value_field_type type); - dsn::blob extract_user_data(std::string &&value); - void update_field(std::string &value, std::unique_ptr field); - rocksdb::SliceParts generate_value(const value_params ¶ms); + std::unique_ptr extract_field(dsn::string_view value, value_field_type type) override; + dsn::blob extract_user_data(std::string &&value) override; + void update_field(std::string &value, std::unique_ptr field) override; + rocksdb::SliceParts generate_value(const value_params ¶ms) override; data_version version() const override { return data_version::VERSION_1; } protected: From dbec6990072a95b15c36f2e5f66573c95fa50660 Mon Sep 17 00:00:00 2001 From: levy Date: Tue, 25 May 2021 18:25:56 +0800 Subject: [PATCH 09/13] fix --- src/base/value_schema_v1.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/base/value_schema_v1.h b/src/base/value_schema_v1.h index 3e5c77c2eb..a93abd6a8c 100644 --- a/src/base/value_schema_v1.h +++ b/src/base/value_schema_v1.h @@ -32,7 +32,8 @@ class value_schema_v1 : public value_schema public: value_schema_v1() = default; - std::unique_ptr extract_field(dsn::string_view value, value_field_type type) override; + std::unique_ptr extract_field(dsn::string_view value, + value_field_type type) override; dsn::blob extract_user_data(std::string &&value) override; void update_field(std::string &value, std::unique_ptr field) override; rocksdb::SliceParts generate_value(const value_params ¶ms) override; From 9ebfb4176668c64948d6ea2cd985af9da2c87cfc Mon Sep 17 00:00:00 2001 From: levy Date: Tue, 25 May 2021 19:02:34 +0800 Subject: [PATCH 10/13] fix --- src/base/test/value_schema_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/base/test/value_schema_test.cpp b/src/base/test/value_schema_test.cpp index 13f019f2c4..2facef47e9 100644 --- a/src/base/test/value_schema_test.cpp +++ b/src/base/test/value_schema_test.cpp @@ -76,6 +76,7 @@ TEST(value_schema, generate_and_extract) {1, 1000, 10001, ""}, {1, std::numeric_limits::max(), std::numeric_limits::max(), "pegasus"}, {1, std::numeric_limits::max(), std::numeric_limits::max(), ""}, + {1, 0, 0, "a"}, }; for (const auto &t : tests) { From 7e94b0eb1d7d5416f817ec2034d4bee401bc640d Mon Sep 17 00:00:00 2001 From: levy Date: Tue, 25 May 2021 19:04:31 +0800 Subject: [PATCH 11/13] fix --- src/base/value_schema_v0.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/base/value_schema_v0.cpp b/src/base/value_schema_v0.cpp index 8c41eac9ae..850c07c948 100644 --- a/src/base/value_schema_v0.cpp +++ b/src/base/value_schema_v0.cpp @@ -89,8 +89,7 @@ void value_schema_v0::update_expire_ts(std::string &value, std::unique_ptr= sizeof(uint32_t), "value must include 'expire_ts' header"); auto expire_field = static_cast(field.get()); - auto new_expire_ts = expire_field->expire_ts; - new_expire_ts = dsn::endian::hton(new_expire_ts); + auto new_expire_ts = dsn::endian::hton(expire_field->expire_ts); memcpy(const_cast(value.data()), &new_expire_ts, sizeof(uint32_t)); } From 35d10e57611101f4f1b4852aeb2cef8decf40878 Mon Sep 17 00:00:00 2001 From: levy Date: Wed, 26 May 2021 09:28:40 +0800 Subject: [PATCH 12/13] fix --- src/base/value_schema_v1.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/base/value_schema_v1.cpp b/src/base/value_schema_v1.cpp index c5ab0eb9ff..6dba1d46e8 100644 --- a/src/base/value_schema_v1.cpp +++ b/src/base/value_schema_v1.cpp @@ -98,8 +98,7 @@ std::unique_ptr value_schema_v1::extract_time_tag(dsn::string_view { dsn::data_input input(value); input.skip(sizeof(uint32_t)); - uint64_t time_tag = input.read_u64(); - return dsn::make_unique(time_tag); + return dsn::make_unique(input.read_u64()); } void value_schema_v1::update_expire_ts(std::string &value, std::unique_ptr field) From 66e7fe06d7023e93a3848f38c4c7bb5e489df62d Mon Sep 17 00:00:00 2001 From: levy Date: Wed, 26 May 2021 09:42:04 +0800 Subject: [PATCH 13/13] fix --- src/base/value_schema_v0.h | 2 -- src/base/value_schema_v1.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/base/value_schema_v0.h b/src/base/value_schema_v0.h index 5e1737dd92..4fbde67655 100644 --- a/src/base/value_schema_v0.h +++ b/src/base/value_schema_v0.h @@ -21,8 +21,6 @@ #include "pegasus_value_schema.h" -#include - namespace pegasus { /** * rocksdb value: |- expire_ts(4bytes) -|- user value(bytes) -| diff --git a/src/base/value_schema_v1.h b/src/base/value_schema_v1.h index a93abd6a8c..05756d9233 100644 --- a/src/base/value_schema_v1.h +++ b/src/base/value_schema_v1.h @@ -21,8 +21,6 @@ #include "pegasus_value_schema.h" -#include - namespace pegasus { /** * rocksdb value: |- expire_ts(4bytes) -|- timetag(8 bytes) -|- user value(bytes) -|