Skip to content

Commit

Permalink
Increase the length of mining_workers.worker_name to 50 bytes and…
Browse files Browse the repository at this point in the history
… add an index on it.

* Prevent truncation of worker_name in single-user mode.
* Indexing can speed up worker_name prefix lookups.
  • Loading branch information
SwimmingTiger committed Mar 22, 2020
1 parent abe3824 commit e71a11b
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 26 deletions.
5 changes: 3 additions & 2 deletions docker/btcpool/test/mysql/sql/bpool_local_db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ CREATE TABLE `mining_workers` (
`worker_id` bigint(20) NOT NULL,
`puid` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
`worker_name` varchar(20) DEFAULT NULL,
`worker_name` varchar(50) DEFAULT NULL,
`accept_1m` bigint(20) NOT NULL DEFAULT '0',
`accept_5m` bigint(20) NOT NULL DEFAULT '0',
`accept_15m` bigint(20) NOT NULL DEFAULT '0',
Expand All @@ -67,7 +67,8 @@ CREATE TABLE `mining_workers` (
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
UNIQUE KEY `puid_worker_id` (`puid`,`worker_id`),
KEY `puid_group_id` (`puid`,`group_id`)
KEY `puid_group_id` (`puid`,`group_id`),
KEY `puid_worker_name` (`puid`,`worker_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


Expand Down
5 changes: 3 additions & 2 deletions docker/btcpool/test/mysql/sql/bpool_local_db_BEAM.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CREATE TABLE `mining_workers` (
`worker_id` bigint(20) NOT NULL,
`puid` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
`worker_name` varchar(20) DEFAULT NULL,
`worker_name` varchar(50) DEFAULT NULL,
`accept_1m` bigint(20) NOT NULL DEFAULT '0',
`accept_5m` bigint(20) NOT NULL DEFAULT '0',
`accept_15m` bigint(20) NOT NULL DEFAULT '0',
Expand All @@ -53,7 +53,8 @@ CREATE TABLE `mining_workers` (
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
UNIQUE KEY `puid_worker_id` (`puid`,`worker_id`),
KEY `puid_group_id` (`puid`,`group_id`)
KEY `puid_group_id` (`puid`,`group_id`),
KEY `puid_worker_name` (`puid`,`worker_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


Expand Down
5 changes: 3 additions & 2 deletions docker/btcpool/test/mysql/sql/bpool_local_db_Bytom.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CREATE TABLE `mining_workers` (
`worker_id` bigint(20) NOT NULL,
`puid` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
`worker_name` varchar(20) DEFAULT NULL,
`worker_name` varchar(50) DEFAULT NULL,
`accept_1m` bigint(20) NOT NULL DEFAULT '0',
`accept_5m` bigint(20) NOT NULL DEFAULT '0',
`accept_15m` bigint(20) NOT NULL DEFAULT '0',
Expand All @@ -50,7 +50,8 @@ CREATE TABLE `mining_workers` (
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
UNIQUE KEY `puid_worker_id` (`puid`,`worker_id`),
KEY `puid_group_id` (`puid`,`group_id`)
KEY `puid_group_id` (`puid`,`group_id`),
KEY `puid_worker_name` (`puid`,`worker_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


Expand Down
5 changes: 3 additions & 2 deletions docker/btcpool/test/mysql/sql/bpool_local_db_Decred.sql
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ CREATE TABLE `mining_workers` (
`worker_id` bigint(20) NOT NULL,
`puid` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
`worker_name` varchar(20) DEFAULT NULL,
`worker_name` varchar(50) DEFAULT NULL,
`accept_1m` bigint(20) NOT NULL DEFAULT '0',
`accept_5m` bigint(20) NOT NULL DEFAULT '0',
`accept_15m` bigint(20) NOT NULL DEFAULT '0',
Expand All @@ -56,7 +56,8 @@ CREATE TABLE `mining_workers` (
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
UNIQUE KEY `puid_worker_id` (`puid`,`worker_id`),
KEY `puid_group_id` (`puid`,`group_id`)
KEY `puid_group_id` (`puid`,`group_id`),
KEY `puid_worker_name` (`puid`,`worker_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


Expand Down
5 changes: 3 additions & 2 deletions docker/btcpool/test/mysql/sql/bpool_local_db_ETH.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ CREATE TABLE `mining_workers` (
`worker_id` bigint(20) NOT NULL,
`puid` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
`worker_name` varchar(20) DEFAULT NULL,
`worker_name` varchar(50) DEFAULT NULL,
`accept_1m` bigint(20) NOT NULL DEFAULT '0',
`accept_5m` bigint(20) NOT NULL DEFAULT '0',
`accept_15m` bigint(20) NOT NULL DEFAULT '0',
Expand All @@ -57,7 +57,8 @@ CREATE TABLE `mining_workers` (
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
UNIQUE KEY `puid_worker_id` (`puid`,`worker_id`),
KEY `puid_group_id` (`puid`,`group_id`)
KEY `puid_group_id` (`puid`,`group_id`),
KEY `puid_worker_name` (`puid`,`worker_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


Expand Down
5 changes: 3 additions & 2 deletions docker/btcpool/test/mysql/sql/bpool_local_db_Grin.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CREATE TABLE `mining_workers` (
`worker_id` bigint(20) NOT NULL,
`puid` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
`worker_name` varchar(20) DEFAULT NULL,
`worker_name` varchar(50) DEFAULT NULL,
`accept_1m` bigint(20) NOT NULL DEFAULT '0',
`accept_5m` bigint(20) NOT NULL DEFAULT '0',
`accept_15m` bigint(20) NOT NULL DEFAULT '0',
Expand All @@ -53,7 +53,8 @@ CREATE TABLE `mining_workers` (
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
UNIQUE KEY `puid_worker_id` (`puid`,`worker_id`),
KEY `puid_group_id` (`puid`,`group_id`)
KEY `puid_group_id` (`puid`,`group_id`),
KEY `puid_worker_name` (`puid`,`worker_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


Expand Down
5 changes: 3 additions & 2 deletions install/bpool_local_db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ CREATE TABLE `mining_workers` (
`worker_id` bigint(20) NOT NULL,
`puid` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
`worker_name` varchar(20) DEFAULT NULL,
`worker_name` varchar(50) DEFAULT NULL,
`accept_1m` bigint(20) NOT NULL DEFAULT '0',
`accept_5m` bigint(20) NOT NULL DEFAULT '0',
`accept_15m` bigint(20) NOT NULL DEFAULT '0',
Expand All @@ -65,7 +65,8 @@ CREATE TABLE `mining_workers` (
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
UNIQUE KEY `puid_worker_id` (`puid`,`worker_id`),
KEY `puid_group_id` (`puid`,`group_id`)
KEY `puid_group_id` (`puid`,`group_id`),
KEY `puid_worker_name` (`puid`,`worker_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


Expand Down
5 changes: 3 additions & 2 deletions install/bpool_local_db_BEAM.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CREATE TABLE `mining_workers` (
`worker_id` bigint(20) NOT NULL,
`puid` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
`worker_name` varchar(20) DEFAULT NULL,
`worker_name` varchar(50) DEFAULT NULL,
`accept_1m` bigint(20) NOT NULL DEFAULT '0',
`accept_5m` bigint(20) NOT NULL DEFAULT '0',
`accept_15m` bigint(20) NOT NULL DEFAULT '0',
Expand All @@ -49,7 +49,8 @@ CREATE TABLE `mining_workers` (
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
UNIQUE KEY `puid_worker_id` (`puid`,`worker_id`),
KEY `puid_group_id` (`puid`,`group_id`)
KEY `puid_group_id` (`puid`,`group_id`),
KEY `puid_worker_name` (`puid`,`worker_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


Expand Down
5 changes: 3 additions & 2 deletions install/bpool_local_db_Bytom.sql
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ CREATE TABLE `mining_workers` (
`worker_id` bigint(20) NOT NULL,
`puid` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
`worker_name` varchar(20) DEFAULT NULL,
`worker_name` varchar(50) DEFAULT NULL,
`accept_1m` bigint(20) NOT NULL DEFAULT '0',
`accept_5m` bigint(20) NOT NULL DEFAULT '0',
`accept_15m` bigint(20) NOT NULL DEFAULT '0',
Expand All @@ -46,7 +46,8 @@ CREATE TABLE `mining_workers` (
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
UNIQUE KEY `puid_worker_id` (`puid`,`worker_id`),
KEY `puid_group_id` (`puid`,`group_id`)
KEY `puid_group_id` (`puid`,`group_id`),
KEY `puid_worker_name` (`puid`,`worker_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


Expand Down
5 changes: 3 additions & 2 deletions install/bpool_local_db_CKB.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CREATE TABLE `mining_workers` (
`worker_id` bigint(20) NOT NULL,
`puid` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
`worker_name` varchar(20) DEFAULT NULL,
`worker_name` varchar(50) DEFAULT NULL,
`accept_1m` bigint(20) NOT NULL DEFAULT '0',
`accept_5m` bigint(20) NOT NULL DEFAULT '0',
`accept_15m` bigint(20) NOT NULL DEFAULT '0',
Expand All @@ -53,7 +53,8 @@ CREATE TABLE `mining_workers` (
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
UNIQUE KEY `puid_worker_id` (`puid`,`worker_id`),
KEY `puid_group_id` (`puid`,`group_id`)
KEY `puid_group_id` (`puid`,`group_id`),
KEY `puid_worker_name` (`puid`,`worker_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


Expand Down
5 changes: 3 additions & 2 deletions install/bpool_local_db_Decred.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ CREATE TABLE `mining_workers` (
`worker_id` bigint(20) NOT NULL,
`puid` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
`worker_name` varchar(20) DEFAULT NULL,
`worker_name` varchar(50) DEFAULT NULL,
`accept_1m` bigint(20) NOT NULL DEFAULT '0',
`accept_5m` bigint(20) NOT NULL DEFAULT '0',
`accept_15m` bigint(20) NOT NULL DEFAULT '0',
Expand All @@ -52,7 +52,8 @@ CREATE TABLE `mining_workers` (
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
UNIQUE KEY `puid_worker_id` (`puid`,`worker_id`),
KEY `puid_group_id` (`puid`,`group_id`)
KEY `puid_group_id` (`puid`,`group_id`),
KEY `puid_worker_name` (`puid`,`worker_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


Expand Down
5 changes: 3 additions & 2 deletions install/bpool_local_db_ETH.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CREATE TABLE `mining_workers` (
`worker_id` bigint(20) NOT NULL,
`puid` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
`worker_name` varchar(20) DEFAULT NULL,
`worker_name` varchar(50) DEFAULT NULL,
`accept_1m` bigint(20) NOT NULL DEFAULT '0',
`accept_5m` bigint(20) NOT NULL DEFAULT '0',
`accept_15m` bigint(20) NOT NULL DEFAULT '0',
Expand All @@ -53,7 +53,8 @@ CREATE TABLE `mining_workers` (
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
UNIQUE KEY `puid_worker_id` (`puid`,`worker_id`),
KEY `puid_group_id` (`puid`,`group_id`)
KEY `puid_group_id` (`puid`,`group_id`),
KEY `puid_worker_name` (`puid`,`worker_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


Expand Down
5 changes: 3 additions & 2 deletions install/bpool_local_db_Grin.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CREATE TABLE `mining_workers` (
`worker_id` bigint(20) NOT NULL,
`puid` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
`worker_name` varchar(20) DEFAULT NULL,
`worker_name` varchar(50) DEFAULT NULL,
`accept_1m` bigint(20) NOT NULL DEFAULT '0',
`accept_5m` bigint(20) NOT NULL DEFAULT '0',
`accept_15m` bigint(20) NOT NULL DEFAULT '0',
Expand All @@ -49,7 +49,8 @@ CREATE TABLE `mining_workers` (
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
UNIQUE KEY `puid_worker_id` (`puid`,`worker_id`),
KEY `puid_group_id` (`puid`,`group_id`)
KEY `puid_group_id` (`puid`,`group_id`),
KEY `puid_worker_name` (`puid`,`worker_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


Expand Down
6 changes: 6 additions & 0 deletions install/db.change.sql
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,9 @@ add `reject_detail` varchar(255) default '' NOT NULL after `share_reject`;
ALTER TABLE `found_nmc_blocks`
add `chain_name` varchar(20) NOT NULL default '' after `is_orphaned`,
add `submit_response` varchar(255) NOT NULL default '' after `is_orphaned`;


-- 2020-03-02
-- Increase the length of `mining_workers`.`worker_name` to 50 bytes and add an index on it.
ALTER TABLE `mining_workers` CHANGE `worker_name` `worker_name` VARCHAR(50);
ALTER TABLE `mining_workers` ADD INDEX `puid_worker_name`(`puid`, `worker_name`);

0 comments on commit e71a11b

Please sign in to comment.