summaryrefslogtreecommitdiffstats
path: root/frontends/php/include/db.inc.php
diff options
context:
space:
mode:
authorsasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-10-05 08:43:57 +0000
committersasha <sasha@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-10-05 08:43:57 +0000
commita3ee144e22596c3aea1fab644ed4c93e4466608a (patch)
treecad8af3a645ea2ebcd4b9152c36fd4c403d80c7e /frontends/php/include/db.inc.php
parent32f3020adc55fc013f8064921fe4c0e10f4deaa4 (diff)
downloadzabbix-a3ee144e22596c3aea1fab644ed4c93e4466608a.tar.gz
zabbix-a3ee144e22596c3aea1fab644ed4c93e4466608a.tar.xz
zabbix-a3ee144e22596c3aea1fab644ed4c93e4466608a.zip
- [ZBX-92] Distributed monitoring: overwriting new information
[svn merge svn://svn.zabbix.com/branches/1.4 -r4832:4836] git-svn-id: svn://svn.zabbix.com/trunk@4837 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/db.inc.php')
-rw-r--r--frontends/php/include/db.inc.php25
1 files changed, 16 insertions, 9 deletions
diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php
index 4e82d072..6ca848d2 100644
--- a/frontends/php/include/db.inc.php
+++ b/frontends/php/include/db.inc.php
@@ -538,17 +538,13 @@ if(isset($DB_TYPE) && $DB_TYPE == "ORACLE") {
$found = false;
do
{
- $row = DBfetch(DBselect('select nextid from ids '.
- ' where nodeid='.$nodeid.
- ' and table_name=\''.$table.'\' '.
- ' and field_name=\''.$field.'\''));
+ global $ZBX_LOCALNODEID;
- if(!$row || is_null($row["nextid"]))
+ $min=bcadd(bcmul($nodeid,"100000000000000"),bcmul($ZBX_LOCALNODEID,"100000000000"));
+ $max=bcadd(bcadd(bcmul($nodeid,"100000000000000"),bcmul($ZBX_LOCALNODEID,"100000000000")),"99999999999");
+ $row = DBfetch(DBselect("select nextid from ids where nodeid=$nodeid and table_name='$table' and field_name='$field'"));
+ if(!$row)
{
- global $ZBX_LOCALNODEID;
-
- $min=bcadd(bcmul($nodeid,"100000000000000"),bcmul($ZBX_LOCALNODEID,"100000000000"));
- $max=bcadd(bcadd(bcmul($nodeid,"100000000000000"),bcmul($ZBX_LOCALNODEID,"100000000000")),"99999999999");
$row=DBfetch(DBselect("select max($field) as id from $table where $field>=$min and $field<=$max"));
if(!$row || is_null($row["id"]))
{
@@ -557,6 +553,13 @@ if(isset($DB_TYPE) && $DB_TYPE == "ORACLE") {
}
else
{
+ /*
+ $ret1 = $row["id"];
+ if($ret1 >= $max) {
+ "Maximum number of id's was exceeded"
+ }
+ */
+
DBexecute("insert into ids (nodeid,table_name,field_name,nextid) values ($nodeid,'$table','$field',".$row["id"].")");
}
continue;
@@ -564,6 +567,10 @@ if(isset($DB_TYPE) && $DB_TYPE == "ORACLE") {
else
{
$ret1 = $row["nextid"];
+ if(($ret1 < $min) || ($ret1 >= $max)) {
+ DBexecute("delete from ids where nodeid=$nodeid and table_name='$table' and field_name='$field'");
+ continue;
+ }
DBexecute("update ids set nextid=nextid+1 where nodeid=$nodeid and table_name='$table' and field_name='$field'");