pg_rewind发生int型溢出(bug)

pg_rewind 9.5以及9.6版本,在file的size大于2G以上时,会发生int型溢出。

unexpected result while sending file list: ERROR: value “2148022000” is out of range for type integer

            /*

            * First create a temporary table, and load it with the blocks that we

            * need to fetch.

            */

            sql = "CREATE TEMPORARY TABLE fetchchunks(path text, begin int4, len int4);";

            res = PQexec(conn, sql);



            if (PQresultStatus(res) != PGRES_COMMAND_OK)

                            pg_fatal("could not create temporary table: %s",

                                                            PQresultErrorMessage(res));

            PQclear(res);



            sql = "COPY fetchchunks FROM STDIN";

            res = PQexec(conn, sql);



            if (PQresultStatus(res) != PGRES_COPY_IN)

                            pg_fatal("could not send file list: %s",

                                                            PQresultErrorMessage(res));

            PQclear(res);



            while ((res = PQgetResult(conn)) != NULL)

            {

                            if (PQresultStatus(res) != PGRES_COMMAND_OK)

                                            pg_fatal("unexpected result while sending file list: %s",

                                                                            PQresultErrorMessage(res));

                            PQclear(res);

            }

postgresql 9.6.4已经修复这个bug,参考。

https://www.postgresql.org/docs/9.6/static/release-9-6-4.html

Fix pg_rewind to correctly handle files exceeding 2GB (Kuntal Ghosh, Michael Paquier)

Ordinarily such files won’t appear in PostgreSQL data directories, but they could be present in some cases.

猜你喜欢

转载自blog.csdn.net/pg_edb/article/details/86801439