Commit 9bb0ec11 authored by Mike Hibler's avatar Mike Hibler

Change "insert" into "replace" for select statement.

Don't know why we did not hit this before. Maybe the node_usage DB
got into an odd state recently where there were some extra records?
Who knows. I compared the .dat files produced from old and new and
all the historic records that this script produces are the same.
parent d01008d4
#!/usr/bin/perl
#
# Copyright (c) 2009-2015 University of Utah and the Flux Group.
# Copyright (c) 2009-2018 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -122,7 +122,7 @@ if ($prep) {
local %maybe_free;
if (!$fresh) {
do "gather.state.1";
do "./gather.state.1";
}
$qr = DBQueryFatal("select history_id,node_id,op,stamp,exptidx from $NODE_USAGE_DB.node_history_copy where history_id > $last_history_id order by history_id limit $LIMIT");
......@@ -213,7 +213,7 @@ if ($prep) {
#print STDERR "WARNING: $node_id: $history_id ($stamp) $last_trans{$node_id}: $invalid\n";
DBQueryFatal("update $NODE_USAGE_DB.node_trans set op = 'invalid' where history_id=$last_trans{$node_id}");
} elsif (!defined $prev_state || $prev_state ne $node_state{$node_id}) {
DBQueryFatal("insert into $NODE_USAGE_DB.node_trans values ($history_id, $stamp, '$node_id', '$node_state{$node_id}')");
DBQueryFatal("replace into $NODE_USAGE_DB.node_trans values ($history_id, $stamp, '$node_id', '$node_state{$node_id}')");
$last_trans{$node_id} = $history_id;
$last_expidx{$node_id} = $exptidx;
}
......@@ -236,7 +236,7 @@ if ($results) {
if ($fresh) {
unlink "node_usage.raw";
} else {
do "gather.state.2";
do "./gather.state.2";
}
open F, ">>node_usage.raw";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment