Menu

#95 Why does xlog switch force a checkpoint?

2.x
open
nobody
None
2018-06-27
2018-06-27
Greg Clough
No

If you run this command on the barman server to swtich an xlog:

/bin/barman -q switch-wal --force --archive database01

It forces a checkpoint in the target database... but why is a checkpoint necessary for an xlog/wal switch?

2018-06-27 21:17:53 UTC [1529]: [2-1] user=barman,db=postgres,app=[unknown],client=192.168.0.1 LOG:  connection authorized: user=barman database=postgres
2018-06-27 21:17:53 UTC [1529]: [3-1] user=barman,db=postgres,app=[unknown],client=192.168.0.1 LOG:  duration: 0.093 ms  statement: BEGIN
2018-06-27 21:17:53 UTC [1529]: [4-1] user=barman,db=postgres,app=barman,client=192.168.0.1 LOG:  duration: 0.052 ms  statement: SET application_name TO barman
2018-06-27 21:17:53 UTC [1529]: [5-1] user=barman,db=postgres,app=barman,client=192.168.0.1 LOG:  duration: 4.139 ms  statement: SELECT 1
2018-06-27 21:17:53 UTC [1529]: [6-1] user=barman,db=postgres,app=barman,client=192.168.0.1 LOG:  duration: 4.424 ms  statement: SELECT usesuper FROM pg_user WHERE usename = CURRENT_USER
2018-06-27 21:17:53 UTC [1529]: [7-1] user=barman,db=postgres,app=barman,client=192.168.0.1 LOG:  duration: 100.161 ms  statement: CHECKPOINT
2018-06-27 21:17:53 UTC [1529]: [8-1] user=barman,db=postgres,app=barman,client=192.168.0.1 LOG:  duration: 4.277 ms  statement: SELECT 1
2018-06-27 21:17:53 UTC [1529]: [9-1] user=barman,db=postgres,app=barman,client=192.168.0.1 LOG:  duration: 3.331 ms  statement: SELECT 1
2018-06-27 21:17:53 UTC [1529]: [10-1] user=barman,db=postgres,app=barman,client=192.168.0.1 LOG:  duration: 3.626 ms  statement: SELECT usesuper FROM pg_user WHERE usename = CURRENT_USER
2018-06-27 21:17:53 UTC [1529]: [11-1] user=barman,db=postgres,app=barman,client=192.168.0.1 LOG:  duration: 3.269 ms  statement: SELECT 1
2018-06-27 21:17:53 UTC [1529]: [12-1] user=barman,db=postgres,app=barman,client=192.168.0.1 LOG:  duration: 3.277 ms  statement: SELECT 1
2018-06-27 21:17:53 UTC [1529]: [13-1] user=barman,db=postgres,app=barman,client=192.168.0.1 LOG:  duration: 3.315 ms  statement: SELECT pg_is_in_recovery()
2018-06-27 21:17:53 UTC [1529]: [14-1] user=barman,db=postgres,app=barman,client=192.168.0.1 LOG:  duration: 3.412 ms  statement: SELECT 1
2018-06-27 21:17:53 UTC [1529]: [15-1] user=barman,db=postgres,app=barman,client=192.168.0.1 LOG:  duration: 3.356 ms  statement: SELECT pg_xlogfile_name(pg_current_xlog_insert_location())
2018-06-27 21:17:53 UTC [1529]: [16-1] user=barman,db=postgres,app=barman,client=192.168.0.1 LOG:  duration: 3.254 ms  statement: SELECT 1
2018-06-27 21:17:53 UTC [1529]: [17-1] user=barman,db=postgres,app=barman,client=192.168.0.1 LOG:  duration: 249.348 ms  statement: SELECT pg_xlogfile_name(pg_switch_xlog())
2018-06-27 21:17:53 UTC [1529]: [18-1] user=barman,db=postgres,app=barman,client=192.168.0.1 LOG:  duration: 4.083 ms  statement: SELECT 1
2018-06-27 21:17:53 UTC [1529]: [19-1] user=barman,db=postgres,app=barman,client=192.168.0.1 LOG:  duration: 3.512 ms  statement: SELECT pg_xlogfile_name(pg_current_xlog_insert_location())
2018-06-27 21:17:55 UTC [1529]: [20-1] user=barman,db=postgres,app=[unknown],client=192.168.0.1 LOG:  duration: 0.074 ms  statement: ROLLBACK
2018-06-27 21:17:55 UTC [1529]: [21-1] user=barman,db=postgres,app=[unknown],client=192.168.0.1 LOG:  disconnection: session time: 0:00:02.016 user=barman database=postgres host=192.168.0.1 port=33564

ENVIRONMENT

$ barman --version
2.3

Barman by 2ndQuadrant (www.2ndQuadrant.com)

$ cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)

$ uname -a
Linux host.localhost 3.10.0-693.11.6.el7.x86_64 #1 SMP Thu Jan 4 01:06:37 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Discussion


Log in to post a comment.

MongoDB Logo MongoDB