插入触发器意外失败 [英] insertion with trigger failed unexpectedly

查看:96
本文介绍了插入触发器意外失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,

i有插入数据和运行帖子插入触发器的问题

就可以了。

Preambula:

有一个名为raw的表:

ipsrc | cidr

ipdst | cidr

bytes | bigint

时间|时间戳

触发器:

daily_trigger插入或更新原始FOR FOR EACH ROW EXECUTE PROCEDURE daily_func()

和每日表:

ip | cidr

bytesin | bigint

bytesout | bigint

local_traffic |布尔值

时间|日期


此代码的问题是存储原始流量计数器,我从我的cisco或FreeBSD路由器获取
并计算每日流量

在日常表中通过内部ip将其分为内部和外部。


问题:

从一开始一切都很好,我从路由器获得的所有记录都是恰到好处的。我花了一个星期

监控和测试我的软件。

现在我在原始表中有10.000.000条记录,当我插入数据时
$ b原始和每日都缺少$ b的记录。有时我得到UPDATE

失败的错误,有时INSERT失败,但总的来说我每天两次得到

这两条消息但不仅仅缺少两条记录 -

数百个。目前我不知道去哪里以及

检查。我主要在FreeBSD平台上做了我的测试,现在我在RedHat Linux上做了测试

,结果是一样的 - 有些记录没有

到达数据库(触发器有记录器说是插入了所有的东西

,但事实并非如此,那个惰性记录的工具也有.b $ b b logger)。当我正在进行测试时 - 一切进展顺利,但是当插入多个记录丢失时,

生产。

插入工具是非常简单的C程序(看起来像没有

存放bug的地方:)触发器也非常简单。如果你需要

代码 - 我可以在这里发布,但我认为它不会是

有用。

你能给吗?我知道该去哪里以及在这种情况下要检查什么?


问候,

Anton

----- ----------------------(播出结束)----------------------- ----

提示4:不要杀死-9''邮政局长

解决方案

2004年1月12日星期一05:57, ********** ***@loteco.ru 写道:

亲爱的,
我有插入数据和运行post insert trigger
的问题。
当我正在进行测试时 - 一切进展顺利,但是当生成多个记录时,生产就会发生损失。




OK - 现场情况肯定会发生一些不同的事情。

更好地发布CREATE TABLE,触发代码和示例INSERT。


PS - 是问题所在:

1. INSERT无法生成原始表,而且每日都没有更新

2. INSERT无法生成原始表,但每日更新

3 INSERT适用于原始表但每日不更新


-

Richard Huxton

Archonet Ltd


---------------------------(广播结束)----------- ----------------

提示7:别忘了增加免费空间地图设置


亲爱的Anton Nikiforov,

问题:

从一开始一切都很好,所有记录都是我从路由器得到的算得恰到好处。我花了一周时间来监控和测试我的软件。
现在我在原始表中有10.000.000条记录,当我插入数据时,原始和每日都缺少很多记录。有时我得到UPDATE
失败的错误,有时INSERT失败,但总的来说我每天两次收到这条消息,但不仅有两条记录丢失 -
数百条。



我建议的东西,但可能是它的错误我们会

需要你的PostgreSQL版本号等

另外

如果磁盘空间不足,请检查磁盘空间

目前我不知道去哪里以及检查什么。我主要在FreeBSD平台上做了我的测试,现在我在RedHat Linux上做了测试,结果是一样的 - 有些记录没有


这是一个真正的问题在这种情况下似乎没有磁盘空间问题

你能告诉我们代码

到达数据库(触发器有记录器,说明一切



问候,

Vishal Kashyap


--------------------- ------(播出结束)---------------------------

提示8:解释分析是你的朋友


Richard Huxton< de*@archonet.com>写道:

2004年1月12日星期一05 :57, ************* @ loteco.ru 写道:

我在插入数据和运行post insert trigger
时遇到问题。


更好地发布CREATE TABLE,触发代码和示例INSERT。




您收到的具体错误信息和PG版本

编号。而且,你说它发生在每天两次的情况下。 ---你的意思是

特定时间,如中午和午夜?


问候,汤姆小巷


---------------------------(广播结束)--------------- ------------

提示2:您可以使用取消注册命令一次性取消所有列表

(发送取消注册YourEmailAddressHere; ma*******@postgresql.org


Dear all,
i have a problem with insertion data and running post insert trigger
on it.
Preambula:
there is a table named raw:
ipsrc | cidr
ipdst | cidr
bytes | bigint
time | timestamp
Triggers:
daily_trigger AFTER INSERT OR UPDATE ON raw FOR EACH ROW EXECUTE PROCEDURE daily_func()
and the table daily:
ip | cidr
bytesin | bigint
bytesout | bigint
local_traffic | boolean
time | date

The matter of this code is to store raw traffic counters that i''m
getting from my cisco or FreeBSD routers and calculate daily traffic
in daily table dividing it into internal and external by internal ip.

The problem:
From the very beginning everything was fine and all records that i
was getting from routers were calculated just right. I spent a weeks
monitoring and testing my software.
Now i have 10.000.000 records in raw table and when i''m inserting data
alot of records are missing in raw and daily. Sometimes i got UPDATE
failed errors, sometimes INSERT failed, but in general i''m getting
this messages twice a day but not only two records are missing -
hundreds of them. Currently i have no idea where to go and what to
check. I did my tests mainly on FreeBSD platform and now i did tests
on RedHat Linux and the result is the same - some records just did not
reach the database (trigger has logger that is saying that everything
was inserted, but it is not true, the tool that inerting records has
logger too). When i''m doing tests - everything is going well, but in
production when multiple records being inserted losses happend.
The insertion tool is very simple C program that (looks like) have no
place to store bugs :) The trigger is very simple too. If you need the
code - i could post it here, but i do not think that it will be
useful.
Could you give me an idea where to go and what to check in this case?

Regards,
Anton
---------------------------(end of broadcast)---------------------------
TIP 4: Don''t ''kill -9'' the postmaster

解决方案

On Monday 12 January 2004 05:57, An*************@loteco.ru wrote:

Dear all,
i have a problem with insertion data and running post insert trigger
on it. When i''m doing tests - everything is going well, but in
production when multiple records being inserted losses happend.



OK - there must be something different happening with the live situation.
Better post the CREATE TABLE, trigger code and a sample INSERT.

PS - is the problem:
1. INSERT fails to raw table, and daily is not updated
2. INSERT fails to raw table, but daily is updated
3. INSERT works on raw table but daily is not updated

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 7: don''t forget to increase your free space map settings


Dear Anton Nikiforov,

The problem:

From the very beginning everything was fine and all records that iwas getting from routers were calculated just right. I spent a weeks
monitoring and testing my software.
Now i have 10.000.000 records in raw table and when i''m inserting data
alot of records are missing in raw and daily. Sometimes i got UPDATE
failed errors, sometimes INSERT failed, but in general i''m getting
this messages twice a day but not only two records are missing -
hundreds of them.


I am suggesting something but may be its wrong in eithercase we would
require your PostgreSQL version number etc
Also
Checkout the disk space if you have run out of diskspace
Currently i have no idea where to go and what to
check. I did my tests mainly on FreeBSD platform and now i did tests
on RedHat Linux and the result is the same - some records just did not

This is a real problem its seems no disk space probelm in this case
would you please show us the code
reach the database (trigger has logger that is saying that everything


Regards,
Vishal Kashyap

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


Richard Huxton <de*@archonet.com> writes:

On Monday 12 January 2004 05:57, An*************@loteco.ru wrote:

i have a problem with insertion data and running post insert trigger
on it.

Better post the CREATE TABLE, trigger code and a sample INSERT.



And the specific error messages you''re getting, and the PG version
number. Also, you say it happens "twice a day" --- do you mean at
specific times of day, like noon and midnight?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)


这篇关于插入触发器意外失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆