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 #2139

Closed
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
24 changes: 18 additions & 6 deletions idl/backup.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,28 @@ struct start_backup_app_response
3:optional i64 backup_id;
}

enum backup_status
{
UNINITIALIZED,
CHECKPOINTING,
CHECKPOINTED,
UPLOADING,
SUCCEED,
FAILED,
CANCELED
}

struct backup_item
{
1:i64 backup_id;
2:string app_name;
3:string backup_provider_type;
2:i32 app_id;
3:string app_name;
4: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;
5:string backup_path;
6:i64 start_time_ms;
7:i64 end_time_ms;
8:backup_status status;
}

struct query_backup_status_request
Expand Down
14 changes: 14 additions & 0 deletions src/common/json_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,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::UNINITIALIZED)

// 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 @@ -456,6 +458,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 @@ -745,5 +749,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
12 changes: 12 additions & 0 deletions src/common/replication_enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,18 @@ 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::UNINITIALIZED)
ENUM_REG(replication::backup_status::UNINITIALIZED)
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)
ENUM_END2(replication::backup_status::type, backup_status)

USER_DEFINED_ENUM_FORMATTER(app_status::type)
namespace replication {
USER_DEFINED_ENUM_FORMATTER(bulk_load_status::type)
Expand Down
Loading
Loading