GitHub user nickaccuweb added a comment to the discussion: Usage Server - 
Cleanup database and start fresh new

@EduFrazao 

Thanks for the clarification.

In your case, the procedure I suggested earlier will not completely resolve 
these issues. Truncating cloud_usage.cloud_usage only removes aggregated usage 
records. It will not fix incorrect IP usage, duplicate source records, or stale 
entries in usage_vm_instance.

I would recommend investigating the underlying issue before performing any 
cleanup.

1. Check cloud.usage_event and cloud_usage.usage_event for missing or 
unprocessed VM destruction and IP release events.
2. Review usage_ip_address and usage_vm_instance for stale records. A missing 
end_date may indicate an issue if the resource has already been released or 
destroyed.
3. Check usage_job and the Usage Server logs for failed jobs or repeated 
processing of older records, which can generate duplicates.
4. Verify the quota calculations separately, as clearing usage records will not 
automatically correct existing quota balances.

I would avoid truncating anything for now. Please take backups of both 
databases before making changes.

Could you share your CloudStack version and a few examples of the incorrect 
records? That would help us identify the cause and suggest a safer cleanup 
procedure without affecting your existing usage history.

Regards,
Nick R
AccuWeb.Cloud

GitHub link: 
https://github.com/apache/cloudstack/discussions/14252#discussioncomment-19408228

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to