From 530dbeeef0f5ae293d65950284121f773764e200 Mon Sep 17 00:00:00 2001 From: oceanoverflow Date: Wed, 16 Aug 2023 02:40:38 +0000 Subject: [PATCH] [CP] ocp requires double quote for restore scn display --- deps/oblib/src/lib/oblog/ob_log_print_kv.h | 22 ++++++++++++++++++++++ src/share/backup/ob_backup_struct.cpp | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/deps/oblib/src/lib/oblog/ob_log_print_kv.h b/deps/oblib/src/lib/oblog/ob_log_print_kv.h index 2e6247a8a0..b606e246e2 100644 --- a/deps/oblib/src/lib/oblog/ob_log_print_kv.h +++ b/deps/oblib/src/lib/oblog/ob_log_print_kv.h @@ -90,6 +90,28 @@ private: const char *str_; }; +class ObQuoteSzString +{ +public: + explicit ObQuoteSzString(const char *s) : str_(s) + {} + ~ObQuoteSzString() + {} + + int64_t to_string(char *buf, const int64_t len) const + { + int64_t pos = 0; + if (OB_ISNULL(str_)) { + (void)logdata_printf(buf, len, pos, "NULL"); + } else { + (void)logdata_printf(buf, len, pos, "\"%s\"", str_); + } + return pos; + } +private: + const char *str_; +}; + /** * used to print string that maybe not terminated by zero and has a max lenght */ diff --git a/src/share/backup/ob_backup_struct.cpp b/src/share/backup/ob_backup_struct.cpp index 935b3207f9..9ba2710f9d 100755 --- a/src/share/backup/ob_backup_struct.cpp +++ b/src/share/backup/ob_backup_struct.cpp @@ -4088,7 +4088,7 @@ int64_t ObBackupSetFileDesc::to_string(char *min_restore_scn_str_buf, char *buf, // do nothing } else { J_OBJ_START(); - ObSzString min_restore_scn_display(min_restore_scn_str_buf); + ObQuoteSzString min_restore_scn_display(min_restore_scn_str_buf); J_KV(K_(backup_set_id), K_(incarnation), K_(tenant_id), K_(dest_id), K_(backup_type), K_(plus_archivelog), K_(date), K_(prev_full_backup_set_id), K_(prev_inc_backup_set_id), K_(stats), K_(start_time), K_(end_time), K_(status), K_(result), K_(encryption_mode), K_(passwd), K_(file_status), K_(backup_path), K_(start_replay_scn),