diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-09-03 13:45:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-03 13:45:29 +0200 |
commit | dea4b4b9ce2aaaadfdca6b8f933967f4b359da25 (patch) | |
tree | dcdae691c78d61ce2f55604a081a6fac39736544 | |
parent | 7083a68e36008b193727f1cede4c8c5f1419d386 (diff) | |
parent | acbc0321e2adba820291062c918df32454409b4f (diff) |
Merge pull request #14268 from vespa-engine/revert-14266-revert-14256-balder/remove-close
Revert "Revert "- Remove unused close() method.""
-rw-r--r-- | searchlib/src/vespa/searchlib/transactionlog/common.h | 1 | ||||
-rw-r--r-- | searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp | 55 |
2 files changed, 16 insertions, 40 deletions
diff --git a/searchlib/src/vespa/searchlib/transactionlog/common.h b/searchlib/src/vespa/searchlib/transactionlog/common.h index db8b9727daa..f3276027078 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/common.h +++ b/searchlib/src/vespa/searchlib/transactionlog/common.h @@ -72,7 +72,6 @@ public: Packet(size_t m=0xf000) : _count(0), _range(), _limit(m), _buf(m) { } Packet(const void * buf, size_t sz); bool add(const Entry & data); - void close() { } void clear() { _buf.clear(); _count = 0; _range.from(0); _range.to(0); } const SerialNumRange & range() const { return _range; } const vespalib::nbostream & getHandle() const { return _buf; } diff --git a/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp b/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp index c44c27d7dec..3829a978ec4 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp +++ b/searchlib/src/vespa/searchlib/transactionlog/domainpart.cpp @@ -27,30 +27,19 @@ namespace search::transactionlog { namespace { -void -handleSync(FastOS_FileInterface &file) __attribute__ ((noinline)); +constexpr size_t TARGET_PACKET_SIZE = 0x3f000; string -handleWriteError(const char *text, - FastOS_FileInterface &file, - int64_t lastKnownGoodPos, - const Packet::Entry &entry, - int bufLen) __attribute__ ((noinline)); +handleWriteError(const char *text, FastOS_FileInterface &file, int64_t lastKnownGoodPos, + SerialNumRange range, int bufLen) __attribute__ ((noinline)); bool -handleReadError(const char *text, - FastOS_FileInterface &file, - ssize_t len, - ssize_t rlen, - int64_t lastKnownGoodPos, - bool allowTruncate) __attribute__ ((noinline)); +handleReadError(const char *text, FastOS_FileInterface &file, ssize_t len, ssize_t rlen, + int64_t lastKnownGoodPos, bool allowTruncate) __attribute__ ((noinline)); -bool -addPacket(Packet &packet, - const Packet::Entry &e) __attribute__ ((noinline)); - -bool -tailOfFileIsZero(FastOS_FileInterface &file, int64_t lastKnownGoodPos) __attribute__ ((noinline)); +void handleSync(FastOS_FileInterface &file) __attribute__ ((noinline)); +bool addPacket(Packet &packet, const Packet::Entry &e) __attribute__ ((noinline)); +bool tailOfFileIsZero(FastOS_FileInterface &file, int64_t lastKnownGoodPos) __attribute__ ((noinline)); bool addPacket(Packet &packet, const Packet::Entry &e) @@ -72,21 +61,18 @@ handleSync(FastOS_FileInterface &file) } string -handleWriteError(const char *text, - FastOS_FileInterface &file, - int64_t lastKnownGoodPos, - const Packet::Entry &entry, - int bufLen) +handleWriteError(const char *text, FastOS_FileInterface &file, int64_t lastKnownGoodPos, + SerialNumRange range, int bufLen) { string last(FastOS_File::getLastErrorString()); - string e(make_string("%s. File '%s' at position %" PRId64 " for entry %" PRIu64 " of length %u. " + string e(make_string("%s. File '%s' at position %" PRId64 " for entries [%" PRIu64 ", %" PRIu64 "] of length %u. " "OS says '%s'. Rewind to last known good position %" PRId64 ".", - text, file.GetFileName(), file.GetPosition(), entry.serial(), bufLen, + text, file.GetFileName(), file.GetPosition(), range.from(), range.to(), bufLen, last.c_str(), lastKnownGoodPos)); LOG(error, "%s", e.c_str()); if ( ! file.SetPosition(lastKnownGoodPos) ) { last = FastOS_File::getLastErrorString(); - throw runtime_error(make_string("Failed setting position %" PRId64 " of file '%s' of size %" PRId64 ": OS says '%s'", + throw runtime_error(make_string("Failed setting position %" PRId64 " of file '%s' of size %" PRId64 " : OS says '%s'", lastKnownGoodPos, file.GetFileName(), file.GetSize(), last.c_str())); } handleSync(file); @@ -118,12 +104,8 @@ tailOfFileIsZero(FastOS_FileInterface &file, int64_t lastKnownGoodPos) } bool -handleReadError(const char *text, - FastOS_FileInterface &file, - ssize_t len, - ssize_t rlen, - int64_t lastKnownGoodPos, - bool allowTruncate) +handleReadError(const char *text, FastOS_FileInterface &file, ssize_t len, ssize_t rlen, + int64_t lastKnownGoodPos, bool allowTruncate) { bool retval(true); if (rlen != -1) { @@ -265,7 +247,6 @@ DomainPart::buildPacketMapping(bool allowTruncate) } } } - packet.close(); if (!packet.empty()) { _packets[firstSerial] = packet; _range.to(lastSerial); @@ -534,12 +515,9 @@ DomainPart::visit(SerialNumRange &r, Packet &packet) } } } - newPacket.close(); packet = newPacket; retval = next != _packets.end(); } - } else { - packet.close(); } } else { /// File has been closed must continue from file. @@ -583,7 +561,6 @@ DomainPart::visit(FastOS_FileInterface &file, SerialNumRange &r, Packet &packet) } } } - newPacket.close(); packet = newPacket; } @@ -609,7 +586,7 @@ DomainPart::write(FastOS_FileInterface &file, const Packet::Entry &entry) LockGuard guard(_writeLock); if ( ! file.CheckedWrite(os.data(), osSize) ) { - throw runtime_error(handleWriteError("Failed writing the entry.", file, lastKnownGoodPos, entry, end - start)); + throw runtime_error(handleWriteError("Failed writing the entry.", file, lastKnownGoodPos, SerialNumRange(entry.serial(), entry.serial()), end - start)); } _writtenSerial = entry.serial(); _byteSize.store(lastKnownGoodPos + osSize, std::memory_order_release); |