gboudreau / Greyhole

Greyhole uses Samba to create a storage pool of all your available hard drives, and allows you to create redundant copies of the files you store.
http://www.greyhole.net
GNU General Public License v3.0
263 stars 34 forks source link

Greyhole won't start #326

Closed spacezorro closed 7 months ago

spacezorro commented 7 months ago

Rebooted my server and Greyhole won't start

greyhole -S

PHP Fatal error: Uncaught Exception: SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP 'uniqness'; check that column/key exists in /usr/bin/greyhole:734 Stack trace:

0 /usr/bin/greyhole(1052): DB::execute('ALTER TABLE `du...')

1 /usr/bin/greyhole(1088): DB::migrate_large_fullpath()

2 /usr/bin/greyhole(856): DB::migrate_18_full_path_utf8mb4()

3 /usr/bin/greyhole(694): DB::migrate()

4 /usr/bin/greyhole(8472): DB::connect(false)

5 /usr/bin/greyhole(8430): CommandLineHelper->getRunner()

6 /usr/bin/greyhole(8691): CommandLineHelper->processCommandLine()

7 {main}

thrown in /usr/bin/greyhole on line 734

spacezorro commented 7 months ago

It's getting hung up on $q = "ALTER TABLE du_stats ADD UNIQUE KEY uniqness (share(64),full_path(200))";

Here is the current du_stats mysql> describe greyhole.du_stats; +-----------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+---------------------+------+-----+---------+-------+ | share | varchar(255) | NO | | NULL | | | full_path | text | NO | | NULL | | | depth | tinyint(3) unsigned | NO | | NULL | | | size | bigint(20) unsigned | NO | | NULL | | +-----------+---------------------+------+-----+---------+-------+ 4 rows in set (0.00 sec)

mysql> show create table greyhole.du_stats; | Table | Create Table +----------+ | du_stats | CREATE TABLE du_stats ( share varchar(255) NOT NULL, full_path text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL, depth tinyint(3) unsigned NOT NULL, size bigint(20) unsigned NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 | +----------+ 1 row in set (0.00 sec)

spacezorro commented 7 months ago

When I try to alter the table by hand it gives me this mysql> ALTER TABLE du_stats ADD UNIQUE KEY uniqness (share(64),full_path(200)); ERROR 1062 (23000): Duplicate entry 'path/one on path/two/' for key 'uniqness'

(/path/one and /path/two/ changed but they are both valid paths on the drives)

gboudreau commented 7 months ago

You can DELETE FROM du_stats, it will be re-populated automatically on the next weekly fsck. then try to create the index using the ALTER TABLE, and then try again to start Greyhole.

spacezorro commented 7 months ago

This worked.

mysql> DELETE FROM du_stats; Query OK, 13413 rows affected (0.03 sec)

mysql> ALTER TABLE du_stats ADD UNIQUE KEY uniqness (share(64),full_path(200)); Query OK, 0 rows affected (0.02 sec) Records: 0 Duplicates: 0 Warnings: 0

I started greyhole and fired off a fsck just because.

spacezorro commented 7 months ago

Thanks.