To be more specific, RBH creates DB queries dynamically using rule constraints, in this case DB query would be:
SELECT ENTRIES.id AS id FROM ENTRIES WHERE ENTRIES.type='dir' AND (ENTRIES.invalid=0 OR ENTRIES.invalid IS NULL) AND (ENTRIES.last_mod<1491056588 OR ENTRIES.last_mod IS NULL) AND NOT (((ENTRIES.uid='root' OR ENTRIES.uid IS NULL) OR "depth < 2")) LIMIT 100000 Entries table does not have a "depth" column, therefore this condition is ignored during the construction of SQL statement. "OR depth < 2))" is the part that should be part of the statement, given that "depth" can't be used for SQL filtering the whole string is missing, including last 2 "))" Source file that most likely need to be fixed is listmgr_common.c Davide On 05.04.17 16:27, Andrew Elwell wrote: > I've just built the latest 3 from GIT: > > f001:~ # robinhood --version > > Product: robinhood > Version: 3.0-1 > Build: 2017-04-04 13:54:29 > > Compilation switches: > Lustre filesystems > Lustre Version: 2.7 > Address entries by FID > MDT Changelogs supported > > Database binding: MySQL > > Report bugs to: <robinhood-support@lists.sourceforge.net> > > and with the default includes/rmdir.inc > > f001:~ # cat /etc/robinhood.d/includes/rmdir.inc > # used to be rbh 2.5 "rmdir" policies in TMPFS mode > define_policy rmdir_empty { > scope {type == directory and dircount == 0} > status_manager = none; > default_action = common.rmdir; > default_lru_sort_attr = last_mod; > } > > define_policy rmdir_recurse { > scope {type == directory} > status_manager = none; > default_action = cmd("rm -rf {fullpath}"); > default_lru_sort_attr = last_mod; > } > > I'm seeing SQL syntax errors with a very simple rmdir_empty_rules: > > rmdir_empty_rules { > ignore { owner == root or depth < 2 } > rule default { > condition { last_mod > 4d } > } > } > > rmdir_empty_parameters { > lru_sort_attr = none; > } > > rmdir_empty_trigger { > trigger_on = periodic; > check_interval = 12h; > } > > > > f001:~ # robinhood --run=rmdir_empty --once > Using config file '/etc/robinhood.d/scratch.conf'. > 2017/04/05 22:23:08 robinhood@f001[181751/1] CheckFS | '/scratch' > matches mount point '/scratch', type=lustre, > fs=10.10.100.23@o2ib1:10.10.100.24@o2ib1:/snx11038 > 2017/04/05 22:23:08 robinhood@f001[181751/2] rmdir_empty | Checking > policy rules for all > 2017/04/05 22:23:08 robinhood@f001[181751/2] rmdir_empty | Building > policy list - last full FS Scan: 2017/04/05 01:44:59 > 2017/04/05 22:23:08 robinhood@f001[181751/2] rmdir_empty | Starting policy run > 2017/04/05 22:23:08 robinhood@f001[181751/2] ListMgr | SQL request parse error > 2017/04/05 22:23:08 robinhood@f001[181751/2] ListMgr | Error 7 > executing query 'SELECT ENTRIES.id AS id FROM ENTRIES WHERE > ENTRIES.type='dir' AND (ENTRIES.invalid=0 OR ENTRIES.invalid IS NULL) > AND (ENTRIES.last_mod<1491056588 OR ENTRIES.last_mod IS NULL) AND NOT > (((ENTRIES.uid='root' OR ENTRIES.uid IS NULL) LIMIT 100000': You have > an error in your SQL syntax; check the manual that corresponds to your > MariaDB server version for the right syntax to use near 'LIMIT 100000' > at line 1 > 2017/04/05 22:23:08 robinhood@f001[181751/2] rmdir_empty | Error > retrieving list of candidates from database. Policy run cancelled. > 2017/04/05 22:23:08 robinhood@f001[181751/2] rmdir_empty | Error > running policy on all. 0 successful actions; volume: 0; 0 entries > skipped; 0 errors. > 2017/04/05 22:23:08 robinhood@f001[181751/1] Main | rmdir_empty: > policy run terminated (rc = 0). > 2017/04/05 22:23:08 robinhood@f001[181751/1] Main | All tasks done! Exiting. > > which seems to be caused by the excessive ((( on the sql: - typing > verbatim into SQL query: > > MariaDB [rbh_scratch]> SELECT ENTRIES.id AS id FROM ENTRIES WHERE > ENTRIES.type='dir' AND (ENTRIES.invalid=0 OR ENTRIES.invalid IS NULL) > AND (ENTRIES.last_mod<1491055908 OR ENTRIES.last_mod IS NULL) AND NOT > (((ENTRIES.uid='root' OR ENTRIES.uid IS NULL) LIMIT 100000; > ERROR 1064 (42000): You have an error in your SQL syntax; check the > manual that corresponds to your MariaDB server version for the right > syntax to use near 'LIMIT 100000' at line 1 > > and limiting the returned limit slightly gives same error as expected > > MariaDB [rbh_scratch]> SELECT ENTRIES.id AS id FROM ENTRIES WHERE > ENTRIES.type='dir' AND (ENTRIES.invalid=0 OR ENTRIES.invalid IS NULL) > AND (ENTRIES.last_mod<1491055908 OR ENTRIES.last_mod IS NULL) AND NOT > (((ENTRIES.uid='root' OR ENTRIES.uid IS NULL) LIMIT 10; > ERROR 1064 (42000): You have an error in your SQL syntax; check the > manual that corresponds to your MariaDB server version for the right > syntax to use near 'LIMIT 10' at line 1 > > but changing ((( -> ( works > > MariaDB [rbh_scratch]> SELECT ENTRIES.id AS id FROM ENTRIES WHERE > ENTRIES.type='dir' AND (ENTRIES.invalid=0 OR ENTRIES.invalid IS NULL) > AND (ENTRIES.last_mod<1491055908 OR ENTRIES.last_mod IS NULL) AND NOT > (ENTRIES.uid='root' OR ENTRIES.uid IS NULL) LIMIT 10; > +------------------------+ > | id | > +------------------------+ > | 0x20122a6bf:0x1463:0x0 | > | 0x20122a6bf:0xdf7:0x0 | > | 0x20122a6bf:0xdf8:0x0 | > | 0x20122a6bf:0xdf9:0x0 | > | 0x20122a780:0x1e26:0x0 | > | 0x20126f104:0x42:0x0 | > | 0x20126f104:0x43:0x0 | > | 0x20126f104:0x44:0x0 | > | 0x201270789:0x1c7:0x0 | > | 0x201270789:0x401:0x0 | > +------------------------+ > 10 rows in set (0.00 sec) > > MariaDB [rbh_scratch]> > > > I can't see where this is defined in the source, to submit a patch I'm afraid > > > Andrew > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > robinhood-support mailing list > robinhood-support@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/robinhood-support > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ robinhood-support mailing list robinhood-support@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/robinhood-support