Not able to delete records from tc_positions table

keshav22083 months ago

Hi,

I have one bash script to delete records from tc_events table and tc_positions table. Attaching script screenshot for your reference.

Screenshot 2024-09-10 224346.png

This was working fine till around 28-30Aug but now when i checked i can see records are not getting deleted for tc_positions table. Records for tc_events are still getting deleted issue is only with tc_positions table.

Even when i tried to run this command using MySQL command line, i was not able to delete the records in tc_positions table and the cli was stuck at the DELETE command.

Traccar Version - 6.4
MySQL Server Version - 8.0.39-0ubuntu0.22.04.1 - (Ubuntu)

Anton Tananaev3 months ago

You're probably trying to delete too much data. Check this documentation on what you should do:

https://www.traccar.org/clear-history/

keshav22083 months ago

Indeed issue was because i was trying to delete too much data. Using the script provided in the documentation resolved the issue. Thanks for the help!

keshav22083 months ago

Hi,

Just observed that the script is deleting the records but even after deleting the records, the command is still running.

Screenshot 2024-09-11 222859.png

Any idea why this is happening? Is the script not able to come out of the loop?

Anton Tananaev3 months ago

It's probably still cleaning the data.

keshav22083 months ago

I have checked the tc_positions table, it deleted records for one day, now its not deleting any record but command is still running.

Anton Tananaev3 months ago

The script checks for certain output. Try checking what output you get when you run the query.

keshav22083 months ago

I just modified the script to delete 40000 rows and print the "result" variable output after each loop iteration. Its printing the below output after each iteration but once all the records are deleted it prints "ERROR 1206 (HY000) at line 1: The total number of locks exceeds the lock table size". I suppose that's why loop is not able to terminate.

Screenshot 2024-09-11 233107.png

Anton Tananaev3 months ago

Very possible.