Changeset 462


Ignore:
Timestamp:
02/27/13 17:20:18 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

RPC tweaks and fixes.

  • Add config-loader line to check for RPC mode (XMLRPC, HTTP, or socket)
  • Speedup in getRevPattern by limiting the records to be cast as inet to the zone(s) the requested CIDR is in
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r459 r462  
    13041304          push @{$config{rpcacl}{$rpcsys}}, @ips;
    13051305        }
     1306        $config{rpcmode} = $1 if /^rpc_mode\s*=\s*(socket|HTTP|XMLRPC)\s*$/i;
    13061307      }
    13071308    }
     
    39903991  my $group = shift || 1;       # just in case
    39913992
    3992   my ($revpatt) = $dbh->selectrow_array("SELECT r.host FROM records r JOIN revzones z ON r.rdns_id=z.rdns_id ".
    3993         "WHERE (r.type in (12,65280,65281,65282,65283,65284)) AND z.group_id=? AND CAST (r.val AS inet) >>= ? ".
    3994         "ORDER BY CAST (r.val AS inet) DESC LIMIT 1", undef, ($group, $cidr) );
     3993  # for speed!  Casting and comparing even ~7K records takes ~2.5s, so narrow it down to one revzone first.
     3994  my ($revid) = $dbh->selectrow_array("SELECT rdns_id FROM revzones WHERE revnet >>= ? AND group_id = ?",
     3995        undef, ($cidr, $group) );
     3996
     3997##fixme?  may need to narrow things down more by octet-chopping and doing text comparisons before casting.
     3998  my ($revpatt) = $dbh->selectrow_array("SELECT host FROM records ".
     3999        "WHERE (type in (12,65280,65281,65282,65283,65284)) AND rdns_id = ? AND CAST (val AS inet) >>= ? ".
     4000        "ORDER BY CAST (val AS inet) DESC LIMIT 1", undef, ($revid, $cidr) );
    39954001  return $revpatt;
    39964002} # end getRevPattern()
Note: See TracChangeset for help on using the changeset viewer.