I wrote a script that reads records from another tracking database (not Piwik), and converts/reports them to Piwik. According to piwik.php debug info, all tracking fields are converted properly, and I get the right number of rows in piwik_log_link_visit_action. Manual inspection of the data also confirms this. However, piwik_log_visit seems to have some anomalous data.
For instance, the following query should not return anything:
SELECT 1 FROM piwik_log_visit AS v LEFT JOIN piwik_log_link_visit_action AS l ON v.idvisit = l.idvisit WHERE DATE(l.server_time) = ‘2012-02-19’ AND v.idvisitor <> l.idvisitor
But there are many rows in piwik_log_visit where different visitors are associated with the same visit. Please let me know if I have the wrong idea about how piwik_log_visit works. Also, could it be because of concurrency issues when writing to the database?
When I was reporting actions to Piwik, VisitSummary and VisitFrequency plugins were activated. Feel free to ask for more details.