Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
7e4641bc
Commit
7e4641bc
authored
Nov 18, 2005
by
pekka@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb - wl#1497 LinearPool seize_index
parent
50afa94d
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
300 additions
and
79 deletions
+300
-79
storage/ndb/src/kernel/vm/LinearPool.hpp
storage/ndb/src/kernel/vm/LinearPool.hpp
+251
-75
storage/ndb/src/kernel/vm/testSuperPool.cpp
storage/ndb/src/kernel/vm/testSuperPool.cpp
+49
-4
No files found.
storage/ndb/src/kernel/vm/LinearPool.hpp
View file @
7e4641bc
This diff is collapsed.
Click to expand it.
storage/ndb/src/kernel/vm/testSuperPool.cpp
View file @
7e4641bc
#if 0
make -f Makefile -f - testSuperPool <<'_eof_'
testSuperPool: testSuperPool.cpp libkernel.a
testSuperPool: testSuperPool.cpp libkernel.a
LinearPool.hpp
$(CXXCOMPILE) -o $@ $@.cpp libkernel.a -L../../common/util/.libs -lgeneral
_eof_
exit $?
...
...
@@ -57,6 +57,7 @@ random_coprime(Uint32 n)
{
Uint32
prime
[]
=
{
101
,
211
,
307
,
401
,
503
,
601
,
701
,
809
,
907
};
Uint32
count
=
sizeof
(
prime
)
/
sizeof
(
prime
[
0
]);
assert
(
n
!=
0
);
while
(
1
)
{
Uint32
i
=
urandom
(
count
);
if
(
n
%
prime
[
i
]
!=
0
)
...
...
@@ -208,7 +209,7 @@ lp_test(GroupPool& gp)
ndbout
<<
"linear pool test"
<<
endl
;
Ptr
<
T
>
ptr
;
Uint32
loop
;
for
(
loop
=
0
;
loop
<
3
*
loopcount
;
loop
++
)
{
for
(
loop
=
0
;
loop
<
loopcount
;
loop
++
)
{
int
count
=
0
;
while
(
1
)
{
bool
ret
=
lp
.
seize
(
ptr
);
...
...
@@ -223,6 +224,7 @@ lp_test(GroupPool& gp)
assert
(
ptr
.
p
==
ptr2
.
p
);
count
++
;
}
assert
(
count
!=
0
);
ndbout
<<
"seized "
<<
count
<<
endl
;
switch
(
loop
%
3
)
{
case
0
:
...
...
@@ -264,6 +266,47 @@ lp_test(GroupPool& gp)
}
break
;
}
{
Uint32
cnt
=
lp
.
count
();
assert
(
cnt
==
0
);
}
// seize_index test
char
*
used
=
new
char
[
10
*
count
];
memset
(
used
,
false
,
sizeof
(
used
));
Uint32
i
,
ns
=
0
,
nr
=
0
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
Uint32
index
=
urandom
(
10
*
count
);
if
(
used
[
index
])
{
ptr
.
i
=
index
;
lp
.
release
(
ptr
);
lp
.
verify
();
nr
++
;
}
else
{
int
i
=
lp
.
seize_index
(
ptr
,
index
);
assert
(
i
>=
0
);
lp
.
verify
();
if
(
i
==
0
)
// no space
continue
;
assert
(
ptr
.
i
==
index
);
Ptr
<
T
>
ptr2
;
ptr2
.
i
=
ptr
.
i
;
ptr2
.
p
=
0
;
lp
.
getPtr
(
ptr2
);
assert
(
ptr
.
p
==
ptr2
.
p
);
ns
++
;
}
used
[
index
]
=
!
used
[
index
];
}
ndbout
<<
"random sparse seize "
<<
ns
<<
" release "
<<
nr
<<
endl
;
nr
=
0
;
for
(
i
=
0
;
i
<
10
*
count
;
i
++
)
{
if
(
used
[
i
])
{
ptr
.
i
=
i
;
lp
.
release
(
ptr
);
lp
.
verify
();
used
[
i
]
=
false
;
nr
++
;
}
}
ndbout
<<
"released "
<<
nr
<<
endl
;
{
Uint32
cnt
=
lp
.
count
();
assert
(
cnt
==
0
);
}
}
}
...
...
@@ -291,8 +334,10 @@ template static void sp_test<T5>(GroupPool& sp);
template
static
void
lp_test
<
T3
>(
GroupPool
&
sp
);
int
main
()
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
>
1
&&
strncmp
(
argv
[
1
],
"-l"
,
2
)
==
0
)
loopcount
=
atoi
(
argv
[
1
]
+
2
);
HeapPool
sp
(
pageSize
,
pageBits
);
sp
.
setInitPages
(
7
);
sp
.
setMaxPages
(
7
);
...
...
@@ -304,7 +349,7 @@ main()
ndbout
<<
"rand "
<<
s
<<
endl
;
int
count
;
count
=
0
;
while
(
++
count
<=
0
)
{
while
(
++
count
<=
0
)
{
// change to 1 to find new bug
sp_test
<
T1
>
(
gp
);
sp_test
<
T2
>
(
gp
);
sp_test
<
T3
>
(
gp
);
...
...
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