{"id":10703,"date":"2017-12-12T20:31:34","date_gmt":"2017-12-12T19:31:34","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\/"},"modified":"2017-12-12T20:31:34","modified_gmt":"2017-12-12T19:31:34","slug":"does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\/","title":{"rendered":"Does pg_upgrade in check mode raises a failure when the old cluster is running?"},"content":{"rendered":"<p>Today I had the pleasure to have <a href=\"http:\/\/momjian.us\/\" target=\"_blank\" rel=\"noopener\">Bruce Momjian<\/a> in my session about <a href=\"https:\/\/www.ittage.informatik-aktuell.de\/programm\/2017\/postgresql-upgrade-best-practices\/\" target=\"_blank\" rel=\"noopener\">PostgreSQL Upgrade Best Practices<\/a> at the <a href=\"https:\/\/www.ittage.informatik-aktuell.de\/\" target=\"_blank\" rel=\"noopener\">IT Tage 2017 in Frankfurt<\/a>. While browsing through the various options you have for upgrading there was one slide where I claimed that the old cluster needs to be down before you run <a href=\"https:\/\/www.postgresql.org\/docs\/10\/static\/pgupgrade.html\" target=\"_blank\" rel=\"noopener\">pg_upgrade<\/a> in check mode as you will hit a (non-critical) failure message otherwise. Lets see if that really is the case or I did something wrong&#8230;<\/p>\n<p><!--more--><\/p>\n<p>To start with lets initialize a new 9.6.2 cluster:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">\npostgres@pgbox:\/home\/postgres\/ [PG962] initdb --version\ninitdb (PostgreSQL) 9.6.2 dbi services build\npostgres@pgbox:\/home\/postgres\/ [PG962] initdb -D \/tmp\/aaa\nThe files belonging to this database system will be owned by user \"postgres\".\nThis user must also own the server process.\n\nThe database cluster will be initialized with locales\n  COLLATE:  en_US.UTF-8\n  CTYPE:    en_US.UTF-8\n  MESSAGES: en_US.UTF-8\n  MONETARY: de_CH.UTF-8\n  NUMERIC:  de_CH.UTF-8\n  TIME:     de_CH.UTF-8\nThe default database encoding has accordingly been set to \"UTF8\".\nThe default text search configuration will be set to \"english\".\n\nData page checksums are disabled.\n\ncreating directory \/tmp\/aaa ... ok\ncreating subdirectories ... ok\nselecting default max_connections ... 100\nselecting default shared_buffers ... 128MB\nselecting dynamic shared memory implementation ... posix\ncreating configuration files ... ok\nrunning bootstrap script ... ok\nperforming post-bootstrap initialization ... ok\nsyncing data to disk ... ok\n\nWARNING: enabling \"trust\" authentication for local connections\nYou can change this by editing pg_hba.conf or using the option -A, or\n--auth-local and --auth-host, the next time you run initdb.\n\nSuccess. You can now start the database server using:\n\n    pg_ctl -D \/tmp\/aaa -l logfile start\n<\/pre>\n<p>Start that:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">\npostgres@pgbox:\/home\/postgres\/ [PG962] pg_ctl -D \/tmp\/aaa -l logfile start\npostgres@pgbox:\/home\/postgres\/ [PG962] psql -c \"select version()\" postgres\n                                                           version                                                           \n-----------------------------------------------------------------------------------------------------------------------------\n PostgreSQL 9.6.2 dbi services build on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11), 64-bit\n(1 row)\n\nTime: 0.861 ms\n<\/pre>\n<p>For being able to upgrade we&#8217;ll need a new cluster, so:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">\npostgres@pgbox:\/home\/postgres\/ [PG10] initdb --version\ninitdb (PostgreSQL) 10.0 dbi services build\npostgres@pgbox:\/home\/postgres\/ [PG10] initdb -D \/tmp\/bbb\nThe files belonging to this database system will be owned by user \"postgres\".\nThis user must also own the server process.\n\nThe database cluster will be initialized with locales\n  COLLATE:  en_US.UTF-8\n  CTYPE:    en_US.UTF-8\n  MESSAGES: en_US.UTF-8\n  MONETARY: de_CH.UTF-8\n  NUMERIC:  de_CH.UTF-8\n  TIME:     de_CH.UTF-8\nThe default database encoding has accordingly been set to \"UTF8\".\nThe default text search configuration will be set to \"english\".\n\nData page checksums are disabled.\n\ncreating directory \/tmp\/bbb ... ok\ncreating subdirectories ... ok\nselecting default max_connections ... 100\nselecting default shared_buffers ... 128MB\nselecting dynamic shared memory implementation ... posix\ncreating configuration files ... ok\nrunning bootstrap script ... ok\nperforming post-bootstrap initialization ... ok\nsyncing data to disk ... ok\n\nWARNING: enabling \"trust\" authentication for local connections\nYou can change this by editing pg_hba.conf or using the option -A, or\n--auth-local and --auth-host, the next time you run initdb.\n\nSuccess. You can now start the database server using:\n\n    pg_ctl -D \/tmp\/bbb -l logfile start\n<\/pre>\n<p>We&#8217;ll not start that one but will just run pg_upgrade in check mode from the new binaries:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">\npostgres@pgbox:\/home\/postgres\/ [PG10] pg_upgrade --version\npg_upgrade (PostgreSQL) 10.0 dbi services build\npostgres@pgbox:\/home\/postgres\/ [PG10] export PGDATAOLD=\/tmp\/aaa\npostgres@pgbox:\/home\/postgres\/ [PG10] export PGDATANEW=\/tmp\/bbb\npostgres@pgbox:\/home\/postgres\/ [PG10] export PGBINOLD=\/u01\/app\/postgres\/product\/96\/db_2\/bin\/\npostgres@pgbox:\/home\/postgres\/ [PG10] export PGBINNEW=\/u01\/app\/postgres\/product\/10\/db_0\/bin\/\npostgres@pgbox:\/home\/postgres\/ [PG10] pg_upgrade -c\n\n*failure*\nConsult the last few lines of \"pg_upgrade_server.log\" for\n...\n<\/pre>\n<p>&#8230; and here we go. From the log:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">\npostgres@pgbox:\/home\/postgres\/ [PG10] cat pg_upgrade_server.log\n\n-----------------------------------------------------------------\n  pg_upgrade run on Tue Dec 12 21:23:43 2017\n-----------------------------------------------------------------\n\ncommand: \"\/u01\/app\/postgres\/product\/96\/db_2\/bin\/pg_ctl\" -w -l \"pg_upgrade_server.log\" -D \"\/tmp\/aaa\" -o \"-p 50432 -c autovacuum=off -c autovacuum_freeze_max_age=2000000000  -c listen_addresses='' -c unix_socket_permissions=0700\" start &gt;&gt; \"pg_upgrade_server.log\" 2&gt;&amp;1\npg_ctl: another server might be running; trying to start server anyway\nwaiting for server to start....FATAL:  lock file \"postmaster.pid\" already exists\nHINT:  Is another postmaster (PID 2194) running in data directory \"\/tmp\/aaa\"?\n stopped waiting\npg_ctl: could not start server\nExamine the log output.\n<\/pre>\n<p>So, @Bruce: Something to improve \ud83d\ude42<br \/>\nAgain: It was a pleasure to have you there and I hope we&#8217;ll meet again at one of the conferences in 2018.<\/p>\n<p>Update 09-JAN-2017 (see comments below): Patch here: https:\/\/git.postgresql.org\/pg\/commitdiff\/d25ee30031b08ad1348a090914c2af6bc640a832<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I had the pleasure to have Bruce Momjian in my session about PostgreSQL Upgrade Best Practices at the IT Tage 2017 in Frankfurt. While browsing through the various options you have for upgrading there was one slide where I claimed that the old cluster needs to be down before you run pg_upgrade in check [&hellip;]<\/p>\n","protected":false},"author":28,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229],"tags":[77],"type_dbi":[],"class_list":["post-10703","post","type-post","status-publish","format-standard","hentry","category-database-administration-monitoring","tag-postgresql"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.8 (Yoast SEO v28.8) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Does pg_upgrade in check mode raises a failure when the old cluster is running? - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Does pg_upgrade in check mode raises a failure when the old cluster is running?\" \/>\n<meta property=\"og:description\" content=\"Today I had the pleasure to have Bruce Momjian in my session about PostgreSQL Upgrade Best Practices at the IT Tage 2017 in Frankfurt. While browsing through the various options you have for upgrading there was one slide where I claimed that the old cluster needs to be down before you run pg_upgrade in check [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-12-12T19:31:34+00:00\" \/>\n<meta name=\"author\" content=\"Open source Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Open source Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\\\/\"},\"author\":{\"name\":\"Open source Team\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/4bae5e5dd8c7d48edbd948772b49b202\"},\"headline\":\"Does pg_upgrade in check mode raises a failure when the old cluster is running?\",\"datePublished\":\"2017-12-12T19:31:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\\\/\"},\"wordCount\":190,\"commentCount\":0,\"keywords\":[\"PostgreSQL\"],\"articleSection\":[\"Database Administration &amp; Monitoring\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\\\/\",\"name\":\"Does pg_upgrade in check mode raises a failure when the old cluster is running? - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"datePublished\":\"2017-12-12T19:31:34+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/4bae5e5dd8c7d48edbd948772b49b202\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Does pg_upgrade in check mode raises a failure when the old cluster is running?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/4bae5e5dd8c7d48edbd948772b49b202\",\"name\":\"Open source Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g\",\"caption\":\"Open source Team\"},\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/open-source-team\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Does pg_upgrade in check mode raises a failure when the old cluster is running? - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\/","og_locale":"en_US","og_type":"article","og_title":"Does pg_upgrade in check mode raises a failure when the old cluster is running?","og_description":"Today I had the pleasure to have Bruce Momjian in my session about PostgreSQL Upgrade Best Practices at the IT Tage 2017 in Frankfurt. While browsing through the various options you have for upgrading there was one slide where I claimed that the old cluster needs to be down before you run pg_upgrade in check [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\/","og_site_name":"dbi Blog","article_published_time":"2017-12-12T19:31:34+00:00","author":"Open source Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Open source Team","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\/"},"author":{"name":"Open source Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/4bae5e5dd8c7d48edbd948772b49b202"},"headline":"Does pg_upgrade in check mode raises a failure when the old cluster is running?","datePublished":"2017-12-12T19:31:34+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\/"},"wordCount":190,"commentCount":0,"keywords":["PostgreSQL"],"articleSection":["Database Administration &amp; Monitoring"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\/","url":"https:\/\/www.dbi-services.com\/blog\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\/","name":"Does pg_upgrade in check mode raises a failure when the old cluster is running? - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2017-12-12T19:31:34+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/4bae5e5dd8c7d48edbd948772b49b202"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/does-pg_upgrade-in-check-mode-raises-a-failure-when-the-old-cluster-is-running\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Does pg_upgrade in check mode raises a failure when the old cluster is running?"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/4bae5e5dd8c7d48edbd948772b49b202","name":"Open source Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/eb4fb12e386e8c41fdef0733e8114594cf2653e4f55e9fa2161442b8eaf3f657?s=96&d=mm&r=g","caption":"Open source Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/open-source-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/10703","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/28"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=10703"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/10703\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=10703"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=10703"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=10703"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=10703"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}