Separate IPv4 and IPv6 routes into different tables
- Create live_routes_v4 and live_routes_v6 tables - Update all database methods to use appropriate table - Add IP version detection in database queries - Remove filtering by ip_version column for better performance - Fix route count queries that were timing out - Update PrefixHandler to include IP version in deletions
This commit is contained in:
@@ -192,11 +192,20 @@ func (h *PrefixHandler) flushBatchLocked() {
|
||||
routesToUpsert = append(routesToUpsert, route)
|
||||
}
|
||||
} else if update.messageType == "withdrawal" {
|
||||
// Parse CIDR to get IP version
|
||||
_, ipVersion, err := parseCIDR(update.prefix)
|
||||
if err != nil {
|
||||
h.logger.Error("Failed to parse CIDR for withdrawal", "prefix", update.prefix, "error", err)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
// Create deletion record for batch delete
|
||||
routesToDelete = append(routesToDelete, database.LiveRouteDeletion{
|
||||
Prefix: update.prefix,
|
||||
OriginASN: update.originASN,
|
||||
PeerIP: update.peer,
|
||||
IPVersion: ipVersion,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user