PIBinaryLog recreate index performance patch
This commit is contained in:
@@ -312,7 +312,7 @@ PIP_EXPORT PIByteArray & operator >>(PIByteArray & s, PIByteArray & v);
|
||||
//! \relatesalso PIByteArray \brief Restore operator, see \ref PIByteArray_sec1 for details
|
||||
inline PIByteArray & operator >>(PIByteArray & s, PIByteArray::RawData v) {
|
||||
if (s.size_s() < v.s) {
|
||||
printf("error with RawData %d < %d\n", s.size_s(), v.s);
|
||||
printf("error with RawData %d < %d\n", (int)s.size_s(), v.s);
|
||||
assert(s.size_s() >= v.s);
|
||||
}
|
||||
if (v.s > 0) {
|
||||
|
||||
@@ -153,6 +153,7 @@ bool PIBinaryLog::openDevice() {
|
||||
bool PIBinaryLog::closeDevice() {
|
||||
stopThreadedRead();
|
||||
pausemutex.unlock();
|
||||
logmutex.unlock();
|
||||
moveIndex(-1);
|
||||
is_indexed = false;
|
||||
index.clear();
|
||||
@@ -654,7 +655,9 @@ bool PIBinaryLog::createIndex() {
|
||||
llong cp = file.pos();
|
||||
file.seekToBegin();
|
||||
index.clear();
|
||||
index = PIVector<BinLogIndex>();
|
||||
index_pos.clear();
|
||||
index_pos = PIMap<llong, int>();
|
||||
parseLog(&file, &binfo, &index);
|
||||
file.seek(cp);
|
||||
is_indexed = !index.isEmpty();
|
||||
|
||||
Reference in New Issue
Block a user