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
ae1a0c99
Commit
ae1a0c99
authored
Mar 18, 2019
by
Claes Sjofors
Committed by
Claes Sjöfors
Mar 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sev_server reconnect if database connection is lost and dynamic mount fix
parent
db0a4710
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
36 additions
and
10 deletions
+36
-10
sev/exe/sev_import/src/sev_import.cpp
sev/exe/sev_import/src/sev_import.cpp
+1
-0
sev/exe/sev_server/src/sev_server.cpp
sev/exe/sev_server/src/sev_server.cpp
+20
-3
sev/exe/sev_server/src/sev_server.h
sev/exe/sev_server/src/sev_server.h
+1
-0
sev/lib/sev/src/sev_dbms.cpp
sev/lib/sev/src/sev_dbms.cpp
+8
-3
src/lib/rt/src/rt_gdh.c
src/lib/rt/src/rt_gdh.c
+1
-1
src/lib/rt/src/rt_vol.c
src/lib/rt/src/rt_vol.c
+4
-3
src/msg/rt/src/rt_sev_msg.msg
src/msg/rt/src/rt_sev_msg.msg
+1
-0
No files found.
sev/exe/sev_import/src/sev_import.cpp
View file @
ae1a0c99
...
...
@@ -354,6 +354,7 @@ int sev_import::check_exportitems(sev_sMsgExportItems* msg, unsigned int size)
m_sts
=
tree_update
();
if
(
EVEN
(
m_sts
))
printf
(
"Tree error %d
\n
"
,
m_sts
);
m_sts
=
gdh_MountDynClients
();
return
1
;
}
...
...
sev/exe/sev_server/src/sev_server.cpp
View file @
ae1a0c99
...
...
@@ -856,6 +856,7 @@ int sev_server::check_histitems(sev_sMsgHistItems* msg, unsigned int size)
m_sts
=
m_db
->
tree_update
();
if
(
EVEN
(
m_sts
))
printf
(
"Tree error %d
\n
"
,
m_sts
);
m_sts
=
gdh_MountDynClients
();
}
return
1
;
...
...
@@ -1483,7 +1484,17 @@ void* sev_server::receive_histdata_thread(void* arg)
dp
=
(
sev_sHistData
*
)
&
msg
->
data
;
sev
->
m_db
->
begin_transaction
(
th
->
db_ctx
);
sts
=
sev
->
m_db
->
begin_transaction
(
th
->
db_ctx
);
if
(
sts
==
SEV__NOCONNECTION
)
{
if
(
th
->
reconnect_cnt
<
50
)
{
errh_Error
(
"Database connection lost, thread %d, reconnecting"
,
th
->
key
);
th
->
db_ctx
=
sev
->
m_db
->
new_thread
();
th
->
reconnect_cnt
++
;
sts
=
sev
->
m_db
->
begin_transaction
(
th
->
db_ctx
);
}
if
(
EVEN
(
sts
))
break
;
}
while
((
char
*
)
dp
-
(
char
*
)
msg
->
data
<
data_size
)
{
sev_sRefid
*
rp
;
...
...
@@ -1513,8 +1524,14 @@ void* sev_server::receive_histdata_thread(void* arg)
+
dp
->
size
);
}
sev
->
m_db
->
commit_transaction
(
th
->
db_ctx
);
sts
=
sev
->
m_db
->
commit_transaction
(
th
->
db_ctx
);
if
(
sts
==
SEV__NOCONNECTION
)
{
if
(
th
->
reconnect_cnt
<
50
)
{
errh_Error
(
"Database connection lost, thread %d, reconnecting"
,
th
->
key
);
th
->
db_ctx
=
sev
->
m_db
->
new_thread
();
th
->
reconnect_cnt
++
;
}
}
break
;
}
case
sev_eQMsgType_Event
:
{
...
...
sev/exe/sev_server/src/sev_server.h
View file @
ae1a0c99
...
...
@@ -72,6 +72,7 @@ typedef struct {
int
alloc
;
void
*
db_ctx
;
int
conf_idx
;
unsigned
int
reconnect_cnt
;
}
sev_sThread
;
typedef
struct
{
...
...
sev/lib/sev/src/sev_dbms.cpp
View file @
ae1a0c99
...
...
@@ -43,6 +43,7 @@
#include <sys/stat.h>
#include <mysql/mysqld_error.h>
#include <mysql/errmsg.h>
#include "pwr_names.h"
...
...
@@ -4863,7 +4864,9 @@ int sev_dbms::begin_transaction(void* thread)
if
(
rc
)
{
printf
(
"In %s row %d:
\n
"
,
__FILE__
,
__LINE__
);
printf
(
"Begin transaction: %s
\n
"
,
mysql_error
(
con
));
return
0
;
if
(
con
->
net
.
last_errno
==
CR_SERVER_GONE_ERROR
)
return
SEV__NOCONNECTION
;
return
SEV__DBERROR
;
}
return
1
;
}
...
...
@@ -4883,8 +4886,10 @@ int sev_dbms::commit_transaction(void* thread)
rc
=
mysql_query
(
con
,
query
);
if
(
rc
)
{
printf
(
"In %s row %d:
\n
"
,
__FILE__
,
__LINE__
);
printf
(
"Begin transaction: %s
\n
"
,
mysql_error
(
con
));
return
0
;
printf
(
"Commit transaction: %s
\n
"
,
mysql_error
(
con
));
if
(
con
->
net
.
last_errno
==
CR_SERVER_GONE_ERROR
)
return
SEV__NOCONNECTION
;
return
SEV__DBERROR
;
}
return
1
;
}
...
...
src/lib/rt/src/rt_gdh.c
View file @
ae1a0c99
...
...
@@ -5302,7 +5302,7 @@ pwr_tStatus gdh_MountDynClients(void)
gdh_ScopeLock
{
op
=
vol_OidToObject
(
&
sts
,
oid
,
gdb_mLo_native
,
vol_mTrans_
all
,
op
=
vol_OidToObject
(
&
sts
,
oid
,
gdb_mLo_native
,
vol_mTrans_
none
,
cvol_eHint_none
);
if
(
cdh_ObjidIsNull
(
op
->
g
.
soid
))
vol_MountDynObject
(
&
sts
,
op
);
...
...
src/lib/rt/src/rt_vol.c
View file @
ae1a0c99
...
...
@@ -535,7 +535,8 @@ mvol_sAttribute* vol_BlockNameToAttribute(pwr_tStatus* sts, mvol_sAttribute* ap,
strcpy
(
aname
,
""
);
for
(
i
=
0
;
i
<
pn
->
nObject
;
i
++
)
{
strcat
(
aname
,
pn
->
object
[
i
].
name
.
orig
);
strcat
(
aname
,
"-"
);
if
(
pn
->
nAttribute
!=
0
)
strcat
(
aname
,
"-"
);
}
for
(
i
=
0
;
i
<
pn
->
nAttribute
;
i
++
)
{
strcat
(
aname
,
pn
->
attribute
[
i
].
name
.
orig
);
...
...
@@ -543,7 +544,7 @@ mvol_sAttribute* vol_BlockNameToAttribute(pwr_tStatus* sts, mvol_sAttribute* ap,
strcat
(
aname
,
"-"
);
}
strcat
(
aname
,
".Value"
);
if
(
pn
->
hasIndex
[
pn
->
nAttribute
-
1
])
if
(
pn
->
nAttribute
!=
0
&&
pn
->
hasIndex
[
pn
->
nAttribute
-
1
])
sprintf
(
&
aname
[
strlen
(
aname
)],
"[%d]"
,
pn
->
index
[
pn
->
nAttribute
-
1
]);
cdh_ParseName
(
sts
,
pn
,
pn
->
poid
,
aname
,
pn
->
parseFlags
.
m
);
...
...
@@ -579,7 +580,7 @@ mvol_sAttribute* vol_NameToAttribute(pwr_tStatus* sts, mvol_sAttribute* ap,
if
(
op
==
NULL
)
return
NULL
;
if
(
op
->
g
.
cid
==
pwr_eClass_Block
)
{
if
(
op
->
g
.
cid
==
pwr_eClass_Block
&&
pn
->
nAttribute
!=
0
)
{
return
vol_BlockNameToAttribute
(
sts
,
ap
,
pn
,
op
,
lo_flags
,
trans
);
}
...
...
src/msg/rt/src/rt_sev_msg.msg
View file @
ae1a0c99
...
...
@@ -56,6 +56,7 @@ unknowntype <Unknown data type> /error
nosuchtable <Table doesn't exist> /error
norows <No rows found> /error
nowrite <Nothings written> /info
noconnection <Connection has gone> /error
.end
...
...
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