Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

feat: refine mlog_dump output #408

Merged
merged 6 commits into from
Mar 4, 2020
Merged

Conversation

neverchanje
Copy link
Contributor

@neverchanje neverchanje commented Feb 27, 2020

What problem does this PR solve?

mlog_dump used to print two lines for a mutation, one line for mutation header, and the other for mutation content. Two lines make it inconvenient for data searching (grep/awk). So we combined the two into one line in this PR.

For most of our use cases of mlog_dump, it's used to search data in the specified time range, in order to find hotkeys, or find business-related information. However, the mutation timestamp is printed as long int like "timestamp=1582715060503806", not suitable for time search. So we format the timestamp into "YYYY-mm-dd hh:mm:ss.SSS". For example: "timestamp=2020-02-26 19:04:20.453".

Result:

mutation [22.29.210.2138042763]: gpid=22.29, ballot=210, decree=2138042763, timestamp=2020-02-26 19:04:20.453, last_committed_decree=2138042762, log_offset=407050443493, log_length=204, update_count=1 [CHECK_AND_SET] "796a743221c0985c469c0dab0e093688" : IF SORT_KEY(first-start:) CT_VALUE_NOT_EXIST THEN SET SORT_KEY(first-start:) => VALUE(1582715060453) [expire=0]

@acelyc111
Copy link
Member

mutation [22.29.210.2138042763]: gpid=22.29, ballot=210, decree=2138042763, timestamp=2020-02-26 19:04:20.453, last_committed_decree=2138042762, log_offset=407050443493, log_length=204, update_count=1 [CHECK_AND_SET] "796a743221c0985c469c0dab0e093688" : IF SORT_KEY(first-start:) CT_VALUE_NOT_EXIST THEN SET SORT_KEY(first-start:) => VALUE(1582715060453) [expire=0]

Now that gpid, ballot and decree have been printed in [22.29.210.2138042763], how about remove the following gpid=22.29, ballot=210, decree=2138042763,

mlog->set_valid_start_offset_on_open(mu->data.header.pid, 0);
}
char timestamp_buf[32];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个不需要32位这么长吧?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

22 bytes actually. 32 is for memory alignment.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants