zrhoffman commented on a change in pull request #4409: Optimize TR DNSSEC zone 
re-signing
URL: https://github.com/apache/trafficcontrol/pull/4409#discussion_r382111752
 
 

 ##########
 File path: 
traffic_router/core/src/main/java/com/comcast/cdn/traffic_control/traffic_router/core/dns/ZoneManager.java
 ##########
 @@ -538,6 +596,42 @@ private static void primeDNSDeliveryServices(final String 
domain, final TrafficR
                }
        }
 
+       // Check if the zones are equal except for the SOA record serial 
number, NSEC, or RRSIG records
+       private static boolean zonesAreEqual(final List<Record> newRecords, 
final List<Record> oldRecords) {
+               final List<Record> oldRecordsCopy = oldRecords.stream()
+                               .filter(r -> !(r instanceof NSECRecord) && !(r 
instanceof RRSIGRecord))
+                               .collect(Collectors.toList());
+               final List<Record> newRecordsCopy = newRecords.stream()
+                               .filter(r -> !(r instanceof NSECRecord) && !(r 
instanceof RRSIGRecord))
+                               .collect(Collectors.toList());
+               if (oldRecordsCopy.size() != newRecordsCopy.size()) {
+                       return false;
+               }
+               Collections.sort(oldRecordsCopy);
+               Collections.sort(newRecordsCopy);
+               for (int i = 0; i < newRecordsCopy.size(); i++) {
+                       final Record newRec = newRecordsCopy.get(i);
+                       final Record oldRec = oldRecordsCopy.get(i);
+                       if (newRec instanceof SOARecord && oldRec instanceof 
SOARecord) {
 
 Review comment:
   Use `getType()` and `Type.SOA` to check if they are SOA records, not 
`instanceof`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to