English 中文(简体)
单位测试 浏览级锁
原标题:Unit-testing PostgreSQL row-level locks

目前,我正在使用pgTap,对大量邮政总局储存的程序进行单位测试。

某些程序开展行动,明确锁定行。 这些锁对申请至关重要。

我如何写检验,以核实需要锁定的囚室过去,以及应当锁定的囚室?

目前,我唯一的“独角兽”是延长期限,使交易能够检查另一笔交易锁的行踪。 然而,目前的交易似乎看不到自己的锁,因此,我不得不利用一些手段来nch清两项交易,除非我犯了错误,否则就没有办法利用普惠。

(单位:千美元)

最佳回答

If you can identify the ctid of the rows in question, and know which transaction should have the rows locked, maybe you could use the pageinspect extension and look at the tuple info flags and xmax? The info flags should indicate the row is locked, and xmax be set to the transaction id holding it.

问题回答

我如何写检验,以核实需要锁定的囚室过去,以及应当锁定的囚室?

公开单独转播,试图与诺瓦信息技术公司一道锁定同一行,并赶上这一例外。

PostgreSQL不支持自主交易,因此,为了在PgTAP测试范围内进行单独交易,你必须使用dblink或其他类似的延伸。

PS。 我发现这一联系:。 Robert Haas解释说,为什么没有在pg_locks上跟踪流层 t:

(...) ungranted tuple locks show up in pg_locks, but they disappear once granted. (PostgreSQL would run out of lock table space on even a medium-sized SELECT FOR UPDATE query if we didn t do this.)

另一方面,我不理解你为什么要测试存在僵局,而是在LOCK指挥下得到保证。





相关问题
摘录数据

我如何将Excel板的数据输入我的Django应用? I m将PosgreSQL数据库作为数据库。

Postgres dump of only parts of tables for a dev snapshot

On production our database is a few hundred gigabytes in size. For development and testing, we need to create snapshots of this database that are functionally equivalent, but which are only 10 or 20 ...

How to join attributes in sql select statement?

I want to join few attributes in select statement as one for example select id, (name + + surname + + age) as info from users this doesn t work, how to do it? I m using postgreSQL.

What text encoding to use?

I need to setup my PostgreSQL DB s text encoding to handle non-American English characters that you d find showing up in languages such as German, Spanish, and French. What character encoding should ...

SQL LIKE condition to check for integer?

I am using a set of SQL LIKE conditions to go through the alphabet and list all items beginning with the appropriate letter, e.g. to get all books where the title starts with the letter "A": SELECT * ...

热门标签