[metadata] Don't ref entire read for unknown metadata added to hpack table (#34863)

pull/34885/head
Craig Tiller 1 year ago committed by GitHub
parent b94e1ecb4e
commit edfb0387d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      src/core/lib/experiments/experiments.cc
  2. 11
      src/core/lib/experiments/experiments.h
  3. 4
      src/core/lib/experiments/experiments.yaml
  4. 2
      src/core/lib/experiments/rollouts.yaml
  5. 7
      src/core/lib/transport/metadata_batch.h

@ -180,6 +180,10 @@ const char* const description_unconstrained_max_quota_buffer_size =
"Discard the cap on the max free pool size for one memory allocator";
const char* const additional_constraints_unconstrained_max_quota_buffer_size =
"{}";
const char* const description_uniquely_unowned =
"Ensure HPACK table takes a unique copy of data when parsing unknown "
"metadata";
const char* const additional_constraints_uniquely_unowned = "{}";
const char* const description_work_serializer_clears_time_cache =
"Have the work serializer clear the time cache when it dispatches work.";
const char* const additional_constraints_work_serializer_clears_time_cache =
@ -301,6 +305,8 @@ const ExperimentMetadata g_experiment_metadata[] = {
{"unconstrained_max_quota_buffer_size",
description_unconstrained_max_quota_buffer_size,
additional_constraints_unconstrained_max_quota_buffer_size, false, true},
{"uniquely_unowned", description_uniquely_unowned,
additional_constraints_uniquely_unowned, true, true},
{"work_serializer_clears_time_cache",
description_work_serializer_clears_time_cache,
additional_constraints_work_serializer_clears_time_cache, true, true},
@ -476,6 +482,10 @@ const char* const description_unconstrained_max_quota_buffer_size =
"Discard the cap on the max free pool size for one memory allocator";
const char* const additional_constraints_unconstrained_max_quota_buffer_size =
"{}";
const char* const description_uniquely_unowned =
"Ensure HPACK table takes a unique copy of data when parsing unknown "
"metadata";
const char* const additional_constraints_uniquely_unowned = "{}";
const char* const description_work_serializer_clears_time_cache =
"Have the work serializer clear the time cache when it dispatches work.";
const char* const additional_constraints_work_serializer_clears_time_cache =
@ -597,6 +607,8 @@ const ExperimentMetadata g_experiment_metadata[] = {
{"unconstrained_max_quota_buffer_size",
description_unconstrained_max_quota_buffer_size,
additional_constraints_unconstrained_max_quota_buffer_size, false, true},
{"uniquely_unowned", description_uniquely_unowned,
additional_constraints_uniquely_unowned, true, true},
{"work_serializer_clears_time_cache",
description_work_serializer_clears_time_cache,
additional_constraints_work_serializer_clears_time_cache, true, true},
@ -772,6 +784,10 @@ const char* const description_unconstrained_max_quota_buffer_size =
"Discard the cap on the max free pool size for one memory allocator";
const char* const additional_constraints_unconstrained_max_quota_buffer_size =
"{}";
const char* const description_uniquely_unowned =
"Ensure HPACK table takes a unique copy of data when parsing unknown "
"metadata";
const char* const additional_constraints_uniquely_unowned = "{}";
const char* const description_work_serializer_clears_time_cache =
"Have the work serializer clear the time cache when it dispatches work.";
const char* const additional_constraints_work_serializer_clears_time_cache =
@ -893,6 +909,8 @@ const ExperimentMetadata g_experiment_metadata[] = {
{"unconstrained_max_quota_buffer_size",
description_unconstrained_max_quota_buffer_size,
additional_constraints_unconstrained_max_quota_buffer_size, false, true},
{"uniquely_unowned", description_uniquely_unowned,
additional_constraints_uniquely_unowned, true, true},
{"work_serializer_clears_time_cache",
description_work_serializer_clears_time_cache,
additional_constraints_work_serializer_clears_time_cache, true, true},

@ -125,6 +125,8 @@ inline bool IsTcpFrameSizeTuningEnabled() { return false; }
inline bool IsTcpRcvLowatEnabled() { return false; }
inline bool IsTraceRecordCallopsEnabled() { return false; }
inline bool IsUnconstrainedMaxQuotaBufferSizeEnabled() { return false; }
#define GRPC_EXPERIMENT_IS_INCLUDED_UNIQUELY_UNOWNED
inline bool IsUniquelyUnownedEnabled() { return true; }
#define GRPC_EXPERIMENT_IS_INCLUDED_WORK_SERIALIZER_CLEARS_TIME_CACHE
inline bool IsWorkSerializerClearsTimeCacheEnabled() { return true; }
inline bool IsWorkSerializerDispatchEnabled() { return false; }
@ -205,6 +207,8 @@ inline bool IsTcpFrameSizeTuningEnabled() { return false; }
inline bool IsTcpRcvLowatEnabled() { return false; }
inline bool IsTraceRecordCallopsEnabled() { return false; }
inline bool IsUnconstrainedMaxQuotaBufferSizeEnabled() { return false; }
#define GRPC_EXPERIMENT_IS_INCLUDED_UNIQUELY_UNOWNED
inline bool IsUniquelyUnownedEnabled() { return true; }
#define GRPC_EXPERIMENT_IS_INCLUDED_WORK_SERIALIZER_CLEARS_TIME_CACHE
inline bool IsWorkSerializerClearsTimeCacheEnabled() { return true; }
inline bool IsWorkSerializerDispatchEnabled() { return false; }
@ -285,6 +289,8 @@ inline bool IsTcpFrameSizeTuningEnabled() { return false; }
inline bool IsTcpRcvLowatEnabled() { return false; }
inline bool IsTraceRecordCallopsEnabled() { return false; }
inline bool IsUnconstrainedMaxQuotaBufferSizeEnabled() { return false; }
#define GRPC_EXPERIMENT_IS_INCLUDED_UNIQUELY_UNOWNED
inline bool IsUniquelyUnownedEnabled() { return true; }
#define GRPC_EXPERIMENT_IS_INCLUDED_WORK_SERIALIZER_CLEARS_TIME_CACHE
inline bool IsWorkSerializerClearsTimeCacheEnabled() { return true; }
inline bool IsWorkSerializerDispatchEnabled() { return false; }
@ -340,6 +346,7 @@ enum ExperimentIds {
kExperimentIdTcpRcvLowat,
kExperimentIdTraceRecordCallops,
kExperimentIdUnconstrainedMaxQuotaBufferSize,
kExperimentIdUniquelyUnowned,
kExperimentIdWorkSerializerClearsTimeCache,
kExperimentIdWorkSerializerDispatch,
kExperimentIdWriteSizeCap,
@ -516,6 +523,10 @@ inline bool IsTraceRecordCallopsEnabled() {
inline bool IsUnconstrainedMaxQuotaBufferSizeEnabled() {
return IsExperimentEnabled(kExperimentIdUnconstrainedMaxQuotaBufferSize);
}
#define GRPC_EXPERIMENT_IS_INCLUDED_UNIQUELY_UNOWNED
inline bool IsUniquelyUnownedEnabled() {
return IsExperimentEnabled(kExperimentIdUniquelyUnowned);
}
#define GRPC_EXPERIMENT_IS_INCLUDED_WORK_SERIALIZER_CLEARS_TIME_CACHE
inline bool IsWorkSerializerClearsTimeCacheEnabled() {
return IsExperimentEnabled(kExperimentIdWorkSerializerClearsTimeCache);

@ -307,6 +307,10 @@
expiry: 2024/02/01
owner: ctiller@google.com
test_tags: [resource_quota_test]
- name: uniquely_unowned
description: Ensure HPACK table takes a unique copy of data when parsing unknown metadata
expiry: 2024/03/03
owner: ctiller@google.com
- name: work_serializer_clears_time_cache
description:
Have the work serializer clear the time cache when it dispatches work.

@ -134,6 +134,8 @@
default: false
- name: unconstrained_max_quota_buffer_size
default: false
- name: uniquely_unowned
default: true
- name: work_serializer_clears_time_cache
default: true
- name: work_serializer_dispatch

@ -40,6 +40,7 @@
#include <grpc/support/log.h>
#include "src/core/lib/compression/compression_internal.h"
#include "src/core/lib/experiments/experiments.h"
#include "src/core/lib/gprpp/chunked_vector.h"
#include "src/core/lib/gprpp/if_list.h"
#include "src/core/lib/gprpp/packed_table.h"
@ -647,7 +648,11 @@ class ParseHelper {
absl::string_view key) {
return ParsedMetadata<Container>(
typename ParsedMetadata<Container>::FromSlicePair{},
Slice::FromCopiedString(key), std::move(value_), transport_size_);
Slice::FromCopiedString(key),
IsUniquelyUnownedEnabled() && will_keep_past_request_lifetime_
? value_.TakeUniquelyOwned()
: std::move(value_),
transport_size_);
}
private:

Loading…
Cancel
Save