Browse Source

sql/ckdb - add keysummary DB table and remove unused sharesummary table

master
kanoi 9 years ago
parent
commit
0ea816b154
  1. 66
      sql/ckdb.sql
  2. 53
      sql/v1.0.6-v1.0.7.sql
  3. 2
      src/ckdb.h

66
sql/ckdb.sql

@ -235,40 +235,6 @@ CREATE TABLE shareerrors ( -- not stored in the db - only in log files
);
CREATE TABLE sharesummary ( -- per workinfo for each user+worker - RAM not DB
userid bigint NOT NULL,
workername character varying(256) NOT NULL,
workinfoid bigint NOT NULL,
diffacc float NOT NULL,
diffsta float NOT NULL,
diffdup float NOT NULL,
diffhi float NOT NULL,
diffrej float NOT NULL,
shareacc float NOT NULL,
sharesta float NOT NULL,
sharedup float NOT NULL,
sharehi float NOT NULL,
sharerej float NOT NULL,
sharecount bigint NOT NULL,
errorcount bigint NOT NULL,
firstshare timestamp with time zone NOT NULL,
lastshare timestamp with time zone NOT NULL,
firstshareacc timestamp with time zone NOT NULL,
lastshareacc timestamp with time zone NOT NULL,
lastdiffacc float NOT NULL,
complete char NOT NULL,
createdate timestamp with time zone NOT NULL,
createby character varying(64) NOT NULL,
createcode character varying(128) NOT NULL,
createinet character varying(128) NOT NULL,
modifydate timestamp with time zone NOT NULL,
modifyby character varying(64) NOT NULL,
modifycode character varying(128) NOT NULL,
modifyinet character varying(128) NOT NULL,
PRIMARY KEY (workinfoid, userid, workername)
);
CREATE TABLE marks ( -- workinfoids to make workmarkers
poolinstance character varying(256) NOT NULL,
workinfoid bigint NOT NULL,
@ -334,6 +300,36 @@ CREATE TABLE markersummary ( -- sum of sharesummary for a workinfo range
);
-- this is optionally filled, for statistical analysis - see code
CREATE TABLE keysummary (
markerid bigint NOT NULL,
keytype char NOT NULL,
key character varying(128) NOT NULL,
diffacc float NOT NULL,
diffsta float NOT NULL,
diffdup float NOT NULL,
diffhi float NOT NULL,
diffrej float NOT NULL,
shareacc float NOT NULL,
sharesta float NOT NULL,
sharedup float NOT NULL,
sharehi float NOT NULL,
sharerej float NOT NULL,
sharecount bigint NOT NULL,
errorcount bigint NOT NULL,
firstshare timestamp with time zone NOT NULL,
lastshare timestamp with time zone NOT NULL,
firstshareacc timestamp with time zone NOT NULL,
lastshareacc timestamp with time zone NOT NULL,
lastdiffacc float NOT NULL,
createdate timestamp with time zone NOT NULL,
createby character varying(64) NOT NULL,
createcode character varying(128) NOT NULL,
createinet character varying(128) NOT NULL,
PRIMARY KEY (markerid, keytype, key)
);
CREATE TABLE blocks (
height integer not NULL,
blockhash character varying(256) NOT NULL,
@ -474,4 +470,4 @@ CREATE TABLE version (
PRIMARY KEY (vlock)
);
insert into version (vlock,version) values (1,'1.0.6');
insert into version (vlock,version) values (1,'1.0.7');

53
sql/v1.0.6-v1.0.7.sql

@ -0,0 +1,53 @@
SET SESSION AUTHORIZATION 'postgres';
BEGIN transaction;
DO $$
DECLARE ver TEXT;
BEGIN
UPDATE version set version='1.0.7' where vlock=1 and version='1.0.6';
IF found THEN
RETURN;
END IF;
SELECT version into ver from version
WHERE vlock=1;
RAISE EXCEPTION 'Wrong DB version - expect "1.0.6" - found "%"', ver;
END $$;
CREATE TABLE keysummary (
markerid bigint NOT NULL,
keytype char NOT NULL,
key character varying(128) NOT NULL,
diffacc float NOT NULL,
diffsta float NOT NULL,
diffdup float NOT NULL,
diffhi float NOT NULL,
diffrej float NOT NULL,
shareacc float NOT NULL,
sharesta float NOT NULL,
sharedup float NOT NULL,
sharehi float NOT NULL,
sharerej float NOT NULL,
sharecount bigint NOT NULL,
errorcount bigint NOT NULL,
firstshare timestamp with time zone NOT NULL,
lastshare timestamp with time zone NOT NULL,
firstshareacc timestamp with time zone NOT NULL,
lastshareacc timestamp with time zone NOT NULL,
lastdiffacc float NOT NULL,
createdate timestamp with time zone NOT NULL,
createby character varying(64) NOT NULL,
createcode character varying(128) NOT NULL,
createinet character varying(128) NOT NULL,
PRIMARY KEY (markerid, keytype, key)
);
-- only in RAM so no need for it in the DB - for a while now
DROP table sharesummary;
END transaction;

2
src/ckdb.h

@ -51,7 +51,7 @@
* Consider adding row level locking (a per kitem usage count) if needed */
#define DB_VLOCK "1"
#define DB_VERSION "1.0.6"
#define DB_VERSION "1.0.7"
#define CKDB_VERSION DB_VERSION"-2.108"
#define WHERE_FFL " - from %s %s() line %d"

Loading…
Cancel
Save