From bd653f3a1b385892186cb9fca491ee9ec5e9bbed Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Fri, 27 Nov 2020 18:20:44 +0100 Subject: log write throttles --- it_dbi.class | 3 +++ 1 file changed, 3 insertions(+) (limited to 'it_dbi.class') diff --git a/it_dbi.class b/it_dbi.class index 32ae831..344976a 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -604,7 +604,10 @@ function query($query, $p = array()) } if ($writing && $this->_p['throttle_writes']) + { + it::log('debug', 'dbi-throttle', 1000000 * (gettimeofday(true) - $start) * $this->_p['throttle_writes']); usleep(1000000 * (gettimeofday(true) - $start) * $this->_p['throttle_writes']); + } $msec = round(1000 * (gettimeofday(true) - $start)); $slow = $msec >= 2000; -- cgit v1.2.3 From c24687f11c1fdabb2cfa30f6a01c019a2085344a Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Tue, 5 Jan 2021 13:44:14 +0100 Subject: Remove support for obsolete _read_post_process/_write_pre_process, use static _read_postprocess/_write_preprocess instead --- it_dbi.class | 24 ------------------------ 1 file changed, 24 deletions(-) (limited to 'it_dbi.class') diff --git a/it_dbi.class b/it_dbi.class index 344976a..23a7be0 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -473,26 +473,6 @@ function _fatal($text, $body = null) } -/** - * Post-process data after reading a record. - * This is a stub-function that can be overloaded. - */ -function _read_post_process() -{ -} - - -/** - * Pre-process data before writing a record. - * This is a stub-function that can be overloaded. - * @param $tags Reference to update/create tags, can be modified as needed - * @param $command SQL command ('INSERT', 'REPLACE' or 'UPDATE') - */ -function _write_pre_process(&$tags, $command) # NOPHPLINT FIXME 2020-12 CS Remove legacy hooks now replace by pure and static versions -{ -} - - /** * Hook to postprocess data after reading a record. * This is a stub-function that can be overloaded. @@ -771,8 +751,6 @@ function iterate() if ($this->_p['unbuffered']) $this->_result->close(); } - - $this->_read_post_process(); } else $this->_nofetch = false; @@ -796,7 +774,6 @@ function insert($tags = array(), $command = "INSERT") /* Pre-processing, $tags is passed by reference and may be modified here */ $tags = static::_write_preprocess($tags); - $this->_write_pre_process($tags, $command); if ($this->_p['randomid'] && !isset($tags[$this->_p['keyfield']])) $tags[$this->_p['keyfield']] = bin2hex(random_bytes(16)); @@ -855,7 +832,6 @@ function update($tags = array(), $where = null) /* Pre-processing, $tags is passed by reference and may be modified here */ $tags = static::_write_preprocess($tags); - $this->_write_pre_process($tags, 'UPDATE'); if ($set = $this->_set($tags, isset($where))) { -- cgit v1.2.3 From 13150f87c59dc052f698e7e905c07f56ccefaec7 Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Tue, 5 Jan 2021 14:05:26 +0100 Subject: Remove 11 year old FIXME comment, code has been in use like that long enough :-) --- it_dbi.class | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'it_dbi.class') diff --git a/it_dbi.class b/it_dbi.class index 23a7be0..0fa890a 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -150,7 +150,7 @@ static function createclass($p) # Make sure singleton exists $dbi = $GLOBALS['it_dbi'] ? $GLOBALS['it_dbi'] : new it_dbi(array('table' => null) + $p); - $p += $dbi->_p; # FIXME: (has to be checked for side effects!) + $p += $dbi->_p; $dbid = $dbi->_dbid = "{$p['user']}@{$p['server']}:{$p['db']}"; if (!isset($dbi->_tables[$dbid])) -- cgit v1.2.3