Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
b19b2dff
Commit
b19b2dff
authored
Jul 11, 2016
by
antirez
Browse files
LRU: Fix output fixes to new test-lru.rb.
parent
6a1c00c9
Changes
1
Show whitespace changes
Inline
Side-by-side
utils/lru/test-lru.rb
View file @
b19b2dff
...
@@ -7,7 +7,7 @@ def testit(filename)
...
@@ -7,7 +7,7 @@ def testit(filename)
r
=
Redis
.
new
r
=
Redis
.
new
r
.
config
(
"SET"
,
"maxmemory"
,
"2000000"
)
r
.
config
(
"SET"
,
"maxmemory"
,
"2000000"
)
r
.
config
(
"SET"
,
"maxmemory-policy"
,
"allkeys-lru"
)
r
.
config
(
"SET"
,
"maxmemory-policy"
,
"allkeys-lru"
)
r
.
config
(
"SET"
,
"maxmemory-samples"
,
10
)
r
.
config
(
"SET"
,
"maxmemory-samples"
,
5
)
r
.
config
(
"RESETSTAT"
)
r
.
config
(
"RESETSTAT"
)
r
.
flushall
r
.
flushall
...
@@ -55,7 +55,7 @@ EOF
...
@@ -55,7 +55,7 @@ EOF
inserted
=
r
.
dbsize
inserted
=
r
.
dbsize
first_set_max_id
=
id
first_set_max_id
=
id
html
<<
"
#{
r
.
dbsize
}
keys inserted"
html
<<
"
#{
r
.
dbsize
}
keys inserted
.
\n
"
# Access keys sequentially, so that in theory the first part will be expired
# Access keys sequentially, so that in theory the first part will be expired
# and the latter part will not, according to perfect LRU.
# and the latter part will not, according to perfect LRU.
...
@@ -74,7 +74,7 @@ EOF
...
@@ -74,7 +74,7 @@ EOF
# Note that we insert the first 100 keys of the new set into DB1 instead
# Note that we insert the first 100 keys of the new set into DB1 instead
# of DB0, so that we can try how cross-DB eviction works.
# of DB0, so that we can try how cross-DB eviction works.
half
=
inserted
/
2
half
=
inserted
/
2
html
<<
"Insert enough keys to evict half the keys we inserted"
html
<<
"Insert enough keys to evict half the keys we inserted
.
\n
"
add
=
0
add
=
0
otherdb_start_idx
=
id
+
1
otherdb_start_idx
=
id
+
1
...
@@ -92,8 +92,8 @@ EOF
...
@@ -92,8 +92,8 @@ EOF
break
if
r
.
info
[
'evicted_keys'
].
to_i
>=
half
break
if
r
.
info
[
'evicted_keys'
].
to_i
>=
half
end
end
html
<<
"
#{
add
}
additional keys added."
html
<<
"
#{
add
}
additional keys added.
\n
"
html
<<
"
#{
r
.
dbsize
}
keys in DB"
html
<<
"
#{
r
.
dbsize
}
keys in DB
.
\n
"
# Check if evicted keys respect LRU
# Check if evicted keys respect LRU
# We consider errors from 1 to N progressively more serious as they violate
# We consider errors from 1 to N progressively more serious as they violate
...
@@ -126,7 +126,7 @@ EOF
...
@@ -126,7 +126,7 @@ EOF
STDERR
.
puts
"Test finished with
#{
errors
}
% error! Generating HTML on stdout."
STDERR
.
puts
"Test finished with
#{
errors
}
% error! Generating HTML on stdout."
html
<<
"
#{
errors
}
% error!"
html
<<
"
#{
errors
}
% error!
\n
"
html
<<
"</pre>"
html
<<
"</pre>"
$runs
<<
errors
$runs
<<
errors
...
...
Write
Preview
Markdown
is supported
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