diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2024-02-18 09:07:03 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2024-02-18 09:07:03 +0000 |
commit | 4ad220bb0e9d62562ae631ad5d25fa783f608a6a (patch) | |
tree | a38be31ee33c77484c5e22a51f4d1a652b7b34e6 | |
parent | 24a70ad90fa6005ab6d466bb87081d6ad36f6780 (diff) |
Modernize key/value interface of fs4::FS4Properties
4 files changed, 37 insertions, 28 deletions
diff --git a/client/go/internal/admin/jvm/application_container.go b/client/go/internal/admin/jvm/application_container.go index 3806dfea302..4db70d364f4 100644 --- a/client/go/internal/admin/jvm/application_container.go +++ b/client/go/internal/admin/jvm/application_container.go @@ -118,6 +118,7 @@ func (a *ApplicationContainer) configureMemory(qc *QrStartConfig) { opts.AddOption(fmt.Sprintf("-Xmx%dm", jvm_heapsize)) opts.AddOption(fmt.Sprintf("-XX:ThreadStackSize=%d", jvm_stacksize)) opts.AddOption(fmt.Sprintf("-XX:MaxDirectMemorySize=%dm", maxDirectMemorySize)) + opts.AddOption(fmt.Sprintf("-XX:Tier4CompileThreshold=1000000")) opts.MaybeAddHugepages(MegaBytesOfMemory(jvm_heapsize)) if jvm_compressedClassSpaceSize > 0 { opts.AddOption(fmt.Sprintf("-XX:CompressedClassSpaceSize=%dm", jvm_compressedClassSpaceSize)) diff --git a/searchlib/src/vespa/searchlib/common/packets.cpp b/searchlib/src/vespa/searchlib/common/packets.cpp index 3f2b5750631..af5dc5fc110 100644 --- a/searchlib/src/vespa/searchlib/common/packets.cpp +++ b/searchlib/src/vespa/searchlib/common/packets.cpp @@ -35,14 +35,14 @@ FS4Properties::FS4Properties() _backing() { } -FS4Properties::FS4Properties(FS4Properties && rhs) +FS4Properties::FS4Properties(FS4Properties && rhs) noexcept : _entries(std::move(rhs._entries)), _name(std::move(rhs._name)), _backing(std::move(rhs._backing)) { } FS4Properties & -FS4Properties::operator=(FS4Properties && rhs) +FS4Properties::operator=(FS4Properties && rhs) noexcept { _entries = std::move(rhs._entries); _name = std::move(rhs._name); @@ -72,14 +72,25 @@ FS4Properties::setValue(uint32_t entry, const char *value, uint32_t valueSize) } uint32_t -FS4Properties::getLength() +FS4Properties::getLength() const noexcept { - uint32_t len = sizeof(uint32_t) * 2 + getNameLen(); + uint32_t len = sizeof(uint32_t) * 2 + name().size(); len += _backing.size(); len += _entries.size() * sizeof(uint32_t) * 2; return len; } +vespalib::stringref +FS4Properties::key(uint32_t entry) const noexcept { + auto pair = _entries[entry].first; + return {c_str(pair.first), pair.second}; +} +vespalib::stringref +FS4Properties::value(uint32_t entry) const noexcept { + auto pair = _entries[entry].second; + return {c_str(pair.first), pair.second}; +} + vespalib::string FS4Properties::toString(uint32_t indent) const { @@ -90,8 +101,8 @@ FS4Properties::toString(uint32_t indent) const s += "\n"; for (uint32_t i = 0; i < size(); ++i) { s += make_string("%*s Entry[%d] {\n", indent, "", i); - s += make_string("%*s key : %s\n", indent, "", vespalib::string(getKey(i), getKeyLen(i)).c_str()); - s += make_string("%*s value: %s\n", indent, "", vespalib::string(getValue(i), getValueLen(i)).c_str()); + s += make_string("%*s key : %s\n", indent, "", string(key(i)).c_str()); + s += make_string("%*s value: %s\n", indent, "", string(value(i)).c_str()); s += make_string("%*s }\n", indent, ""); } s += make_string("%*s}\n", indent, ""); diff --git a/searchlib/src/vespa/searchlib/common/packets.h b/searchlib/src/vespa/searchlib/common/packets.h index b04e1fb44d0..fbdae8b51ec 100644 --- a/searchlib/src/vespa/searchlib/common/packets.h +++ b/searchlib/src/vespa/searchlib/common/packets.h @@ -50,8 +50,10 @@ private: void set(StringRef & e, vespalib::stringref s); void allocEntries(uint32_t cnt); public: - FS4Properties(FS4Properties &&); - FS4Properties &operator=(FS4Properties &&); + FS4Properties(FS4Properties &&) noexcept; + FS4Properties &operator=(FS4Properties &&) noexcept; + FS4Properties(const FS4Properties &) = delete; + FS4Properties &operator=(const FS4Properties &) = delete; FS4Properties(); ~FS4Properties(); @@ -67,16 +69,13 @@ public: void setValue(uint32_t entry, vespalib::stringref val) { setValue(entry, val.data(), val.size()); } - uint32_t size() const { return _entries.size(); } - const char *getName() const { return _name.c_str(); } - uint32_t getNameLen() const { return _name.size(); } - const char *getKey(uint32_t entry) const { return c_str(_entries[entry].first.first); } - uint32_t getKeyLen(uint32_t entry) const { return _entries[entry].first.second; } - const char *getValue(uint32_t entry) const { return c_str(_entries[entry].second.first); } - uint32_t getValueLen(uint32_t entry) const { return _entries[entry].second.second; } + uint32_t size() const noexcept { return _entries.size(); } + const vespalib::string & name() const noexcept { return _name; } + vespalib::stringref key(uint32_t entry) const noexcept; + vespalib::stringref value(uint32_t entry) const noexcept; // sub-packet methods below - uint32_t getLength(); + uint32_t getLength() const noexcept; void encode(FNET_DataBuffer &dst); bool decode(FNET_DataBuffer &src, uint32_t &len); diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp index 1875664f6c4..68c5f5cfdc8 100644 --- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp @@ -51,6 +51,7 @@ using vsm::DocsumFilter; using vsm::FieldPath; using vsm::StorageDocument; using vsm::StringFieldIdTMap; +using vespalib::string; namespace { @@ -429,21 +430,18 @@ SearchVisitor::init(const Parameters & params) if (!prop.decode(src, len)) { LOG(warning, "Could not decode rank properties"); } else { - LOG(debug, "Properties[%u]: name '%s', size '%u'", i, prop.getName(), prop.size()); - if (strcmp(prop.getName(), "rank") == 0) { // pick up rank properties + LOG(debug, "Properties[%u]: name '%s', size '%u'", i, prop.name().c_str(), prop.size()); + if (prop.name() == "rank") { // pick up rank properties for (uint32_t j = 0; j < prop.size(); ++j) { - vespalib::string k{prop.getKey(j), prop.getKeyLen(j)}; - vespalib::string v{prop.getValue(j), prop.getValueLen(j)}; - LOG(debug, "Properties[%u][%u]: key '%s' -> value '%s'", i, j, k.c_str(), v.c_str()); - _rankController.getQueryProperties().add(k, v); + LOG(debug, "Properties[%u][%u]: key '%s' -> value '%s'", + i, j, string(prop.key(j)).c_str(), string(prop.value(j)).c_str()); + _rankController.getQueryProperties().add(prop.key(j), prop.value(j)); } - } - if (strcmp(prop.getName(), "feature") == 0) { // pick up feature overrides + } else if (prop.name() == "feature") { // pick up feature overrides for (uint32_t j = 0; j < prop.size(); ++j) { - vespalib::string k{prop.getKey(j), prop.getKeyLen(j)}; - vespalib::string v{prop.getValue(j), prop.getValueLen(j)}; - LOG(debug, "Feature override[%u][%u]: key '%s' -> value '%s'", i, j, k.c_str(), v.c_str()); - _rankController.getFeatureOverrides().add(k, v); + LOG(debug, "Feature override[%u][%u]: key '%s' -> value '%s'", + i, j, string(prop.key(j)).c_str(), string(prop.value(j)).c_str()); + _rankController.getFeatureOverrides().add(prop.key(j), prop.value(j)); } } } |