Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
d8b85095
Commit
d8b85095
authored
Feb 05, 2019
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(PGSQL): fix SIGSEGV in flushInsertBuffer()
parent
217d9a34
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
11 deletions
+11
-11
DBServer_PostgreSQL.cc
extensions/DBServer-PostgreSQL/DBServer_PostgreSQL.cc
+9
-9
start_fg.sh
extensions/DBServer-PostgreSQL/start_fg.sh
+1
-1
MBSlave.cc
extensions/ModbusSlave/MBSlave.cc
+1
-1
No files found.
extensions/DBServer-PostgreSQL/DBServer_PostgreSQL.cc
View file @
d8b85095
...
...
@@ -212,12 +212,9 @@ void DBServer_PostgreSQL::flushBuffer()
//--------------------------------------------------------------------------------------------
void
DBServer_PostgreSQL
::
flushInsertBuffer
()
{
if
(
!
db
||
!
connect_ok
)
if
(
ibufSize
>
ibufMaxSize
)
{
if
(
ibufSize
<
ibufMaxSize
)
return
;
dbcrit
<<
myname
<<
"(flushWriteBuffer): DB not connected!"
dbcrit
<<
myname
<<
"(flushWriteBuffer): "
<<
" buffer["
<<
ibufSize
<<
"] overflow! LOST DATA..."
<<
endl
;
// Чистим заданное число
...
...
@@ -228,26 +225,29 @@ void DBServer_PostgreSQL::flushInsertBuffer()
// Удаляем последние (новые)
if
(
lastRemove
)
{
std
::
advance
(
beg
,
-
delnum
);
end
=
std
::
prev
(
end
,
delnum
);
}
else
{
// Удаляем первые (старые)
std
::
advance
(
end
,
delnum
);
beg
=
std
::
next
(
beg
,
delnum
);
}
ibuf
.
erase
(
beg
,
end
);
if
(
beg
!=
ibuf
.
end
()
)
ibuf
.
erase
(
beg
,
end
);
// ibufSize - беззнаковое, так что надо аккуратно
ibufSize
=
(
delnum
<
ibufSize
)
?
(
ibufSize
-
delnum
)
:
0
;
dbwarn
<<
myname
<<
"(flushInsertBuffer): overflow: clear data "
<<
delnum
<<
" records."
<<
endl
;
return
;
}
if
(
ibufSize
==
0
)
return
;
if
(
!
db
||
!
connect_ok
)
return
;
dbinfo
<<
myname
<<
"(flushInsertBuffer): write insert buffer["
<<
ibufSize
<<
"] to DB.."
<<
endl
;
if
(
!
writeInsertBufferToDB
(
"main_history"
,
tblcols
,
ibuf
)
)
...
...
extensions/DBServer-PostgreSQL/start_fg.sh
View file @
d8b85095
...
...
@@ -3,5 +3,5 @@
ulimit
-Sc
1000000
uniset2-start.sh
-f
./uniset2-pgsql-dbserver
--confile
test.xml
--name
DBServer1
\
--pgsql-
dbserver-
buffer-size
100
\
--pgsql-buffer-size
100
\
--pgsql-log-add-levels
any
$*
extensions/ModbusSlave/MBSlave.cc
View file @
d8b85095
...
...
@@ -1815,7 +1815,7 @@ namespace uniset
i
++
;
}
std
::
advance
(
it
,
sub
);
std
::
next
(
it
,
sub
);
regID
+=
sub
;
}
else
...
...
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