Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLXKF-00017A-21 for pgsql-bugs@arkaria.postgresql.org; Thu, 15 Jun 2017 16:08:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dLXKE-0002aV-LF for pgsql-bugs@arkaria.postgresql.org; Thu, 15 Jun 2017 16:08:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dLXKE-0002Zy-3Q for pgsql-bugs@postgresql.org; Thu, 15 Jun 2017 16:08:50 +0000 Received: from mwork.nabble.com ([162.253.133.43]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLXK8-0003fc-Fu for pgsql-bugs@postgresql.org; Thu, 15 Jun 2017 16:08:49 +0000 Received: from mben.nabble.com (unknown [162.253.133.72]) by mwork.nabble.com (Postfix) with ESMTP id 42E064A5C4217 for ; Thu, 15 Jun 2017 09:08:41 -0700 (MST) Date: Thu, 15 Jun 2017 09:08:41 -0700 (MST) From: =?UTF-8?B?5Y6a56ev6JaE5Y+R?= To: pgsql-bugs@postgresql.org Message-ID: <1497542921271-5966975.post@n3.nabble.com> Subject: GIN index vacuum hang after pg_rman restore in PG9.2.21 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org When I do the next test with postgresql 9.2.21 and pg_rman, the vacuum command of the table will be hang which has a GIN index. =E3=80=90create a table with gin index=E3=80=91 postgres@X86U149:~$ psql postgres -p 5432 psql (9.2.21) Type "help" for help. postgres=3D# \d+ tsvector_test Table "public.tsvector_test" Column | Type | Modifiers | Storage | Stats target | Description= =20 ------------+----------+-----------+----------+--------------+------------- id | bigint | | plain | |=20 phone_list | tsvector | | extended | |=20 Indexes: "idx_tsvector_test" gin (phone_list) Has OIDs: no postgres=3D# vacuum tsvector_test; VACUUM postgres=3D# \q =E3=80=90use pg_rman tool to backup and restore=E3=80=91 postgres@X86U149:~$ pg_rman backup -B /home/postgres/backup/ -d postgres -p 5432 -b f INFO: copying database files INFO: copying archived WAL files INFO: backup complete INFO: Please execute 'pg_rman validate' to verify the files are correctly copied. postgres@X86U149:~$ pg_rman validate -B /home/postgres/backup/ INFO: validate: "2017-06-15 23:10:06" backup and archive log files by CRC INFO: backup "2017-06-15 23:10:06" is valid postgres@X86U149:~$ pg_ctl stop waiting for server to shut down....LOG: received smart shutdown request LOG: autovacuum launcher shutting down LOG: shutting down LOG: database system is shut down done server stopped postgres@X86U149:~$ pg_rman restore -B /home/postgres/backup/ INFO: the recovery target timeline ID is not given INFO: use timeline ID of current database cluster as recovery target: 1 INFO: calculating timeline branches to be used to recovery target point INFO: searching latest full backup which can be used as restore start point INFO: found the full backup can be used as base in recovery: "2017-06-15 23:10:06" INFO: copying online WAL files and server log files INFO: clearing restore destination INFO: validate: "2017-06-15 23:10:06" backup and archive log files by SIZE INFO: backup "2017-06-15 23:10:06" is valid INFO: restoring database files from the full mode backup "2017-06-15 23:10:06" INFO: searching incremental backup to be restored INFO: searching backup which contained archived WAL files to be restored INFO: backup "2017-06-15 23:10:06" is valid INFO: restoring WAL files from backup "2017-06-15 23:10:06" INFO: restoring online WAL files and server log files INFO: generating recovery.conf INFO: restore complete HINT: Recovery will start automatically when the PostgreSQL server is started. postgres@X86U149:~$ pg_ctl start server starting postgres@X86U149:~$ LOG: database system was interrupted; last known up at 2017-06-15 23:10:07 CST LOG: starting archive recovery LOG: restored log file "000000010000000000000010" from archive LOG: redo starts at 0/10000080 LOG: consistent recovery state reached at 0/100000A8 LOG: restored log file "000000010000000000000011" from archive cp: cannot stat '/home/postgres/archive//000000010000000000000012': No such file or directory LOG: record with zero length at 0/12000080 LOG: redo done at 0/12000020 LOG: last completed transaction was at log time 2017-06-15 23:10:10.481215+08 cp: cannot stat '/home/postgres/archive//00000002.history': No such file or directory LOG: selected new timeline ID: 2 cp: cannot stat '/home/postgres/archive//00000001.history': No such file or directory LOG: archive recovery complete LOG: autovacuum launcher started LOG: database system is ready to accept connections =E3=80=90connect the database and vacuum the table =E3=80=91 postgres@X86U149:~$ psql postgres -p 5432 psql (9.2.21) Type "help" for help. postgres=3D# \d+ List of relations Schema | Name | Type | Owner | Size | Description=20 --------+---------------+-------+----------+-------+------------- public | phone | table | postgres | 36 MB |=20 public | tsvector_test | table | postgres | 47 MB |=20 (2 rows) postgres=3D# vacuum tsvector_test; ^Z [2]+ Stopped psql postgres -p 5432 postgres=3D# select pid,query from pg_stat_activity; pid | query=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20 -------+----------------------------------------- 21633 | vacuum tsvector_test; 22885 | select pid,query from pg_stat_activity; (2 rows) However,the vacuum command is hang and donot return result for a long time. Through the gdb, see the trace is as following #0 0x00007f955c3e0057 in semop () at ../sysdeps/unix/syscall-template.S:84 #1 0x00000000006034d8 in PGSemaphoreLock () #2 0x0000000000647ae8 in LWLockAcquire () #3 0x00000000004b2c2b in ginInsertCleanup () #4 0x00000000004b1ade in ginvacuumcleanup () #5 0x00000000007212f6 in FunctionCall2Coll () #6 0x00000000005787cb in lazy_scan_heap () #7 0x0000000000579148 in lazy_vacuum_rel () #8 0x00000000005769ba in vacuum_rel () #9 0x00000000005774e9 in vacuum () #10 0x0000000000656100 in PortalRunUtility () #11 0x0000000000656cf5 in PortalRunMulti () #12 0x0000000000657858 in PortalRun () #13 0x00000000006546d6 in PostgresMain () #14 0x0000000000610d40 in ServerLoop () #15 0x0000000000611996 in PostmasterMain () #16 0x0000000000458b3e in main () And more, when I use the debug version, this is an assert failuer in the function processPendingPage Assert(maxoff >=3D FirstOffsetNumber); and the maxoff is 0. Through the PageGetMaxOffsetNumber,I think it read an empty page. Whether this is the postgresql or pg_rman problem. -- View this message in context: http://www.postgresql-archive.org/GIN-index-v= acuum-hang-after-pg-rman-restore-in-PG9-2-21-tp5966975.html Sent from the PostgreSQL - bugs mailing list archive at Nabble.com. --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs