Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
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
Esteban Blanc
proview
Commits
4f7e57f2
Commit
4f7e57f2
authored
Feb 16, 2018
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sev garbage thread fix
parent
476e8fdb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
14 deletions
+28
-14
sev/lib/sev/src/sev_dbms.cpp
sev/lib/sev/src/sev_dbms.cpp
+26
-12
sev/lib/sev/src/sev_dbms.h
sev/lib/sev/src/sev_dbms.h
+2
-2
No files found.
sev/lib/sev/src/sev_dbms.cpp
View file @
4f7e57f2
...
...
@@ -2680,7 +2680,7 @@ int sev_dbms::delete_old_data( pwr_tStatus *sts, void *thread, char *tablename,
if
(
scantime
>
0.0
)
nbRowsToClean
=
(
pwr_tUInt64
)((
garbagecycle
/
scantime
)
+
10000.0
);
nbRowsToClean
+=
get_minFromIntegerColumn
(
tablename
,
(
char
*
)
"id"
);
nbRowsToClean
+=
get_minFromIntegerColumn
(
thread
,
tablename
,
(
char
*
)
"id"
);
if
(
options
&
pwr_mSevOptionsMask_PosixTime
)
sprintf
(
query
,
"delete from %s where id < "
pwr_dFormatUInt64
" and time < %ld;"
,
tablename
,
nbRowsToClean
,
(
long
int
)
limit
.
tv_sec
);
...
...
@@ -3029,20 +3029,27 @@ int sev_dbms::check_objectitemattr( pwr_tStatus *sts, char *tablename, pwr_tOid
return
0
;
}
pwr_tUInt64
sev_dbms
::
get_minFromIntegerColumn
(
char
*
tablename
,
char
*
colname
)
pwr_tUInt64
sev_dbms
::
get_minFromIntegerColumn
(
void
*
thread
,
char
*
tablename
,
char
*
colname
)
{
char
query
[
2000
];
char
query
[
2000
];
pwr_tUInt64
retVal
=
0
;
MYSQL
*
con
;
if
(
thread
)
con
=
(
MYSQL
*
)
thread
;
else
con
=
m_env
->
con
();
sprintf
(
query
,
"select min(`%s`) from %s"
,
colname
,
tablename
);
//printf( "%s: %s\n", __FUNCTION__ ,query);
int
rc
=
mysql_query
(
m_env
->
con
()
,
query
);
int
rc
=
mysql_query
(
con
,
query
);
if
(
rc
)
{
printf
(
"In %s row %d:
\n
"
,
__FILE__
,
__LINE__
);
printf
(
"%s: %s
\n
"
,
__FUNCTION__
,
mysql_error
(
m_env
->
con
()));
return
0
;
}
MYSQL_RES
*
result
=
mysql_store_result
(
m_env
->
con
()
);
MYSQL_RES
*
result
=
mysql_store_result
(
con
);
if
(
!
result
)
{
printf
(
"In %s row %d:
\n
"
,
__FILE__
,
__LINE__
);
printf
(
"%s Result Error
\n
"
,
__FUNCTION__
);
...
...
@@ -3063,20 +3070,27 @@ pwr_tUInt64 sev_dbms::get_minFromIntegerColumn( char *tablename, char *colname )
return
retVal
;
}
pwr_tUInt64
sev_dbms
::
get_maxFromIntegerColumn
(
char
*
tablename
,
char
*
colname
)
pwr_tUInt64
sev_dbms
::
get_maxFromIntegerColumn
(
void
*
thread
,
char
*
tablename
,
char
*
colname
)
{
char
query
[
2000
];
char
query
[
2000
];
pwr_tUInt64
retVal
=
0
;
MYSQL
*
con
;
if
(
thread
)
con
=
(
MYSQL
*
)
thread
;
else
con
=
m_env
->
con
();
sprintf
(
query
,
"select max(`%s`) from %s"
,
colname
,
tablename
);
//printf( "%s: %s\n", __FUNCTION__ ,query);
int
rc
=
mysql_query
(
m_env
->
con
()
,
query
);
int
rc
=
mysql_query
(
con
,
query
);
if
(
rc
)
{
printf
(
"In %s row %d:
\n
"
,
__FILE__
,
__LINE__
);
printf
(
"%s: %s
\n
"
,
__FUNCTION__
,
mysql_error
(
m_env
->
con
()));
return
0
;
}
MYSQL_RES
*
result
=
mysql_store_result
(
m_env
->
con
()
);
MYSQL_RES
*
result
=
mysql_store_result
(
con
);
if
(
!
result
)
{
printf
(
"In %s row %d:
\n
"
,
__FILE__
,
__LINE__
);
printf
(
"%s Result Error
\n
"
,
__FUNCTION__
);
...
...
@@ -3611,7 +3625,7 @@ int sev_dbms::delete_old_objectdata( pwr_tStatus *sts, void *thread, char *table
if
(
scantime
>
0.0
)
nbRowsToClean
=
(
pwr_tUInt64
)((
garbagecycle
/
scantime
)
+
10000.0
);
nbRowsToClean
+=
get_minFromIntegerColumn
(
tablename
,
(
char
*
)
"sev__id"
);
nbRowsToClean
+=
get_minFromIntegerColumn
(
thread
,
tablename
,
(
char
*
)
"sev__id"
);
if
(
options
&
pwr_mSevOptionsMask_PosixTime
)
sprintf
(
query
,
"delete from %s where sev__id < "
pwr_dFormatUInt64
" and sev__time < %ld;"
,
tablename
,
nbRowsToClean
,
(
long
int
)
limit
.
tv_sec
);
...
...
@@ -4262,7 +4276,7 @@ int sev_dbms::handle_itemchange(pwr_tStatus *sts, char *tablename, unsigned int
if
(
item
->
options
&
pwr_mSevOptionsMask_ReadOptimized
)
{
//If we set increment to same value as in the old table we can easily move the data from the old table to the new one
pwr_tUInt64
autoIncrValue
=
get_maxFromIntegerColumn
(
newTableName
,
(
char
*
)
"id"
);
pwr_tUInt64
autoIncrValue
=
get_maxFromIntegerColumn
(
0
,
newTableName
,
(
char
*
)
"id"
);
if
(
autoIncrValue
)
autoIncrValue
++
;
sprintf
(
query
,
"ALTER TABLE %s AUTO_INCREMENT = "
pwr_dFormatUInt64
,
tablename
,
autoIncrValue
);
...
...
@@ -4327,7 +4341,7 @@ int sev_dbms::handle_objectchange(pwr_tStatus *sts, char *tablename, unsigned in
if
(
item
->
options
&
pwr_mSevOptionsMask_ReadOptimized
)
{
//If we set increment to same value as in the old table we can easily move the data from the old table to the new one
pwr_tUInt64
autoIncrValue
=
get_maxFromIntegerColumn
(
newTableName
,
(
char
*
)
"sev__id"
);
pwr_tUInt64
autoIncrValue
=
get_maxFromIntegerColumn
(
0
,
newTableName
,
(
char
*
)
"sev__id"
);
if
(
autoIncrValue
)
autoIncrValue
++
;
sprintf
(
query
,
"ALTER TABLE %s AUTO_INCREMENT = "
pwr_dFormatUInt64
,
tablename
,
autoIncrValue
);
...
...
sev/lib/sev/src/sev_dbms.h
View file @
4f7e57f2
...
...
@@ -199,8 +199,8 @@ class sev_dbms : public sev_db {
int
delete_event_table
(
pwr_tStatus
*
sts
,
char
*
tablename
);
int
create_event_table
(
pwr_tStatus
*
sts
,
char
*
tablename
,
pwr_tMask
options
);
int
store_event
(
pwr_tStatus
*
sts
,
void
*
thread
,
int
item_idx
,
sev_event
*
ep
);
pwr_tUInt64
get_minFromIntegerColumn
(
char
*
tablename
,
char
*
colname
);
pwr_tUInt64
get_maxFromIntegerColumn
(
char
*
tablename
,
char
*
colname
);
pwr_tUInt64
get_minFromIntegerColumn
(
void
*
thread
,
char
*
tablename
,
char
*
colname
);
pwr_tUInt64
get_maxFromIntegerColumn
(
void
*
thread
,
char
*
tablename
,
char
*
colname
);
pwr_tUInt64
get_nextAutoIncrement
(
char
*
tablename
);
int
handle_itemchange
(
pwr_tStatus
*
sts
,
char
*
tablename
,
unsigned
int
item_idx
);
int
handle_objectchange
(
pwr_tStatus
*
sts
,
char
*
tablename
,
unsigned
int
item_idx
,
bool
newObject
);
...
...
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