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
245e6d17
Commit
245e6d17
authored
May 07, 2007
by
jonas@perch.ndb.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge perch.ndb.mysql.com:/home/jonas/src/51-telco-gca
into perch.ndb.mysql.com:/home/jonas/src/mysql-5.1-new-ndb
parents
08c90679
34c0b164
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
50 deletions
+65
-50
storage/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp
storage/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp
+1
-1
storage/ndb/src/kernel/vm/DynArr256.cpp
storage/ndb/src/kernel/vm/DynArr256.cpp
+55
-46
storage/ndb/src/kernel/vm/DynArr256.hpp
storage/ndb/src/kernel/vm/DynArr256.hpp
+9
-3
No files found.
storage/ndb/src/kernel/blocks/ndbfs/MemoryChannel.hpp
View file @
245e6d17
...
...
@@ -75,7 +75,7 @@ template <class T>
class
MemoryChannel
{
public:
MemoryChannel
(
int
size
=
256
);
MemoryChannel
(
int
size
=
512
);
virtual
~
MemoryChannel
(
);
void
writeChannel
(
T
*
t
);
...
...
storage/ndb/src/kernel/vm/DynArr256.cpp
View file @
245e6d17
...
...
@@ -344,18 +344,28 @@ DynArr256::expand(Uint32 pos)
void
DynArr256
::
init
(
ReleaseIterator
&
iter
)
{
iter
.
m_sz
=
0
;
iter
.
m_sz
=
1
;
iter
.
m_pos
=
0
;
iter
.
m_ptr_i
[
0
]
=
m_head
.
m_ptr_i
;
iter
.
m_ptr_i
[
1
]
=
RNIL
;
iter
.
m_ptr_i
[
0
]
=
RNIL
;
iter
.
m_ptr_i
[
1
]
=
m_head
.
m_ptr_i
;
iter
.
m_ptr_i
[
2
]
=
RNIL
;
iter
.
m_ptr_i
[
3
]
=
RNIL
;
iter
.
m_ptr_i
[
4
]
=
RNIL
;
}
bool
DynArr256
::
release
(
ReleaseIterator
&
iter
)
/**
* Iter is in next pos
*
* 0 - done
* 1 - data
* 2 - no data
*/
Uint32
DynArr256
::
release
(
ReleaseIterator
&
iter
,
Uint32
*
retptr
)
{
Uint32
ptrI
=
iter
.
m_ptr_i
[
iter
.
m_sz
];
Uint32
sz
=
iter
.
m_sz
;
Uint32
pos
=
iter
.
m_pos
;
Uint32
ptrI
=
iter
.
m_ptr_i
[
sz
];
Uint32
page_no
=
ptrI
>>
DA256_BITS
;
Uint32
page_idx
=
ptrI
&
DA256_MASK
;
Uint32
type_id
=
(
~
m_pool
.
m_type_id
)
&
0xFFFF
;
...
...
@@ -364,9 +374,8 @@ DynArr256::release(ReleaseIterator &iter)
if
(
ptrI
!=
RNIL
)
{
Uint32
tmp
=
iter
.
m_pos
&
255
;
Uint32
p0
=
tmp
;
for
(;
p0
<
256
&&
p0
<
tmp
+
16
;
p0
++
)
Uint32
p0
=
iter
.
m_pos
&
255
;
for
(;
p0
<
256
;
p0
++
)
{
Uint32
*
retVal
,
*
magic_ptr
,
p
;
if
(
p0
!=
255
)
...
...
@@ -389,55 +398,53 @@ DynArr256::release(ReleaseIterator &iter)
}
Uint32
magic
=
*
magic_ptr
;
Uint32
val
=
*
retVal
;
if
(
unlikely
(
!
((
magic
&
(
1
<<
p
))
&&
(
magic
>>
16
)
==
type_id
)))
goto
err
;
Uint32
val
=
*
retVal
;
if
(
val
!=
RNIL
)
if
(
sz
==
m_head
.
m_sz
)
{
if
(
iter
.
m_sz
+
2
==
m_head
.
m_sz
)
*
retptr
=
val
;
p0
++
;
if
(
p0
!=
256
)
{
*
retVal
=
RNIL
;
m_pool
.
release
(
val
);
iter
.
m_pos
=
(
iter
.
m_pos
&
~
255
)
+
p0
;
return
false
;
/**
* Move next
*/
iter
.
m_pos
&=
~
(
Uint32
)
255
;
iter
.
m_pos
|=
p0
;
}
else
{
*
retVal
=
RNIL
;
iter
.
m_sz
++
;
iter
.
m_ptr_i
[
iter
.
m_sz
]
=
val
;
iter
.
m_pos
=
(
p0
<<
8
);
return
false
;
/**
* Move up
*/
m_pool
.
release
(
ptrI
);
iter
.
m_sz
--
;
iter
.
m_pos
>>=
8
;
}
return
1
;
}
else
if
(
val
!=
RNIL
)
{
iter
.
m_sz
++
;
iter
.
m_ptr_i
[
iter
.
m_sz
]
=
val
;
iter
.
m_pos
=
(
p0
<<
8
);
*
retVal
=
RNIL
;
return
2
;
}
}
if
(
p0
==
256
)
{
if
(
iter
.
m_sz
==
0
)
goto
done
;
iter
.
m_sz
--
;
iter
.
m_pos
>>=
8
;
m_pool
.
release
(
ptrI
);
return
false
;
}
else
{
iter
.
m_pos
=
(
iter
.
m_pos
&
~
255
)
+
p0
;
return
false
;
}
assert
(
p0
==
256
);
m_pool
.
release
(
ptrI
);
iter
.
m_sz
--
;
iter
.
m_pos
>>=
8
;
return
2
;
}
done:
if
(
m_head
.
m_ptr_i
!=
RNIL
)
{
m_pool
.
release
(
m_head
.
m_ptr_i
);
}
new
(
&
m_head
)
Head
();
return
true
;
return
0
;
err:
require
(
false
);
...
...
@@ -638,6 +645,7 @@ static
void
simple
(
DynArr256
&
arr
,
int
argc
,
char
*
argv
[])
{
ndbout_c
(
"argc: %d"
,
argc
);
for
(
Uint32
i
=
1
;
i
<
(
Uint32
)
argc
;
i
++
)
{
Uint32
*
s
=
arr
.
set
(
atoi
(
argv
[
i
]));
...
...
@@ -865,7 +873,8 @@ write(DynArr256& arr, int argc, char ** argv)
ndbout_c
(
"Elapsed %lldus -> %f us/set"
,
start
,
uspg
);
DynArr256
::
ReleaseIterator
iter
;
arr
.
init
(
iter
);
while
(
!
arr
.
release
(
iter
));
Uint32
val
;
while
(
arr
.
release
(
iter
,
&
val
));
}
}
...
...
@@ -902,7 +911,7 @@ main(int argc, char** argv)
DynArr256
::
Head
head
;
DynArr256
arr
(
pool
,
head
);
if
(
strcmp
(
argv
[
1
],
"--
args
"
)
==
0
)
if
(
strcmp
(
argv
[
1
],
"--
simple
"
)
==
0
)
simple
(
arr
,
argc
,
argv
);
else
if
(
strcmp
(
argv
[
1
],
"--basic"
)
==
0
)
basic
(
arr
,
argc
,
argv
);
...
...
@@ -913,8 +922,8 @@ main(int argc, char** argv)
DynArr256
::
ReleaseIterator
iter
;
arr
.
init
(
iter
);
Uint32
cnt
=
0
;
while
(
!
arr
.
release
(
iter
))
cnt
++
;
Uint32
cnt
=
0
,
val
;
while
(
arr
.
release
(
iter
,
&
val
))
cnt
++
;
ndbout_c
(
"allocatedpages: %d allocatednodes: %d releasednodes: %d"
" releasecnt: %d"
,
...
...
storage/ndb/src/kernel/vm/DynArr256.hpp
View file @
245e6d17
...
...
@@ -49,6 +49,8 @@ public:
Uint32
m_ptr_i
;
Uint32
m_sz
;
bool
isEmpty
()
const
{
return
m_sz
==
0
;}
};
DynArr256
(
DynArr256Pool
&
pool
,
Head
&
head
)
:
...
...
@@ -61,12 +63,16 @@ public:
{
Uint32
m_sz
;
Uint32
m_pos
;
Uint32
m_ptr_i
[
4
];
Uint32
m_ptr_i
[
5
];
};
void
init
(
ReleaseIterator
&
);
bool
release
(
ReleaseIterator
&
);
/**
* return 0 - done
* 1 - data (in retptr)
* 2 - nodata
*/
Uint32
release
(
ReleaseIterator
&
,
Uint32
*
retptr
);
protected:
Head
&
m_head
;
DynArr256Pool
&
m_pool
;
...
...
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