github.com/cockroachdb/cockroachdb-parser@v0.23.3-0.20240213214944-911057d40c9a/pkg/sql/sessiondatapb/session_data.proto (about) 1 // Copyright 2020 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 syntax = "proto3"; 12 package cockroach.sql.sessiondatapb; 13 option go_package = "github.com/cockroachdb/cockroach/pkg/sql/sessiondatapb"; 14 15 import "sql/lex/encode.proto"; 16 import "util/duration/duration.proto"; 17 import "util/timeutil/pgdate/pgdate.proto"; 18 import "gogoproto/gogo.proto"; 19 import "google/protobuf/duration.proto"; 20 21 // SessionData contains session parameters that are easily serializable and are 22 // required to be propagated to the remote nodes for the correct execution of 23 // DistSQL flows. 24 message SessionData { 25 // Database indicates the "current" database for the purpose of resolving 26 // names. 27 string database = 1; 28 // ApplicationName is the name of the application running the current 29 // session. This can be used for logging and per-application statistics. 30 string application_name = 2; 31 // User is the name of the user logged into the session. 32 string user_proto = 3 [(gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/security/username.SQLUsernameProto"]; 33 // DataConversion gives access to the data conversion configuration. 34 DataConversionConfig data_conversion_config = 4 [(gogoproto.nullable) = false]; 35 // VectorizeMode indicates which kinds of queries to use vectorized execution 36 // engine for. 37 VectorizeExecMode vectorize_mode = 5; 38 // TestingVectorizeInjectPanics indicates whether random panics are injected 39 // into the vectorized flow execution. The goal of such behavior is making 40 // sure that errors that are propagated as panics in the vectorized engine 41 // are caught in all scenarios. 42 bool testing_vectorize_inject_panics = 6; 43 // DefaultIntSize specifies the size in bits or bytes (preferred) of how a 44 // "naked" INT type should be parsed. 45 int32 default_int_size = 7; 46 // The name of the location according to whose current timezone we're going to 47 // parse timestamps. Used to initialize sessiondata.SessionData.Location on 48 // the remote nodes. 49 // 50 // Note that the current serialization of the time.Location objects as 51 // strings has many drawbacks which could lead to unstable computation on the 52 // remote nodes. See #36864 and 53 // https://github.com/cockroachdb/cockroach/pull/55377#issuecomment-707794695 54 // for more details. 55 string location = 8; 56 // SearchPath is a list of namespaces to search builtins in. Used to 57 // initialize sessiondata.SessionData.SearchPath on the remote nodes. 58 repeated string search_path = 9; 59 string temporary_schema_name = 10; 60 // SeqState gives access to the SQL sequences that have been manipulated by 61 // the session. 62 SequenceState seq_state = 11 [(gogoproto.nullable) = false]; 63 // WorkMemLimit determines how much RAM (in bytes) a single operation of a 64 // single query can use before it has to spill to disk. 65 int64 WorkMemLimit = 12; 66 reserved 13; 67 reserved 14; 68 // LockTimeout is the maximum amount of time that a query will wait while 69 // attempting to acquire a lock on a key or while blocking on an existing 70 // lock in order to perform a non-locking read on a key. 71 google.protobuf.Duration lock_timeout = 15 [(gogoproto.nullable) = false, 72 (gogoproto.stdduration) = true]; 73 // Internal is true if this query came from InternalExecutor or an internal 74 // planner. 75 bool internal = 16; 76 // OnUpdateRehomeRowEnabled controls whether the ON UPDATE rehome_row() 77 // will actually trigger on row updates. 78 bool on_update_rehome_row_enabled = 17; 79 // JoinReaderOrderingStrategyBatchSize is the size limit on the input rows to 80 // the joinReader processor (when ordering is required to be maintained) to 81 // construct a single lookup KV batch. 82 int64 join_reader_ordering_strategy_batch_size = 18; 83 // ParallelizeMultiKeyLookupJoinsEnabled is true when the join reader should 84 // parallelize lookup batches under all circumstances. Enabling this will 85 // increase the speed of lookup joins when each input row might get multiple 86 // looked up rows at the cost of increased memory usage. 87 bool parallelize_multi_key_lookup_joins_enabled = 19; 88 // TrigramSimilarityThreshold configures the value that's used to compare 89 // trigram similarities to in order to evaluate the string % string overload. 90 double trigram_similarity_threshold = 20; 91 // Troubleshooting mode determines whether we refuse to do additional work 92 // with the query (i.e. collect & emit telemetry data). Troubleshooting mode 93 // is disabled by default. 94 bool troubleshooting_mode = 21; 95 // JoinReaderNoOrderingStrategyBatchSize is the size limit on the input rows 96 // to the joinReader processor (when ordering is **not** required to be 97 // maintained) to construct a single lookup KV batch. 98 int64 join_reader_no_ordering_strategy_batch_size = 22; 99 // JoinReaderIndexJoinStrategyBatchSize is the size limit on the input rows 100 // to the joinReader processor (when performing index joins) to construct a 101 // single lookup KV batch. 102 int64 join_reader_index_join_strategy_batch_size = 23; 103 // IndexJoinStreamerBatchSize is the size limit on the input rows to the 104 // ColIndexJoin operator (when it is using the Streamer API) to construct a 105 // single lookup KV batch. 106 int64 index_join_streamer_batch_size = 24; 107 // DirectColumnarScansEnabled indicates whether the COL_BATCH_RESPONSE scan 108 // format should be used for ScanRequests and ReverseScanRequests whenever 109 // possible. 110 bool direct_columnar_scans_enabled = 25; 111 // DefaultTextSearchConfig configures the default text search configuration 112 // that is used for builtins like to_tsvector and to_tsquery if no 113 // text search configuration is explicitly passed in. 114 string default_text_search_config = 26; 115 // StreamerAlwaysMaintainOrdering indicates that the SQL users of the Streamer 116 // should always ask it to maintain the ordering, even when it might not be 117 // strictly necessary for the query. 118 // 119 // This session variable is introduced as a possible workaround in case we 120 // have more bugs like #113013. 121 bool streamer_always_maintain_ordering = 27; 122 // StreamerInOrderEagerMemoryUsageFraction controls the fraction of the 123 // streamer's memory budget that might be used for issuing requests eagerly, 124 // in the InOrder mode. 125 double streamer_in_order_eager_memory_usage_fraction = 28; 126 // StreamerOutOfOrderEagerMemoryUsageFraction controls the fraction of the 127 // streamer's memory budget that might be used for issuing requests eagerly, 128 // in the OutOfOrder mode. 129 double streamer_out_of_order_eager_memory_usage_fraction = 29; 130 // StreamerHeadOfLineOnlyFraction controls the fraction of the available 131 // streamer's memory budget that will be used to set the TargetBytes limit on 132 // head-of-the-line request in case the "eager" memory usage limit has been 133 // exceeded. 134 double streamer_head_of_line_only_fraction = 30; 135 // DistSQLPlanGatewayBias controls the factor of times more partition spans 136 // the gateway node is allowed to be assigned in the absence of a better 137 // choice relative to the distribution of partition spans on other eligible 138 // instances. Refer to `shouldPickGateway` for more details. 139 // 140 // This field is in SessionData because that is the format in which a job 141 // serializes and stores session variables at the time of job creation. A job 142 // could be adopted by any node in the cluster (not necessarily the gateway) 143 // and so we will need this information available on all nodes. 144 int64 distsql_plan_gateway_bias = 31; 145 } 146 147 // DataConversionConfig contains the parameters that influence the output 148 // of certain data types as strings or bytes. 149 message DataConversionConfig { 150 // BytesEncodeFormat indicates how to encode byte arrays when converting to 151 // string. 152 BytesEncodeFormat bytes_encode_format = 1; 153 // ExtraFloatDigits indicates the number of digits beyond the standard number 154 // to use for float conversions.This must be set to a value between -15 and 155 // 3, inclusive. 156 int32 extra_float_digits = 2; 157 // IntervalStyle indicates the style to parse and display intervals as. 158 util.duration.IntervalStyle interval_style = 3; 159 // DateStyle indicates the style to parse and display dates as. 160 util.timeutil.pgdate.DateStyle date_style = 4 [(gogoproto.nullable) = false]; 161 } 162 163 // VectorizeExecMode controls if an when the Executor executes queries using 164 // the columnar execution engine. 165 enum VectorizeExecMode { 166 option (gogoproto.goproto_enum_prefix) = false; 167 option (gogoproto.goproto_enum_stringer) = false; 168 169 // VectorizeUnset means the VectorizeExecMode wasn't explicitly set. Having 170 // the first enum value as zero is required by proto3. This is mapped to 171 // VectorizeOn. 172 unset = 0 [(gogoproto.enumvalue_customname) = "VectorizeUnset"]; 173 reserved 1; 174 // VectorizeOn means that any supported queries will be run using the 175 // columnar execution. 176 on = 2 [(gogoproto.enumvalue_customname) = "VectorizeOn"]; 177 // VectorizeExperimentalAlways means that we attempt to vectorize all 178 // queries; unsupported queries will fail. Mostly used for testing. 179 experimental_always = 3 [(gogoproto.enumvalue_customname) = "VectorizeExperimentalAlways"]; 180 // VectorizeOff means that columnar execution is disabled. 181 off = 4 [(gogoproto.enumvalue_customname) = "VectorizeOff"]; 182 } 183 184 // SequenceState is used to marshall the sessiondata.SequenceState struct. 185 message SequenceState { 186 // Seq represents the last value of one sequence modified by the session. 187 message Seq { 188 uint32 seq_id = 1 [(gogoproto.customname) = "SeqID"]; 189 int64 latest_val = 2; 190 } 191 192 repeated Seq seqs = 1; 193 // last_seq_incremented is the id of the last sequence incremented by the 194 // session. This field is filled in iff seqs is not empty. 195 uint32 last_seq_incremented = 2; 196 }