exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

0002-revolving_work_shards.sql (2119B)


      1 --
      2 -- This file is part of TALER
      3 -- Copyright (C) 2014--2022 Taler Systems SA
      4 --
      5 -- TALER is free software; you can redistribute it and/or modify it under the
      6 -- terms of the GNU General Public License as published by the Free Software
      7 -- Foundation; either version 3, or (at your option) any later version.
      8 --
      9 -- TALER is distributed in the hope that it will be useful, but WITHOUT ANY
     10 -- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     11 -- A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     12 --
     13 -- You should have received a copy of the GNU General Public License along with
     14 -- TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15 --
     16 
     17 CREATE UNLOGGED TABLE revolving_work_shards
     18   (shard_serial_id BIGINT GENERATED BY DEFAULT AS IDENTITY UNIQUE
     19   ,last_attempt INT8 NOT NULL
     20   ,start_row INT4 NOT NULL
     21   ,end_row INT4 NOT NULL
     22   ,active BOOLEAN NOT NULL DEFAULT FALSE
     23   ,job_name TEXT NOT NULL
     24   ,PRIMARY KEY (job_name, start_row)
     25   );
     26 COMMENT ON TABLE revolving_work_shards
     27   IS 'coordinates work between multiple processes working on the same job with partitions that need to be repeatedly processed; unlogged because on system crashes the locks represented by this table will have to be cleared anyway, typically using "taler-exchange-dbinit -s"';
     28 COMMENT ON COLUMN revolving_work_shards.shard_serial_id
     29   IS 'unique serial number identifying the shard';
     30 COMMENT ON COLUMN revolving_work_shards.last_attempt
     31   IS 'last time a worker attempted to work on the shard';
     32 COMMENT ON COLUMN revolving_work_shards.active
     33   IS 'set to TRUE when a worker is active on the shard';
     34 COMMENT ON COLUMN revolving_work_shards.start_row
     35   IS 'row at which the shard scope starts, inclusive';
     36 COMMENT ON COLUMN revolving_work_shards.end_row
     37   IS 'row at which the shard scope ends, exclusive';
     38 COMMENT ON COLUMN revolving_work_shards.job_name
     39   IS 'unique name of the job the workers on this shard are performing';
     40 
     41 CREATE INDEX revolving_work_shards_by_job_name_active_last_attempt_index
     42   ON revolving_work_shards
     43   (job_name
     44   ,active
     45   ,last_attempt
     46   );