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

feat(backup): 2. update and refactor meta backup engine class #1102

Merged
merged 4 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
14 changes: 14 additions & 0 deletions src/rdsn/include/dsn/cpp/json_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ ENUM_TYPE_SERIALIZATION(dsn::replication::partition_status::type,
ENUM_TYPE_SERIALIZATION(dsn::app_status::type, dsn::app_status::AS_INVALID)
ENUM_TYPE_SERIALIZATION(dsn::replication::bulk_load_status::type,
dsn::replication::bulk_load_status::BLS_INVALID)
ENUM_TYPE_SERIALIZATION(dsn::replication::backup_status::type,
dsn::replication::backup_status::INVALID)

// json serialization for gpid, we treat it as string: "app_id.partition_id"
inline void json_encode(JsonWriter &out, const dsn::gpid &pid)
Expand Down Expand Up @@ -386,6 +388,8 @@ inline void json_encode(JsonWriter &out, const dsn::replication::file_meta &f_me
inline bool json_decode(const JsonObject &in, dsn::replication::file_meta &f_meta);
inline void json_encode(JsonWriter &out, const dsn::replication::bulk_load_metadata &metadata);
inline bool json_decode(const JsonObject &in, dsn::replication::bulk_load_metadata &metadata);
inline void json_encode(JsonWriter &out, const dsn::replication::backup_item &backup_item);
inline bool json_decode(const JsonObject &in, dsn::replication::backup_item &backup_item);

template <typename T>
inline void json_encode_iterable(JsonWriter &out, const T &t)
Expand Down Expand Up @@ -655,5 +659,15 @@ NON_MEMBER_JSON_SERIALIZATION(dsn::app_info,
NON_MEMBER_JSON_SERIALIZATION(dsn::replication::file_meta, name, size, md5)

NON_MEMBER_JSON_SERIALIZATION(dsn::replication::bulk_load_metadata, files, file_total_size)

NON_MEMBER_JSON_SERIALIZATION(dsn::replication::backup_item,
backup_id,
app_id,
app_name,
backup_provider_type,
backup_path,
start_time_ms,
end_time_ms,
status)
} // namespace json
} // namespace dsn
10 changes: 10 additions & 0 deletions src/rdsn/include/dsn/dist/replication/replication_enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,14 @@ ENUM_REG(replication::manual_compaction_status::QUEUING)
ENUM_REG(replication::manual_compaction_status::RUNNING)
ENUM_REG(replication::manual_compaction_status::FINISHED)
ENUM_END2(replication::manual_compaction_status::type, manual_compaction_status)

ENUM_BEGIN2(replication::backup_status::type, backup_status, replication::backup_status::INVALID)
ENUM_REG(replication::backup_status::INVALID)
ENUM_REG(replication::backup_status::CHECKPOINTING)
ENUM_REG(replication::backup_status::CHECKPOINTED)
ENUM_REG(replication::backup_status::UPLOADING)
ENUM_REG(replication::backup_status::SUCCEED)
ENUM_REG(replication::backup_status::FAILED)
ENUM_REG(replication::backup_status::CANCELED)
acelyc111 marked this conversation as resolved.
Show resolved Hide resolved
ENUM_END2(replication::backup_status::type, backup_status)
} // namespace dsn
36 changes: 24 additions & 12 deletions src/rdsn/src/common/backup.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,30 @@ include "../../../../idl/dsn.layer2.thrift"

namespace cpp dsn.replication

enum backup_status
{
INVALID,
acelyc111 marked this conversation as resolved.
Show resolved Hide resolved
CHECKPOINTING,
CHECKPOINTED,
acelyc111 marked this conversation as resolved.
Show resolved Hide resolved
UPLOADING,
foreverneverer marked this conversation as resolved.
Show resolved Hide resolved
SUCCEED,
FAILED,
CANCELED
acelyc111 marked this conversation as resolved.
Show resolved Hide resolved
}

struct backup_item
{
1:i64 backup_id;
2:i32 app_id;
3:string app_name;
4:string backup_provider_type;
// user specified backup_path.
5:string backup_path;
6:i64 start_time_ms;
7:i64 end_time_ms;
8:backup_status status;
}

struct policy_info
{
1:string policy_name;
Expand Down Expand Up @@ -177,18 +201,6 @@ struct start_backup_app_response
3:optional i64 backup_id;
}

struct backup_item
{
1:i64 backup_id;
2:string app_name;
3:string backup_provider_type;
// user specified backup_path.
4:string backup_path;
5:i64 start_time_ms;
6:i64 end_time_ms;
7:bool is_backup_failed;
}

struct query_backup_status_request
{
1:i32 app_id;
Expand Down
Loading