Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
e7d69dff
Commit
e7d69dff
authored
Mar 15, 2006
by
Leigh B. Stoller
Browse files
Keep last 24 hours of data on ops, as a sliding window, pushed every
hour from crontab.
parent
e8efc047
Changes
1
Show whitespace changes
Inline
Side-by-side
pelab/db/pelab_dbpush.in
View file @
e7d69dff
...
@@ -148,6 +148,12 @@ if (!defined($lastidx)) {
...
@@ -148,6 +148,12 @@ if (!defined($lastidx)) {
unlink
("
${tempfile}
.pair_data
")
unlink
("
${tempfile}
.pair_data
")
if
(
-
e
"
${tempfile}
.pair_data
");
if
(
-
e
"
${tempfile}
.pair_data
");
#
# Compute the cutoff age; We leave MAXAGE old entries here, and ship
# the rest over to the DP.
#
my
$cutoffage
=
(
time
()
-
$MAXAGE
)
*
1.0
;
#
#
# Must lock the table of course
# Must lock the table of course
#
#
...
@@ -157,7 +163,7 @@ DBQueryFatal("lock tables pair_data write");
...
@@ -157,7 +163,7 @@ DBQueryFatal("lock tables pair_data write");
# Grab all of the new entries and store to the file
# Grab all of the new entries and store to the file
#
#
DBQueryFatal
("
select * from pair_data
"
.
DBQueryFatal
("
select * from pair_data
"
.
"
where idx >
$lastidx
"
.
"
where idx >
$lastidx
and unixstamp <
$cutoffage
"
.
"
into outfile '
${tempfile}
.pair_data'
"
.
"
into outfile '
${tempfile}
.pair_data'
"
.
"
fields terminated by ' '
");
"
fields terminated by ' '
");
...
@@ -166,7 +172,7 @@ DBQueryFatal("select * from pair_data ".
...
@@ -166,7 +172,7 @@ DBQueryFatal("select * from pair_data ".
#
#
$query_result
=
$query_result
=
DBQueryFatal
("
select idx from pair_data
"
.
DBQueryFatal
("
select idx from pair_data
"
.
"
where idx >
$lastidx
"
.
"
where idx >
$lastidx
and unixstamp <
$cutoffage
"
.
"
order by idx desc limit 1
");
"
order by idx desc limit 1
");
# Save for later.
# Save for later.
$lastidx
=
$query_result
->
fetchrow_array
();
$lastidx
=
$query_result
->
fetchrow_array
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment