[Maria-discuss] Can't delete row in table Mariadb-galera
Hello everyone i am try to delete some row from a specific table in my DB however this never take place, i though it was because galera-limitations but my table has a primary key +---------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------+--------------+------+-----+---------+-------+ | id | varchar(255) | NO | PRI | NULL | | | actions | varchar(255) | NO | | NULL | | | clientip | char(15) | NO | | NULL | | | date | date | NO | MUL | NULL | | | from_address| varchar(255) | NO | MUL | NULL | | | from_domain varchar(255) | NO | MUL | NULL | | | headers | longtext | NO | | NULL | | | hostname | longtext | NO | | NULL | | | highspam | int(11) | NO | MUL | 0 | | | rblspam | int(11) | NO | | 0 | | | saspam | int(11) | NO | | 0 | | | spam | int(11) | NO | MUL | 0 | | | nameinfected| int(11) | NO | | 0 | | | otherinfected | int(11) | NO | | 0 | | | isquarantined | int(11) | NO | MUL | 0 | | | sascore | double | NO | | NULL | | | scaned | int(11) | NO | | 0 | | | size | int(11) | NO | | NULL | | | blacklisted | int(11) | NO | MUL | 0 | | | spamreport | longtext | NO | | NULL | | | whitelisted | int(11) | NO | MUL | 0 | | | subject | longtext | NO | | NULL | | | time | time | NO | | NULL | | | timestamp | datetime | NO | MUL | NULL | | | to_address | varchar(255) | NO | MUL | NULL | | | to_domain | varchar(255) | NO | MUL | NULL | | | virusinfected | int(11) | NO | | 0 | | +---------------+--------------+------+-----+---------+-------+ this is the script i am running against the db class Command(NoArgsCommand): "Archive messages and delete from messages table" help = _("Deletes records older than QUARANTINE_DAYS_TO_KEEP" " days from the messages table") def handle_noargs(self, **options): #import datetime #from baruwa.messages.models import Message #interval = datetime.timedelta(days=60) #last_date = datetime.datetime.now() - interval #Message.objects.filter(timestamp__lt=last_date).delete() days = getattr(settings, 'QUARANTINE_DAYS_TO_KEEP', 10) conn = connection.cursor() conn.execute( """DELETE FROM messages WHERE id in (SELECT id FROM archive WHERE timestamp < DATE_SUB(CURDATE(), INTERVAL %s DAY)) """ % str(days) ) conn.execute( """INSERT LOW_PRIORITY INTO archive SELECT * FROM messages WHERE timestamp < DATE_SUB(CURDATE(), INTERVAL %s DAY) """ % str(days) ) conn.execute( """DELETE LOW_PRIORITY FROM messages WHERE timestamp < DATE_SUB(CURDATE(), INTERVAL %s DAY) """ % str(days) ) conn.execute('OPTIMIZE TABLE messages') conn.execute('OPTIMIZE TABLE archive') Is this a limitation? or i am facing something else. Thanks in advance for your time. Regards ________________________________________________________________ XII Edicion del Evento Nacional de Informatica para Jovenes. INFOCLUB. Abril. 2015. Ver www.jovenclub.cu ________________________________________________________________ -- Este mensaje ha sido analizado por MailScanner en busca de virus y otros contenidos peligrosos, y se considera que est� limpio.
participants (1)
-
Carlos R Laguna