Skip to content

Commit e4caa6e

Browse files
author
Paweł Andruszkiewicz
committed
BUG#35883344 Save metadata displayed using the showMetadata option of util.loadDump()
Metadata displayed using the showMetadata option of util.loadDump() utility (or always displayed when using copy utilities) is now also written to the log file. Change-Id: Ieaaf72745e9526d9bf40efbdcb3e64202bec56f9 (cherry picked from commit e5231ad0b6ada0a5012531a23aef9663f7dcf112)
1 parent 6bf27b7 commit e4caa6e

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

modules/util/load/dump_reader.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1572,10 +1572,13 @@ void Dump_reader::show_metadata() const {
15721572
"Binlog_position", binlog_position(),
15731573
"Executed_GTID_set", gtid_executed()));
15741574

1575+
const auto yaml = shcore::Value(metadata).yaml();
15751576
const auto console = current_console();
15761577

15771578
console->println();
1578-
console->println(shcore::Value(metadata).yaml());
1579+
console->println(yaml);
1580+
1581+
log_info("%s", yaml.c_str());
15791582
}
15801583

15811584
bool Dump_reader::should_create_pks() const {

unittest/scripts/auto/py_shell/scripts/util_copy_instance_norecord.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,17 +318,20 @@ def EXPECT_FAIL(error, msg, connectionData, options = {}, src = __sandbox_uri1,
318318

319319
#@<> WL15298_TSFR_4_5_2
320320
# WL15298_TSFR_5_1_2
321-
EXPECT_SUCCESS(__sandbox_uri2, { "maxBytesPerTransaction": "1M" })
321+
EXPECT_SUCCESS(__sandbox_uri2, { "maxBytesPerTransaction": "1M" }, setup = lambda: WIPE_SHELL_LOG())
322322
# WL15298_TSFR_4_5_7
323323
EXPECT_STDOUT_NOT_CONTAINS("Analyzing tables")
324324
# WL15298_TSFR_4_6_1
325-
EXPECT_STDOUT_MATCHES(re.compile(r"""
326-
---
325+
p = re.compile(r"""
326+
.*---
327327
Dump_metadata:
328328
Binlog_file: .*
329329
Binlog_position: .*
330330
Executed_GTID_set: .*
331-
"""))
331+
""")
332+
EXPECT_STDOUT_MATCHES(p)
333+
# BUG#35883344 - binlog info should be written to the log file
334+
EXPECT_SHELL_LOG_MATCHES(p)
332335

333336
#@<> WL15298 - test invalid values of maxBytesPerTransaction option
334337
TEST_STRING_OPTION("maxBytesPerTransaction")

unittest/scripts/auto/py_shell/scripts/util_dump_and_load_extra_norecord.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,14 @@ def EXPECT_BINLOG_INFO(file, position, gtid, options = {}):
260260
for option in [ "showMetadata", "dryRun" ]:
261261
if option not in options:
262262
options[option] = True
263+
WIPE_SHELL_LOG()
263264
util.load_dump(os.path.join(outdir, "fulldump"), options)
265+
yaml = testutil.yaml({ "Dump_metadata": { "Binlog_file": file, "Binlog_position": position, "Executed_GTID_set": gtid } })
264266
EXPECT_STDOUT_CONTAINS(binlog_info_header)
265-
EXPECT_STDOUT_CONTAINS(testutil.yaml({ "Dump_metadata": { "Binlog_file": file, "Binlog_position": position, "Executed_GTID_set": gtid } }))
267+
EXPECT_STDOUT_CONTAINS(yaml)
268+
# BUG#35883344 - binlog info should be written to the log file
269+
for line in yaml.splitlines():
270+
EXPECT_SHELL_LOG_CONTAINS(line)
266271

267272
#@<> showMetadata defaults to false
268273
util.load_dump(os.path.join(outdir, "fulldump"), { "dryRun": True })

0 commit comments

Comments
 (0)