Changeset 450


Ignore:
Timestamp:
01/10/13 17:23:03 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Fix caching glitch in reverse record export by simplifying the
caching mechanism so that new writes are always done to the cache,
then the cache is always streamed to the final target.

It's not yet clear if this will provide a minor speed boost or
slowdown, or if any change will be lost in the noise.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/DNSDB.pm

    r449 r450  
    47014701        }
    47024702
    4703         _printrec_tiny($datafile, 'n', \%recflags,
    4704                 $dom, $host, $type, $val, $dist, $weight, $port, $ttl, $loc, $stamp);
    4705 
    47064703        _printrec_tiny(*ZONECACHE, 'n', \%recflags,
    47074704                $dom, $host, $type, $val, $dist, $weight, $port, $ttl, $loc, $stamp)
    47084705                if *ZONECACHE;
     4706
    47094707        # in case the zone shrunk, get rid of garbage at the end of the file.
    47104708        truncate(ZONECACHE, tell(ZONECACHE));
     
    47124710        $recflags{$recid} = 1;
    47134711      } # while ($recsth)
    4714     } else {
    4715       # domain not changed, stream from cache
    4716       print $datafile $_ while <ZONECACHE>;
    4717     }
     4712    }
     4713    # stream from cache, whether freshly created or existing
     4714    print $datafile $_ while <ZONECACHE>;
    47184715    close ZONECACHE;
    47194716    # mark domain as unmodified
     
    47574754      $soasth->execute($revid);
    47584755      my (@zsoa) = $soasth->fetchrow_array();
    4759       _printrec_tiny($datafile,'y',\%recflags,$revzone,
    4760         $zsoa[0],$zsoa[1],$zsoa[2],$zsoa[3],$zsoa[4],$zsoa[5],$zsoa[6],$zsoa[8],'');
    47614756      _printrec_tiny(*ZONECACHE,'y',\%recflags,$revzone,
    47624757        $zsoa[0],$zsoa[1],$zsoa[2],$zsoa[3],$zsoa[4],$zsoa[5],$zsoa[6],$zsoa[8],'');
     
    47814776        $ttl = '' if $ttl == '0';
    47824777
    4783         _printrec_tiny($datafile, 'y', \%recflags, $revzone,
    4784                 $host, $type, $val, $dist, $weight, $port, $ttl, $loc, $stamp);
    47854778        _printrec_tiny(*ZONECACHE, 'y', \%recflags, $revzone,
    47864779                $host, $type, $val, $dist, $weight, $port, $ttl, $loc, $stamp)
    47874780                if *ZONECACHE;
    4788         # in case the zone shrunk, get rid of garbage at the end of the file.
    4789         truncate(ZONECACHE, tell(ZONECACHE));
     4781
     4782        # in case the zone shrunk, get rid of garbage at the end of the file.
     4783        truncate(ZONECACHE, tell(ZONECACHE));
    47904784
    47914785        $recflags{$recid} = 1;
    47924786      } # while ($recsth)
    4793     } else {
    4794       # zone not changed, stream from cache
    4795       print $datafile $_ while <ZONECACHE>;
    4796     }
     4787    }
     4788    # stream from cache, whether freshly created or existing
     4789    print $datafile $_ while <ZONECACHE>;
    47974790    close ZONECACHE;
    4798     # mark domain as unmodified
     4791    # mark zone as unmodified
    47994792    $zonesth->execute($revid);
    48004793  } # while ($domsth)
Note: See TracChangeset for help on using the changeset viewer.