diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-03-02 02:00:41 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-03-08 21:38:37 +0000 |
commit | be9df8bfa22cf5a7164f4f3deba44cdbd2b8e7cf (patch) | |
tree | f4a9153a9613f375f3a7dc15fb274a528a1269ed /memfilepersistence | |
parent | 72e9888bcccbc384d2485409ba055633131ed512 (diff) |
Implement a default destructor to avoid the automatic inlining of large destructors.
Diffstat (limited to 'memfilepersistence')
5 files changed, 97 insertions, 77 deletions
diff --git a/memfilepersistence/src/vespa/memfilepersistence/device/directory.cpp b/memfilepersistence/src/vespa/memfilepersistence/device/directory.cpp index 9c03e1eb449..a108ad4d4d9 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/device/directory.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/device/directory.cpp @@ -49,8 +49,13 @@ namespace { std::string path; Device::State status; std::string description; + Entry(); + ~Entry(); }; + Entry::Entry() {} + Entry::~Entry() {} + Entry parseDirectoryString(const std::string& serialized) { while (1) { Entry e; diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp index 7622f421331..3c10efdf0c9 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp @@ -154,6 +154,12 @@ SimpleMemFileIOBuffer::HeaderChunkEncoder::bufferDocument(const Document& doc) doc.serializeHeader(_serializedDoc); } +SimpleMemFileIOBuffer::HeaderChunkEncoder::HeaderChunkEncoder(const document::DocumentId& docId) + : _serializedDoc(DEFAULT_STREAM_ALLOC_SIZE), + _docId(docId.toString()) +{ } +SimpleMemFileIOBuffer::HeaderChunkEncoder::~HeaderChunkEncoder() {} + /** * Buffer is comprised of the following: * - Document header blob (n bytes) diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h index 4628291352e..3e91916ff0b 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h @@ -157,10 +157,8 @@ public: public: static const size_t DEFAULT_STREAM_ALLOC_SIZE = 5 * 2014; - HeaderChunkEncoder(const document::DocumentId& docId) - : _serializedDoc(DEFAULT_STREAM_ALLOC_SIZE), - _docId(docId.toString()) - { } + HeaderChunkEncoder(const document::DocumentId& docId); + ~HeaderChunkEncoder(); /** * Serializes header chunk to buf, which must have at least a size diff --git a/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfile.cpp b/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfile.cpp index 1893dc041b2..f3eb1429207 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfile.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfile.cpp @@ -46,48 +46,53 @@ namespace { std::string docId; // bool useConstructor; - CmdOptions(int argc, const char* const* argv) - : vespalib::ProgramOptions(argc, argv), - showSyntaxPage(false) - { - setSyntaxMessage( - "Utility program for showing the contents of the slotfiles " - "used by Vespa Document Storage in a user readable format. " - "Intended for debugging purposes." - ); - addOption("h help", showSyntaxPage, false, - "Shows this help page"); - addOption("n noheader", printHeader, true, - "If given, the header block content is not shown"); - addOption("N nobody", printBody, true, - "If given, the body block content is not shown"); - addOption("f friendly", userFriendlyOutput, false, - "Gives less compact, but more user friendly output"); - addOption("x toxml", toXml, false, - "Print document XML of contained documents"); - addOption("b tobinary", toBinary, false, - "Print binary representations of contained documents"); - addOption("includeremoveddocs", includeRemovedDocs, false, - "When showing XML, include documents that are still in " - "the file, but have been removed."); - addOption("includeremoveentries", includeRemoveEntries, false, - "When showing XML, include remove entries."); - addOption("c documentconfig", documentManConfigId, - std::string("client"), - "The document config to use, needed if deserializing " - "documents."); + CmdOptions(int argc, const char* const* argv); + ~CmdOptions(); + + }; + + CmdOptions::CmdOptions(int argc, const char* const* argv) + : vespalib::ProgramOptions(argc, argv), + showSyntaxPage(false) + { + setSyntaxMessage( + "Utility program for showing the contents of the slotfiles " + "used by Vespa Document Storage in a user readable format. " + "Intended for debugging purposes." + ); + addOption("h help", showSyntaxPage, false, + "Shows this help page"); + addOption("n noheader", printHeader, true, + "If given, the header block content is not shown"); + addOption("N nobody", printBody, true, + "If given, the body block content is not shown"); + addOption("f friendly", userFriendlyOutput, false, + "Gives less compact, but more user friendly output"); + addOption("x toxml", toXml, false, + "Print document XML of contained documents"); + addOption("b tobinary", toBinary, false, + "Print binary representations of contained documents"); + addOption("includeremoveddocs", includeRemovedDocs, false, + "When showing XML, include documents that are still in " + "the file, but have been removed."); + addOption("includeremoveentries", includeRemoveEntries, false, + "When showing XML, include remove entries."); + addOption("c documentconfig", documentManConfigId, + std::string("client"), + "The document config to use, needed if deserializing " + "documents."); // addOption("s sort", metaDataSort, std::string("none"), // "How to sort metadatalist. Valid arguments: " // "bodypos, headerpos & none."); - addOption("t time", timestampToShow, uint64_t(0), - "If set, only present data related to this timestamp, " - "when outputting XML or binary data."); - addOption("docid", docId, std::string(""), - "Retrieve single document using get semantics"); + addOption("t time", timestampToShow, uint64_t(0), + "If set, only present data related to this timestamp, " + "when outputting XML or binary data."); + addOption("docid", docId, std::string(""), + "Retrieve single document using get semantics"); // addOption("useconstructor", useConstructor, false, "Debug option"); - addArgument("slotfile", filename, "The slotfile to dump."); - } - }; + addArgument("slotfile", filename, "The slotfile to dump."); + } + CmdOptions::~CmdOptions() { } void printDoc(document::Document& doc, CmdOptions& o) { if (o.toXml) { @@ -154,41 +159,8 @@ namespace { std::unique_ptr<Environment> _env; EnvironmentImpl(config::ConfigUri& externalConfig, - const char* documentConfigId) - : _compReg(), - _component(_compReg, "dumpslotfile"), - _clock(), - _metrics(_component), - _threadMetrics(_metrics.addThreadMetrics()), - _cache(), - _mapper(*this), - _deviceManager(DeviceMapper::UP(new SimpleDeviceMapper), _clock), - _docType("foo", 1) - { - _compReg.setClock(_clock); - _compReg.setMemoryManager(_memoryMan); - _cache.reset(new MemFileCache(_compReg, _metrics._cache)); - if (documentConfigId == 0) { - _repo.reset(new DocumentTypeRepo(_docType)); - } else { - config::ConfigUri uri( - externalConfig.createWithNewId(documentConfigId)); - std::unique_ptr<document::DocumenttypesConfig> config( - ConfigGetter<DocumenttypesConfig>::getConfig( - uri.getConfigId(), uri.getContext())); - _repo.reset(new DocumentTypeRepo(*config)); - } - _deviceConfig.rootFolder = "."; - std::string configId("defaultId"); - _configSet.addBuilder(configId, &_memFileConfig); - _configSet.addBuilder(configId, &_persistenceConfig); - _configSet.addBuilder(configId, &_deviceConfig); - _configContext.reset(new config::ConfigContext(_configSet)); - _internalConfig.reset( - new config::ConfigUri(configId, _configContext)); - _env.reset(new Environment( - *_internalConfig, *_cache, _mapper, *_repo, _clock, true)); - } + const char* documentConfigId); + ~EnvironmentImpl(); MemFilePersistenceThreadMetrics& getMetrics() const { return *_threadMetrics; @@ -196,6 +168,43 @@ namespace { }; + EnvironmentImpl::EnvironmentImpl(config::ConfigUri& externalConfig, const char* documentConfigId) + : _compReg(), + _component(_compReg, "dumpslotfile"), + _clock(), + _metrics(_component), + _threadMetrics(_metrics.addThreadMetrics()), + _cache(), + _mapper(*this), + _deviceManager(DeviceMapper::UP(new SimpleDeviceMapper), _clock), + _docType("foo", 1) + { + _compReg.setClock(_clock); + _compReg.setMemoryManager(_memoryMan); + _cache.reset(new MemFileCache(_compReg, _metrics._cache)); + if (documentConfigId == 0) { + _repo.reset(new DocumentTypeRepo(_docType)); + } else { + config::ConfigUri uri( + externalConfig.createWithNewId(documentConfigId)); + std::unique_ptr<document::DocumenttypesConfig> config( + ConfigGetter<DocumenttypesConfig>::getConfig( + uri.getConfigId(), uri.getContext())); + _repo.reset(new DocumentTypeRepo(*config)); + } + _deviceConfig.rootFolder = "."; + std::string configId("defaultId"); + _configSet.addBuilder(configId, &_memFileConfig); + _configSet.addBuilder(configId, &_persistenceConfig); + _configSet.addBuilder(configId, &_deviceConfig); + _configContext.reset(new config::ConfigContext(_configSet)); + _internalConfig.reset( + new config::ConfigUri(configId, _configContext)); + _env.reset(new Environment( + *_internalConfig, *_cache, _mapper, *_repo, _clock, true)); + } + EnvironmentImpl::~EnvironmentImpl() {} + } int SlotFileDumper::dump(int argc, const char * const * argv, diff --git a/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp b/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp index 0011dddd421..ad9b08f4994 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp @@ -123,6 +123,7 @@ struct CmdLineOptions : public vespalib::ProgramOptions { "Required when disabling a disk, such that other " "administrators can see why it has happened."); } + ~CmdLineOptions(); vector<std::string> listDir(const std::string& dir) { DIR* dirp = opendir(dir.c_str()); @@ -313,6 +314,7 @@ struct CmdLineOptions : public vespalib::ProgramOptions { }; +CmdLineOptions::~CmdLineOptions() {} int VdsDiskTool::run(int argc, const char * const * argv, |