Lazr PostgreSQL特定支持代码。
lazr_postgresql的Python项目详细描述
Copyright (c) 2011-2018, Canonical Ltd
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3 only.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. GNU General Public License version 3 (see the file LICENSE).
postgresql包含启动板用于postgresql的各种帮助程序 支持。其中最主要的是slony-aware数据库迁移工具。
依赖关系
- Python2.7+
测试依赖项
用法
数据库迁移
升级工具将对postgresql或slony应用数据迁移 环境。
每次迁移都是一个名为patch-$mair-$minor-$point-$type.sql的SQL文件。 major、minor和point是整数,它们为补丁程序提供了一个序列 已应用。 类型告诉迁移应用程序是否应应用迁移 在正常事务中,直接发送到 事务,或直接发送到事务外部集群中的所有节点。 这些由“std”、“direct”和“concurrent”表示。
如果修补程序在“标准”模式以外的任何模式下中断, 可能需要手动清理(例如,因为半成品索引将位于 放置在一些节点上)。
例如,名为patch-1-2-3-concurrent.sql的文件将应用于 在非慢速环境中遵循以下方法:
- 将打开master上的事务,并将行1-2-3添加到列表中 应用补丁的数量。这可以防止尝试其他迁移 同时。
- 然后将执行修补程序文件的内容。
- 将更新1-2-3行的结束时间戳。
- 最后提交事务。
在缓慢的环境中会发生以下情况:
- 将打开master上的事务,并将行1-2-3添加到列表中 应用补丁的数量。这可以防止尝试其他迁移 同时。
- 在所有节点上,补丁文件的内容将分别执行 事务外部的连接。
- 将更新1-2-3行的结束时间戳。
- 最后提交事务。
一次调用upgrade.py将只应用std或direct+concurrent 修补程序,除非给定–all参数,否则它将循环到所有 应用修补程序。
很快就会有更多。
安装
在具有所有可用依赖项的环境中运行setup.py,或者 将工作目录添加到pythonpath。
开发
上游开发发生在https://launchpad.net/lazr-postgresql。 如果依赖项不是 立即可用,您可以使用./bootstrap.py创建bin/buildout,然后 bin/py以获得具有可用依赖项的python解释器。
要使用您选择的运行程序运行测试,测试套件是 lazr.postgresql.tests.test_套件。
例如:
$ PYTHONPATH=src bin/py -m testtools.run lazr.postgresql.tests.test_suite
如果您有testrepository,则可以使用它运行测试:
$ testr run