[Tarantool-patches] [PATCH v2 09/10] wal: fix say_x format
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Thu Feb 25 01:41:18 MSK 2021
Thanks for the patch!
On 24.02.2021 16:36, Cyrill Gorcunov via Tarantool-patches wrote:
> - vclock_get returns int64_t
> - vclock_sum returns int64_t
>
> Part-of #5846
>
> Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
> ---
> src/box/wal.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/src/box/wal.c b/src/box/wal.c
> index 937d47ba9..1c0076f26 100644
> --- a/src/box/wal.c
> +++ b/src/box/wal.c
> @@ -993,13 +993,14 @@ wal_assign_lsn(struct vclock *vclock_diff, struct vclock *base,
> int64_t diff = (*row)->lsn - vclock_get(base, (*row)->replica_id);
> if (diff <= vclock_get(vclock_diff,
> (*row)->replica_id)) {
> + int64_t confirmed_lsn =
> + vclock_get(base, (*row)->replica_id) +
> + vclock_get(vclock_diff, (*row)->replica_id);
> say_crit("Attempt to write a broken LSN to WAL:"
> - " replica id: %d, confirmed lsn: %d,"
> - " new lsn %d", (*row)->replica_id,
> - vclock_get(base, (*row)->replica_id) +
> - vclock_get(vclock_diff,
> - (*row)->replica_id),
> - (*row)->lsn);
> + " replica id: %d, confirmed lsn: %lld,"
`replica_id` is uint32_t. So it should be %u and cast to (unsigned) I suppose.
> + " new lsn %lld", (*row)->replica_id,
> + (long long)confirmed_lsn,
> + (long long)(*row)->lsn);
> assert(false);
> } else {
> vclock_follow(vclock_diff, (*row)->replica_id, diff);
> @@ -1241,7 +1242,7 @@ wal_write_async(struct journal *journal, struct journal_entry *entry)
> */
> say_error("Aborting transaction %llu during "
> "cascading rollback",
> - vclock_sum(&writer->vclock));
> + (long long)vclock_sum(&writer->vclock));
Long long should use %lld, not %llu. I have no idea why is the format checker
silent about this.
More information about the Tarantool-patches
mailing list