diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-01-30 10:54:10 +0300 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-01-31 14:24:07 +0300 |
commit | 324e7ada8dba65f92c7a63af6286ff1332a1cd9e (patch) | |
tree | 323a863c67efaa91306a789aa26dd0df4258e29a | |
parent | 3cae04dfa7fb9b08b4204c3459fbe5394867e2a7 (diff) | |
download | ydb-324e7ada8dba65f92c7a63af6286ff1332a1cd9e.tar.gz |
Intermediate changes
70 files changed, 161 insertions, 388 deletions
diff --git a/contrib/python/hypothesis/py3/.dist-info/METADATA b/contrib/python/hypothesis/py3/.dist-info/METADATA index 3c60980953..fd179215d8 100644 --- a/contrib/python/hypothesis/py3/.dist-info/METADATA +++ b/contrib/python/hypothesis/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: hypothesis -Version: 6.93.0 +Version: 6.93.2 Summary: A library for property-based testing Home-page: https://hypothesis.works Author: David R. MacIver and Zac Hatfield-Dodds diff --git a/contrib/python/hypothesis/py3/hypothesis/control.py b/contrib/python/hypothesis/py3/hypothesis/control.py index 3a973f666f..5b662197a7 100644 --- a/contrib/python/hypothesis/py3/hypothesis/control.py +++ b/contrib/python/hypothesis/py3/hypothesis/control.py @@ -105,16 +105,13 @@ class BuildContext: ) ) - def prep_args_kwargs_from_strategies(self, arg_strategies, kwarg_strategies): + def prep_args_kwargs_from_strategies(self, kwarg_strategies): arg_labels = {} - all_s = [(None, s) for s in arg_strategies] + list(kwarg_strategies.items()) - args = [] kwargs = {} - for i, (k, s) in enumerate(all_s): + for k, s in kwarg_strategies.items(): start_idx = self.data.index - obj = self.data.draw(s) + obj = self.data.draw(s, observe_as=f"generate:{k}") end_idx = self.data.index - assert k is not None kwargs[k] = obj # This high up the stack, we can't see or really do much with the conjecture @@ -124,10 +121,10 @@ class BuildContext: # pass a dict of such out so that the pretty-printer knows where to place # the which-parts-matter comments later. if start_idx != end_idx: - arg_labels[k or i] = (start_idx, end_idx) + arg_labels[k] = (start_idx, end_idx) self.data.arg_slices.add((start_idx, end_idx)) - return args, kwargs, arg_labels + return kwargs, arg_labels def __enter__(self): self.assign_variable = _current_build_context.with_value(self) diff --git a/contrib/python/hypothesis/py3/hypothesis/core.py b/contrib/python/hypothesis/py3/hypothesis/core.py index 86b20ea6f9..75f1cc70e9 100644 --- a/contrib/python/hypothesis/py3/hypothesis/core.py +++ b/contrib/python/hypothesis/py3/hypothesis/core.py @@ -15,6 +15,7 @@ import contextlib import datetime import inspect import io +import math import sys import time import types @@ -605,6 +606,7 @@ def execute_explicit_examples(state, wrapped_test, arguments, kwargs, original_s data=empty_data, how_generated="explicit example", string_repr=state._string_repr, + timing=state._timing_features, ) deliver_json_blob(tc) @@ -816,34 +818,30 @@ class StateForActualGivenExecution: self._string_repr = "" text_repr = None - if self.settings.deadline is None: + if self.settings.deadline is None and not TESTCASE_CALLBACKS: test = self.test else: @proxies(self.test) def test(*args, **kwargs): - arg_drawtime = sum(data.draw_times) - initial_draws = len(data.draw_times) + arg_drawtime = math.fsum(data.draw_times.values()) start = time.perf_counter() try: result = self.test(*args, **kwargs) finally: finish = time.perf_counter() - internal_draw_time = sum(data.draw_times[initial_draws:]) - runtime = datetime.timedelta( - seconds=finish - start - internal_draw_time - ) + in_drawtime = math.fsum(data.draw_times.values()) - arg_drawtime + runtime = datetime.timedelta(seconds=finish - start - in_drawtime) self._timing_features = { - "time_running_test": finish - start - internal_draw_time, - "time_drawing_args": arg_drawtime, - "time_interactive_draws": internal_draw_time, + "execute_test": finish - start - in_drawtime, + **data.draw_times, } - current_deadline = self.settings.deadline - if not is_final: - current_deadline = (current_deadline // 4) * 5 - if runtime >= current_deadline: - raise DeadlineExceeded(runtime, self.settings.deadline) + if (current_deadline := self.settings.deadline) is not None: + if not is_final: + current_deadline = (current_deadline // 4) * 5 + if runtime >= current_deadline: + raise DeadlineExceeded(runtime, self.settings.deadline) return result def run(data): @@ -854,10 +852,9 @@ class StateForActualGivenExecution: args = self.stuff.args kwargs = dict(self.stuff.kwargs) if example_kwargs is None: - a, kw, argslices = context.prep_args_kwargs_from_strategies( - (), self.stuff.given_kwargs + kw, argslices = context.prep_args_kwargs_from_strategies( + self.stuff.given_kwargs ) - assert not a, "strategies all moved to kwargs by now" else: kw = example_kwargs argslices = {} @@ -944,7 +941,7 @@ class StateForActualGivenExecution: if expected_failure is not None: exception, traceback = expected_failure if isinstance(exception, DeadlineExceeded) and ( - runtime_secs := self._timing_features.get("time_running_test") + runtime_secs := self._timing_features.get("execute_test") ): report( "Unreliable test timings! On an initial run, this " @@ -1066,11 +1063,12 @@ class StateForActualGivenExecution: how_generated=f"generated during {phase} phase", string_repr=self._string_repr, arguments={**self._jsonable_arguments, **data._observability_args}, - metadata=self._timing_features, + timing=self._timing_features, + metadata={}, coverage=tractable_coverage_report(trace) or None, ) deliver_json_blob(tc) - self._timing_features.clear() + self._timing_features = {} def run_engine(self): """Run the test function many times, on database input and generated @@ -1184,17 +1182,17 @@ class StateForActualGivenExecution: "status": "passed" if sys.exc_info()[0] else "failed", "status_reason": str(origin or "unexpected/flaky pass"), "representation": self._string_repr, + "arguments": self._jsonable_arguments, "how_generated": "minimal failing example", "features": { **{ - k: v + f"target:{k}".strip(":"): v for k, v in ran_example.target_observations.items() - if isinstance(k, str) }, **ran_example.events, - **self._timing_features, }, - "coverage": None, # TODO: expose this? + "timing": self._timing_features, + "coverage": None, # Not recorded when we're replaying the MFE "metadata": {"traceback": tb}, } deliver_json_blob(tc) diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py index 1939e337b3..03f489fa50 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/data.py @@ -1429,7 +1429,7 @@ class ConjectureData: self.events: Dict[str, Union[str, int, float]] = {} self.forced_indices: "Set[int]" = set() self.interesting_origin: Optional[InterestingOrigin] = None - self.draw_times: "List[float]" = [] + self.draw_times: "Dict[str, float]" = {} self.max_depth = 0 self.has_discards = False self.provider = PrimitiveProvider(self) @@ -1553,6 +1553,8 @@ class ConjectureData: def draw_bytes(self, size: int, *, forced: Optional[bytes] = None) -> bytes: assert forced is None or len(forced) == size + assert size >= 0 + return self.provider.draw_bytes(size, forced=forced) def draw_boolean(self, p: float = 0.5, *, forced: Optional[bool] = None) -> bool: @@ -1597,7 +1599,12 @@ class ConjectureData: value = repr(value) self.output += value - def draw(self, strategy: "SearchStrategy[Ex]", label: Optional[int] = None) -> "Ex": + def draw( + self, + strategy: "SearchStrategy[Ex]", + label: Optional[int] = None, + observe_as: Optional[str] = None, + ) -> "Ex": if self.is_find and not strategy.supports_find: raise InvalidArgument( f"Cannot use strategy {strategy!r} within a call to find " @@ -1634,7 +1641,8 @@ class ConjectureData: try: return strategy.do_draw(self) finally: - self.draw_times.append(time.perf_counter() - start_time) + key = observe_as or f"unlabeled_{len(self.draw_times)}" + self.draw_times[key] = time.perf_counter() - start_time finally: self.stop_example() @@ -1778,15 +1786,6 @@ class ConjectureData: assert result.bit_length() <= n return result - def write(self, string: bytes) -> Optional[bytes]: - """Write ``string`` to the output buffer.""" - self.__assert_not_frozen("write") - string = bytes(string) - if not string: - return None - self.draw_bits(len(string) * 8, forced=int_from_bytes(string)) - return self.buffer[-len(string) :] - def __check_capacity(self, n: int) -> None: if self.index + n > self.max_length: self.mark_overrun() diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py index c5d33480e2..961774816f 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/conjecture/engine.py @@ -53,7 +53,39 @@ class HealthCheckState: valid_examples: int = attr.ib(default=0) invalid_examples: int = attr.ib(default=0) overrun_examples: int = attr.ib(default=0) - draw_times: list = attr.ib(factory=list) + draw_times: "defaultdict[str, list[float]]" = attr.ib( + factory=lambda: defaultdict(list) + ) + + @property + def total_draw_time(self): + return math.fsum(sum(self.draw_times.values(), start=[])) + + def timing_report(self): + """Return a terminal report describing what was slow.""" + if not self.draw_times: + return "" + width = max(len(k[len("generate:") :].strip(": ")) for k in self.draw_times) + out = [f"\n {'':^{width}} count | fraction | slowest draws (seconds)"] + args_in_order = sorted(self.draw_times.items(), key=lambda kv: -sum(kv[1])) + for i, (argname, times) in enumerate(args_in_order): # pragma: no branch + # If we have very many unique keys, which can happen due to interactive + # draws with computed labels, we'll skip uninformative rows. + if ( + 5 <= i < (len(self.draw_times) - 2) + and math.fsum(times) * 20 < self.total_draw_time + ): + out.append(f" (skipped {len(self.draw_times) - i} rows of fast draws)") + break + # Compute the row to report, omitting times <1ms to focus on slow draws + reprs = [f"{t:>6.3f}," for t in sorted(times)[-5:] if t > 5e-4] + desc = " ".join(([" -- "] * 5 + reprs)[-5:]).rstrip(",") + arg = argname[len("generate:") :].strip(": ") # removeprefix in py3.9 + out.append( + f" {arg:^{width}} | {len(times):>4} | " + f"{math.fsum(times)/self.total_draw_time:>7.0%} | {desc}" + ) + return "\n".join(out) class ExitReason(Enum): @@ -205,7 +237,7 @@ class ConjectureRunner: call_stats = { "status": data.status.name.lower(), "runtime": data.finish_time - data.start_time, - "drawtime": math.fsum(data.draw_times), + "drawtime": math.fsum(data.draw_times.values()), "events": sorted( k if v == "" else f"{k}: {v}" for k, v in data.events.items() ), @@ -328,7 +360,8 @@ class ConjectureRunner: if state is None: return - state.draw_times.extend(data.draw_times) + for k, v in data.draw_times.items(): + state.draw_times[k].append(v) if data.status == Status.VALID: state.valid_examples += 1 @@ -371,7 +404,7 @@ class ConjectureRunner: HealthCheck.filter_too_much, ) - draw_time = sum(state.draw_times) + draw_time = state.total_draw_time # Allow at least the greater of one second or 5x the deadline. If deadline # is None, allow 30s - the user can disable the healthcheck too if desired. @@ -383,7 +416,8 @@ class ConjectureRunner: f"{state.valid_examples} valid examples in {draw_time:.2f} seconds " f"({state.invalid_examples} invalid ones and {state.overrun_examples} " "exceeded maximum size). Try decreasing size of the data you're " - "generating (with e.g. max_size or max_leaves parameters).", + "generating (with e.g. max_size or max_leaves parameters)." + + state.timing_report(), HealthCheck.too_slow, ) diff --git a/contrib/python/hypothesis/py3/hypothesis/internal/observability.py b/contrib/python/hypothesis/py3/hypothesis/internal/observability.py index 0da4aca764..284a2072d7 100644 --- a/contrib/python/hypothesis/py3/hypothesis/internal/observability.py +++ b/contrib/python/hypothesis/py3/hypothesis/internal/observability.py @@ -37,6 +37,7 @@ def make_testcase( how_generated: str = "unknown", string_repr: str = "<unknown>", arguments: Optional[dict] = None, + timing: Dict[str, float], metadata: Optional[dict] = None, coverage: Optional[Dict[str, List[int]]] = None, ) -> dict: @@ -65,6 +66,7 @@ def make_testcase( }, **data.events, }, + "timing": timing, "metadata": { **(metadata or {}), "traceback": getattr(data.extra_information, "_expected_traceback", None), diff --git a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/core.py b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/core.py index b3a558c306..804901268b 100644 --- a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/core.py +++ b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/core.py @@ -2100,10 +2100,10 @@ class DataObject: def draw(self, strategy: SearchStrategy[Ex], label: Any = None) -> Ex: check_strategy(strategy, "strategy") - result = self.conjecture_data.draw(strategy) self.count += 1 printer = RepresentationPrinter(context=current_build_context()) desc = f"Draw {self.count}{'' if label is None else f' ({label})'}: " + result = self.conjecture_data.draw(strategy, observe_as=f"generate:{desc}") if TESTCASE_CALLBACKS: self.conjecture_data._observability_args[desc] = to_jsonable(result) diff --git a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/utils.py b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/utils.py index b2a7661cd6..bd56d2287e 100644 --- a/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/utils.py +++ b/contrib/python/hypothesis/py3/hypothesis/strategies/_internal/utils.py @@ -184,5 +184,11 @@ def to_jsonable(obj: object) -> object: if (pyd := sys.modules.get("pydantic")) and isinstance(obj, pyd.BaseModel): return to_jsonable(obj.model_dump()) + # Hey, might as well try calling a .to_json() method - it works for Pandas! + try: + return to_jsonable(obj.to_json()) # type: ignore + except Exception: + pass + # If all else fails, we'll just pretty-print as a string. return pretty(obj) diff --git a/contrib/python/hypothesis/py3/hypothesis/version.py b/contrib/python/hypothesis/py3/hypothesis/version.py index c06671451d..dc8e1e70f0 100644 --- a/contrib/python/hypothesis/py3/hypothesis/version.py +++ b/contrib/python/hypothesis/py3/hypothesis/version.py @@ -8,5 +8,5 @@ # v. 2.0. If a copy of the MPL was not distributed with this file, You can # obtain one at https://mozilla.org/MPL/2.0/. -__version_info__ = (6, 93, 0) +__version_info__ = (6, 93, 2) __version__ = ".".join(map(str, __version_info__)) diff --git a/contrib/python/hypothesis/py3/ya.make b/contrib/python/hypothesis/py3/ya.make index 729a032497..3e25d0b11c 100644 --- a/contrib/python/hypothesis/py3/ya.make +++ b/contrib/python/hypothesis/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(6.93.0) +VERSION(6.93.2) LICENSE(MPL-2.0) diff --git a/yt/cpp/mapreduce/http/context.cpp b/yt/cpp/mapreduce/http/context.cpp index d158a55195..18d564fe09 100644 --- a/yt/cpp/mapreduce/http/context.cpp +++ b/yt/cpp/mapreduce/http/context.cpp @@ -16,11 +16,6 @@ bool operator==(const TClientContext& lhs, const TClientContext& rhs) lhs.ProxyAddress == rhs.ProxyAddress; } -bool operator!=(const TClientContext& lhs, const TClientContext& rhs) -{ - return !(rhs == lhs); -} - //////////////////////////////////////////////////////////////////////////////// } // namespace NYT diff --git a/yt/cpp/mapreduce/http/context.h b/yt/cpp/mapreduce/http/context.h index 9c730f1c3a..3bae208279 100644 --- a/yt/cpp/mapreduce/http/context.h +++ b/yt/cpp/mapreduce/http/context.h @@ -25,7 +25,6 @@ struct TClientContext }; bool operator==(const TClientContext& lhs, const TClientContext& rhs); -bool operator!=(const TClientContext& lhs, const TClientContext& rhs); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/cpp/mapreduce/interface/io.h b/yt/cpp/mapreduce/interface/io.h index 9a2f2bf344..8497c8aae2 100644 --- a/yt/cpp/mapreduce/interface/io.h +++ b/yt/cpp/mapreduce/interface/io.h @@ -300,12 +300,6 @@ public: return Reader_ == it.Reader_; } - /// Inequality operator. - bool operator!=(const TTableReaderIterator& it) const - { - return Reader_ != it.Reader_; - } - /// Dereference operator. TTableReader<T>& operator*() { diff --git a/yt/yt/client/chunk_client/chunk_replica-inl.h b/yt/yt/client/chunk_client/chunk_replica-inl.h index 27b745feaf..fec61f2711 100644 --- a/yt/yt/client/chunk_client/chunk_replica-inl.h +++ b/yt/yt/client/chunk_client/chunk_replica-inl.h @@ -157,16 +157,6 @@ Y_FORCE_INLINE TChunkIdWithIndex::TChunkIdWithIndex(TChunkId id, int replicaInde , ReplicaIndex(replicaIndex) { } -Y_FORCE_INLINE bool operator==(const TChunkIdWithIndex& lhs, const TChunkIdWithIndex& rhs) -{ - return lhs.Id == rhs.Id && lhs.ReplicaIndex == rhs.ReplicaIndex; -} - -Y_FORCE_INLINE bool operator!=(const TChunkIdWithIndex& lhs, const TChunkIdWithIndex& rhs) -{ - return !(lhs == rhs); -} - Y_FORCE_INLINE bool operator<(const TChunkIdWithIndex& lhs, const TChunkIdWithIndex& rhs) { if (lhs.Id == rhs.Id) { @@ -192,17 +182,6 @@ Y_FORCE_INLINE TChunkIdWithIndexes::TChunkIdWithIndexes(TChunkId id, int replica , MediumIndex(mediumIndex) { } -Y_FORCE_INLINE bool operator==(const TChunkIdWithIndexes& lhs, const TChunkIdWithIndexes& rhs) -{ - return static_cast<const TChunkIdWithIndex&>(lhs) == static_cast<const TChunkIdWithIndex&>(rhs) && - lhs.MediumIndex == rhs.MediumIndex; -} - -Y_FORCE_INLINE bool operator!=(const TChunkIdWithIndexes& lhs, const TChunkIdWithIndexes& rhs) -{ - return !(lhs == rhs); -} - Y_FORCE_INLINE bool operator<(const TChunkIdWithIndexes& lhs, const TChunkIdWithIndexes& rhs) { const auto& lhs_ = static_cast<const TChunkIdWithIndex&>(lhs); diff --git a/yt/yt/client/chunk_client/chunk_replica.h b/yt/yt/client/chunk_client/chunk_replica.h index 081bf1f8f8..11ff43d52c 100644 --- a/yt/yt/client/chunk_client/chunk_replica.h +++ b/yt/yt/client/chunk_client/chunk_replica.h @@ -127,6 +127,8 @@ struct TChunkIdWithIndex TChunkId Id; int ReplicaIndex; + bool operator==(const TChunkIdWithIndex& other) const = default; + void Save(TStreamSaveContext& context) const; void Load(TStreamLoadContext& context); }; @@ -142,24 +144,26 @@ struct TChunkIdWithIndexes int MediumIndex; + bool operator==(const TChunkIdWithIndexes& other) const = default; + void Save(TStreamSaveContext& context) const; void Load(TStreamLoadContext& context); }; //////////////////////////////////////////////////////////////////////////////// -bool operator==(const TChunkIdWithIndex& lhs, const TChunkIdWithIndex& rhs); -bool operator!=(const TChunkIdWithIndex& lhs, const TChunkIdWithIndex& rhs); bool operator<(const TChunkIdWithIndex& lhs, const TChunkIdWithIndex& rhs); TString ToString(const TChunkIdWithIndex& id); -bool operator==(const TChunkIdWithIndexes& lhs, const TChunkIdWithIndexes& rhs); -bool operator!=(const TChunkIdWithIndexes& lhs, const TChunkIdWithIndexes& rhs); +//////////////////////////////////////////////////////////////////////////////// + bool operator<(const TChunkIdWithIndexes& lhs, const TChunkIdWithIndexes& rhs); TString ToString(const TChunkIdWithIndexes& id); +//////////////////////////////////////////////////////////////////////////////// + //! Returns |true| iff this is an artifact chunk. bool IsArtifactChunkId(TChunkId id); diff --git a/yt/yt/client/chunk_client/data_statistics.cpp b/yt/yt/client/chunk_client/data_statistics.cpp index 5fdcf5dfa9..1dbc2ad520 100644 --- a/yt/yt/client/chunk_client/data_statistics.cpp +++ b/yt/yt/client/chunk_client/data_statistics.cpp @@ -68,7 +68,7 @@ TDataStatistics& operator += (TDataStatistics& lhs, const TDataStatistics& rhs) return lhs; } -TDataStatistics operator + (const TDataStatistics& lhs, const TDataStatistics& rhs) +TDataStatistics operator + (const TDataStatistics& lhs, const TDataStatistics& rhs) { auto result = lhs; result += rhs; @@ -95,11 +95,6 @@ bool operator == (const TDataStatistics& lhs, const TDataStatistics& rhs) lhs.unmerged_data_weight() == rhs.unmerged_data_weight()); } -bool operator != (const TDataStatistics& lhs, const TDataStatistics& rhs) -{ - return !(lhs == rhs); -} - void Serialize(const TDataStatistics& statistics, NYson::IYsonConsumer* consumer) { // TODO(max42): replace all Item with OptionalItem in order to expose only meaningful diff --git a/yt/yt/client/chunk_client/data_statistics.h b/yt/yt/client/chunk_client/data_statistics.h index 4fc0b210c8..880a510c59 100644 --- a/yt/yt/client/chunk_client/data_statistics.h +++ b/yt/yt/client/chunk_client/data_statistics.h @@ -24,7 +24,6 @@ TDataStatistics& operator += (TDataStatistics& lhs, const TDataStatistics& rhs); TDataStatistics operator + (const TDataStatistics& lhs, const TDataStatistics& rhs); bool operator == (const TDataStatistics& lhs, const TDataStatistics& rhs); -bool operator != (const TDataStatistics& lhs, const TDataStatistics& rhs); void Serialize(const TDataStatistics& statistics, NYson::IYsonConsumer* consumer); diff --git a/yt/yt/client/driver/proxy_discovery_cache.cpp b/yt/yt/client/driver/proxy_discovery_cache.cpp index 1a58eeaa5d..ef32e71b0f 100644 --- a/yt/yt/client/driver/proxy_discovery_cache.cpp +++ b/yt/yt/client/driver/proxy_discovery_cache.cpp @@ -23,21 +23,6 @@ using namespace NApi::NRpcProxy; //////////////////////////////////////////////////////////////////////////////// -bool TProxyDiscoveryRequest::operator==(const TProxyDiscoveryRequest& other) const -{ - return - Type == other.Type && - Role == other.Role && - AddressType == other.AddressType && - NetworkName == other.NetworkName && - IgnoreBalancers == other.IgnoreBalancers; -} - -bool TProxyDiscoveryRequest::operator!=(const TProxyDiscoveryRequest& other) const -{ - return !(*this == other); -} - TProxyDiscoveryRequest::operator size_t() const { return MultiHash( diff --git a/yt/yt/client/driver/proxy_discovery_cache.h b/yt/yt/client/driver/proxy_discovery_cache.h index f99b75cefa..6dfb29c053 100644 --- a/yt/yt/client/driver/proxy_discovery_cache.h +++ b/yt/yt/client/driver/proxy_discovery_cache.h @@ -20,8 +20,7 @@ struct TProxyDiscoveryRequest TString NetworkName = NApi::NRpcProxy::DefaultNetworkName; bool IgnoreBalancers = false; - bool operator==(const TProxyDiscoveryRequest& other) const; - bool operator!=(const TProxyDiscoveryRequest& other) const; + bool operator==(const TProxyDiscoveryRequest& other) const = default; operator size_t() const; }; diff --git a/yt/yt/client/node_tracker_client/node_directory.cpp b/yt/yt/client/node_tracker_client/node_directory.cpp index ab6992b418..8388b6a302 100644 --- a/yt/yt/client/node_tracker_client/node_directory.cpp +++ b/yt/yt/client/node_tracker_client/node_directory.cpp @@ -371,11 +371,6 @@ bool operator == (const TNodeDescriptor& lhs, const TNodeDescriptor& rhs) GetSortedTags(lhs.GetTags()) == GetSortedTags(rhs.GetTags()); } -bool operator != (const TNodeDescriptor& lhs, const TNodeDescriptor& rhs) -{ - return !(lhs == rhs); -} - bool operator == (const TNodeDescriptor& lhs, const NProto::TNodeDescriptor& rhs) { if (std::ssize(lhs.Addresses()) != rhs.addresses().entries_size()) { @@ -421,11 +416,6 @@ bool operator == (const TNodeDescriptor& lhs, const NProto::TNodeDescriptor& rhs return true; } -bool operator != (const TNodeDescriptor& lhs, const NProto::TNodeDescriptor& rhs) -{ - return !(lhs == rhs); -} - //////////////////////////////////////////////////////////////////////////////// void TNodeDirectory::MergeFrom(const NProto::TNodeDirectory& source) diff --git a/yt/yt/client/node_tracker_client/node_directory.h b/yt/yt/client/node_tracker_client/node_directory.h index a76245fd8b..8e92564179 100644 --- a/yt/yt/client/node_tracker_client/node_directory.h +++ b/yt/yt/client/node_tracker_client/node_directory.h @@ -85,10 +85,7 @@ const TNodeDescriptor& NullNodeDescriptor(); //////////////////////////////////////////////////////////////////////////////// bool operator == (const TNodeDescriptor& lhs, const TNodeDescriptor& rhs); -bool operator != (const TNodeDescriptor& lhs, const TNodeDescriptor& rhs); - bool operator == (const TNodeDescriptor& lhs, const NProto::TNodeDescriptor& rhs); -bool operator != (const TNodeDescriptor& lhs, const NProto::TNodeDescriptor& rhs); void FormatValue(TStringBuilderBase* builder, const TNodeDescriptor& descriptor, TStringBuf spec); TString ToString(const TNodeDescriptor& descriptor); diff --git a/yt/yt/client/object_client/public.cpp b/yt/yt/client/object_client/public.cpp index 1a780352e5..11eb2f1a6b 100644 --- a/yt/yt/client/object_client/public.cpp +++ b/yt/yt/client/object_client/public.cpp @@ -52,11 +52,6 @@ bool operator == (const TVersionedObjectId& lhs, const TVersionedObjectId& rhs) return memcmp(&lhs, &rhs, sizeof (TVersionedObjectId)) == 0; } -bool operator != (const TVersionedObjectId& lhs, const TVersionedObjectId& rhs) -{ - return !(lhs == rhs); -} - bool operator < (const TVersionedObjectId& lhs, const TVersionedObjectId& rhs) { return memcmp(&lhs, &rhs, sizeof (TVersionedObjectId)) < 0; diff --git a/yt/yt/client/object_client/public.h b/yt/yt/client/object_client/public.h index cfc7d60105..b8a8d1ae7b 100644 --- a/yt/yt/client/object_client/public.h +++ b/yt/yt/client/object_client/public.h @@ -391,9 +391,6 @@ TString ToString(const TVersionedObjectId& id); //! Compares TVersionedNodeId s for equality. bool operator == (const TVersionedObjectId& lhs, const TVersionedObjectId& rhs); -//! Compares TVersionedNodeId s for inequality. -bool operator != (const TVersionedObjectId& lhs, const TVersionedObjectId& rhs); - //! Compares TVersionedNodeId s for "less than". bool operator < (const TVersionedObjectId& lhs, const TVersionedObjectId& rhs); diff --git a/yt/yt/client/query_client/query_builder.cpp b/yt/yt/client/query_client/query_builder.cpp index b6658e1076..1608cd32c0 100644 --- a/yt/yt/client/query_client/query_builder.cpp +++ b/yt/yt/client/query_client/query_builder.cpp @@ -61,6 +61,11 @@ void TQueryBuilder::AddGroupByExpression(TString expression, TString alias) }); } +void TQueryBuilder::AddHavingConjunct(TString expression) +{ + HavingConjuncts_.push_back(std::move(expression)); +} + void TQueryBuilder::AddOrderByExpression(TString expression) { OrderByEntries_.push_back(TOrderByEntry{ @@ -112,16 +117,24 @@ TString TQueryBuilder::Build() parts.push_back(JoinSeq(" AND ", Parenthesize(WhereConjuncts_))); } - if (!OrderByEntries_.empty()) { - parts.push_back("ORDER BY"); - parts.push_back(JoinSeq(", ", OrderByEntries_)); - } - if (!GroupByEntries_.empty()) { parts.push_back("GROUP BY"); parts.push_back(JoinSeq(", ", GroupByEntries_)); } + if (!HavingConjuncts_.empty()) { + if (GroupByEntries_.empty()) { + THROW_ERROR_EXCEPTION("Having without group by is not valid"); + } + parts.push_back("HAVING"); + parts.push_back(JoinSeq(" AND ", Parenthesize(HavingConjuncts_))); + } + + if (!OrderByEntries_.empty()) { + parts.push_back("ORDER BY"); + parts.push_back(JoinSeq(", ", OrderByEntries_)); + } + if (Limit_) { parts.push_back(Format("LIMIT %v", *Limit_)); } diff --git a/yt/yt/client/query_client/query_builder.h b/yt/yt/client/query_client/query_builder.h index 1548e749a2..c965337576 100644 --- a/yt/yt/client/query_client/query_builder.h +++ b/yt/yt/client/query_client/query_builder.h @@ -28,6 +28,8 @@ public: void AddGroupByExpression(TString expression); void AddGroupByExpression(TString expression, TString alias); + void AddHavingConjunct(TString expression); + void AddOrderByExpression(TString expression); void AddOrderByExpression(TString expression, std::optional<EOrderByDirection> direction); @@ -57,6 +59,7 @@ private: std::vector<TString> WhereConjuncts_; std::vector<TOrderByEntry> OrderByEntries_; std::vector<TEntryWithAlias> GroupByEntries_; + std::vector<TString> HavingConjuncts_; std::optional<i64> Limit_; private: diff --git a/yt/yt/client/scheduler/public.h b/yt/yt/client/scheduler/public.h index 97e408f835..4fa09f81e7 100644 --- a/yt/yt/client/scheduler/public.h +++ b/yt/yt/client/scheduler/public.h @@ -132,7 +132,7 @@ DEFINE_ENUM(EAbortReason, ((JobSettlementTimedOut) ( 50)) ((NonexistentPoolTree) ( 51)) ((WrongSchedulingSegmentModule) ( 52)) - ((NodeUnresolved) ( 53)) + ((UnresolvedNodeId) ( 53)) ((SchedulingFirst) (100)) ((SchedulingTimeout) (101)) ((SchedulingResourceOvercommit) (102)) diff --git a/yt/yt/client/security_client/acl.cpp b/yt/yt/client/security_client/acl.cpp index ee06bafcd0..5169d3bf5f 100644 --- a/yt/yt/client/security_client/acl.cpp +++ b/yt/yt/client/security_client/acl.cpp @@ -25,22 +25,6 @@ TSerializableAccessControlEntry::TSerializableAccessControlEntry( , InheritanceMode(inheritanceMode) { } -bool operator == (const TSerializableAccessControlEntry& lhs, const TSerializableAccessControlEntry& rhs) -{ - return - lhs.Action == rhs.Action && - lhs.Subjects == rhs.Subjects && - lhs.Permissions == rhs.Permissions && - lhs.InheritanceMode == rhs.InheritanceMode && - lhs.Columns == rhs.Columns && - lhs.Vital == rhs.Vital; -} - -bool operator != (const TSerializableAccessControlEntry& lhs, const TSerializableAccessControlEntry& rhs) -{ - return !(lhs == rhs); -} - // NB(levysotsky): We don't use TYsonStruct here // because we want to mirror the TAccessControlList structure, // and a vector of TYsonStruct-s cannot be declared (as it has no move constructor). @@ -187,11 +171,6 @@ bool operator == (const TSerializableAccessControlList& lhs, const TSerializable return lhs.Entries == rhs.Entries; } -bool operator != (const TSerializableAccessControlList& lhs, const TSerializableAccessControlList& rhs) -{ - return !(lhs == rhs); -} - void Serialize(const TSerializableAccessControlList& acl, NYson::IYsonConsumer* consumer) { NYTree::Serialize(acl.Entries, consumer); diff --git a/yt/yt/client/security_client/acl.h b/yt/yt/client/security_client/acl.h index 5615dff7fa..cbc1d6cb3d 100644 --- a/yt/yt/client/security_client/acl.h +++ b/yt/yt/client/security_client/acl.h @@ -35,10 +35,9 @@ struct TSerializableAccessControlEntry // Used only for persistence in operation controller. Does not work with Columns and Vital fields. void Persist(const TStreamPersistenceContext& context); -}; -bool operator == (const TSerializableAccessControlEntry& lhs, const TSerializableAccessControlEntry& rhs); -bool operator != (const TSerializableAccessControlEntry& lhs, const TSerializableAccessControlEntry& rhs); + bool operator==(const TSerializableAccessControlEntry& other) const = default; +}; void Serialize(const TSerializableAccessControlEntry& ace, NYson::IYsonConsumer* consumer); void Deserialize(TSerializableAccessControlEntry& ace, NYTree::INodePtr node); @@ -52,7 +51,6 @@ struct TSerializableAccessControlList }; bool operator == (const TSerializableAccessControlList& lhs, const TSerializableAccessControlList& rhs); -bool operator != (const TSerializableAccessControlList& lhs, const TSerializableAccessControlList& rhs); void Serialize(const TSerializableAccessControlList& acl, NYson::IYsonConsumer* consumer); void Deserialize(TSerializableAccessControlList& acl, NYTree::INodePtr node); diff --git a/yt/yt/client/table_client/column_sort_schema.cpp b/yt/yt/client/table_client/column_sort_schema.cpp index af14339f88..f2263b2a56 100644 --- a/yt/yt/client/table_client/column_sort_schema.cpp +++ b/yt/yt/client/table_client/column_sort_schema.cpp @@ -56,16 +56,6 @@ void Deserialize(TColumnSortSchema& schema, TYsonPullParserCursor* cursor) Deserialize(schema, ExtractTo<INodePtr>(cursor)); } -bool operator == (const TColumnSortSchema& lhs, const TColumnSortSchema& rhs) -{ - return lhs.Name == rhs.Name && lhs.SortOrder == rhs.SortOrder; -} - -bool operator != (const TColumnSortSchema& lhs, const TColumnSortSchema& rhs) -{ - return !(lhs == rhs); -} - //////////////////////////////////////////////////////////////////////////////// void ValidateSortColumns(const std::vector<TColumnSortSchema>& columns) diff --git a/yt/yt/client/table_client/column_sort_schema.h b/yt/yt/client/table_client/column_sort_schema.h index cb9e7fc114..ed7830d779 100644 --- a/yt/yt/client/table_client/column_sort_schema.h +++ b/yt/yt/client/table_client/column_sort_schema.h @@ -12,6 +12,8 @@ struct TColumnSortSchema TString Name; ESortOrder SortOrder; + bool operator==(const TColumnSortSchema& other) const = default; + void Persist(const TStreamPersistenceContext& context); }; @@ -19,9 +21,6 @@ void Serialize(const TColumnSortSchema& schema, NYson::IYsonConsumer* consumer); void Deserialize(TColumnSortSchema& schema, NYTree::INodePtr node); void Deserialize(TColumnSortSchema& schema, NYson::TYsonPullParserCursor* cursor); -bool operator == (const TColumnSortSchema& lhs, const TColumnSortSchema& rhs); -bool operator != (const TColumnSortSchema& lhs, const TColumnSortSchema& rhs); - //////////////////////////////////////////////////////////////////////////////// void ValidateSortColumns(const std::vector<TColumnSortSchema>& columns); diff --git a/yt/yt/client/table_client/key.cpp b/yt/yt/client/table_client/key.cpp index 6710dd1e81..895ec5d5ac 100644 --- a/yt/yt/client/table_client/key.cpp +++ b/yt/yt/client/table_client/key.cpp @@ -125,11 +125,6 @@ bool operator==(const TKey& lhs, const TKey& rhs) return CompareValueRanges(lhs.Elements(), rhs.Elements()) == 0; } -bool operator!=(const TKey& lhs, const TKey& rhs) -{ - return !(lhs == rhs); -} - void FormatValue(TStringBuilderBase* builder, const TKey& key, TStringBuf /*format*/) { if (key) { diff --git a/yt/yt/client/table_client/key.h b/yt/yt/client/table_client/key.h index 58f6bfd6e0..9fbca56154 100644 --- a/yt/yt/client/table_client/key.h +++ b/yt/yt/client/table_client/key.h @@ -49,7 +49,6 @@ private: //////////////////////////////////////////////////////////////////////////////// bool operator==(const TKey& lhs, const TKey& rhs); -bool operator!=(const TKey& lhs, const TKey& rhs); void FormatValue(TStringBuilderBase* builder, const TKey& key, TStringBuf format); TString ToString(const TKey& key); diff --git a/yt/yt/client/table_client/logical_type.cpp b/yt/yt/client/table_client/logical_type.cpp index 937d3365e8..ea1faec57d 100644 --- a/yt/yt/client/table_client/logical_type.cpp +++ b/yt/yt/client/table_client/logical_type.cpp @@ -971,11 +971,6 @@ TLogicalTypePtr DenullifyLogicalType(const TLogicalTypePtr& type) return detagged; } -bool operator != (const TLogicalType& lhs, const TLogicalType& rhs) -{ - return !(lhs == rhs); -} - bool operator == (const std::vector<TLogicalTypePtr>& lhs, const std::vector<TLogicalTypePtr>& rhs) { if (lhs.size() != rhs.size()) { diff --git a/yt/yt/client/table_client/logical_type.h b/yt/yt/client/table_client/logical_type.h index 686d449dc0..63750956f2 100644 --- a/yt/yt/client/table_client/logical_type.h +++ b/yt/yt/client/table_client/logical_type.h @@ -111,9 +111,7 @@ void PrintTo(const TLogicalType& type, std::ostream* os); void PrintTo(const TLogicalTypePtr& type, std::ostream* os); bool operator == (const TLogicalType& lhs, const TLogicalType& rhs); -bool operator != (const TLogicalType& lhs, const TLogicalType& rhs); bool operator == (const TLogicalTypePtr& lhs, const TLogicalTypePtr& rhs) = delete; -bool operator != (const TLogicalTypePtr& lhs, const TLogicalTypePtr& rhs) = delete; void ValidateLogicalType(const TComplexTypeFieldDescriptor& descriptor, std::optional<int> depthLimit = std::nullopt); diff --git a/yt/yt/client/table_client/public.h b/yt/yt/client/table_client/public.h index 8ecb077fba..eeb18fd506 100644 --- a/yt/yt/client/table_client/public.h +++ b/yt/yt/client/table_client/public.h @@ -93,7 +93,7 @@ constexpr i64 MaxAnyValueLength = 16_MB; constexpr i64 MaxCompositeValueLength = 16_MB; constexpr i64 MaxServerVersionedRowDataWeight = 512_MB; constexpr i64 MaxClientVersionedRowDataWeight = 128_MB; -constexpr int MaxKeyColumnCountInDynamicTable = 32; +constexpr int MaxKeyColumnCountInDynamicTable = 64; constexpr int MaxTimestampCountPerRow = std::numeric_limits<ui16>::max(); static_assert( @@ -420,6 +420,10 @@ DEFINE_ENUM(ESchemaCompatibility, static constexpr TMasterTableSchemaId NullTableSchemaId = TMasterTableSchemaId(); +using TDynamicTableKeyMask = ui64; + +static_assert(sizeof(TDynamicTableKeyMask) * 8 == MaxKeyColumnCountInDynamicTable); + //////////////////////////////////////////////////////////////////////////////// } // namespace NYT::NTableClient diff --git a/yt/yt/client/table_client/schema.cpp b/yt/yt/client/table_client/schema.cpp index 013b698a26..2717aaeb8a 100644 --- a/yt/yt/client/table_client/schema.cpp +++ b/yt/yt/client/table_client/schema.cpp @@ -1513,7 +1513,7 @@ void ValidateColumnSchema( "max", "first", "xdelta", - "_yt_replica_set", + "_yt_stored_replica_set", }; const auto& stableName = columnSchema.StableName(); diff --git a/yt/yt/client/table_client/unversioned_row.cpp b/yt/yt/client/table_client/unversioned_row.cpp index 296f9c7355..4b380ec571 100644 --- a/yt/yt/client/table_client/unversioned_row.cpp +++ b/yt/yt/client/table_client/unversioned_row.cpp @@ -439,11 +439,6 @@ bool operator == (const TUnversionedValue& lhs, const TUnversionedValue& rhs) return CompareRowValues(lhs, rhs) == 0; } -bool operator != (const TUnversionedValue& lhs, const TUnversionedValue& rhs) -{ - return CompareRowValues(lhs, rhs) != 0; -} - bool operator <= (const TUnversionedValue& lhs, const TUnversionedValue& rhs) { return CompareRowValues(lhs, rhs) <= 0; @@ -503,11 +498,6 @@ bool operator == (TUnversionedRow lhs, TUnversionedRow rhs) return CompareRows(lhs, rhs) == 0; } -bool operator != (TUnversionedRow lhs, TUnversionedRow rhs) -{ - return CompareRows(lhs, rhs) != 0; -} - bool operator <= (TUnversionedRow lhs, TUnversionedRow rhs) { return CompareRows(lhs, rhs) <= 0; @@ -535,11 +525,6 @@ bool operator == (TUnversionedRow lhs, const TUnversionedOwningRow& rhs) return CompareRows(lhs, rhs) == 0; } -bool operator != (TUnversionedRow lhs, const TUnversionedOwningRow& rhs) -{ - return CompareRows(lhs, rhs) != 0; -} - bool operator <= (TUnversionedRow lhs, const TUnversionedOwningRow& rhs) { return CompareRows(lhs, rhs) <= 0; diff --git a/yt/yt/client/table_client/unversioned_row.h b/yt/yt/client/table_client/unversioned_row.h index 0fc6420396..ccfa9e691d 100644 --- a/yt/yt/client/table_client/unversioned_row.h +++ b/yt/yt/client/table_client/unversioned_row.h @@ -235,7 +235,6 @@ int CompareRowValues(const TUnversionedValue& lhs, const TUnversionedValue& rhs) //! Derived comparison operators. //! Note that these ignore flags. bool operator == (const TUnversionedValue& lhs, const TUnversionedValue& rhs); -bool operator != (const TUnversionedValue& lhs, const TUnversionedValue& rhs); bool operator <= (const TUnversionedValue& lhs, const TUnversionedValue& rhs); bool operator < (const TUnversionedValue& lhs, const TUnversionedValue& rhs); bool operator >= (const TUnversionedValue& lhs, const TUnversionedValue& rhs); @@ -260,7 +259,6 @@ int CompareRows( //! Derived comparison operators. //! Note that these ignore aggregate flags. bool operator == (TUnversionedRow lhs, TUnversionedRow rhs); -bool operator != (TUnversionedRow lhs, TUnversionedRow rhs); bool operator <= (TUnversionedRow lhs, TUnversionedRow rhs); bool operator < (TUnversionedRow lhs, TUnversionedRow rhs); bool operator >= (TUnversionedRow lhs, TUnversionedRow rhs); diff --git a/yt/yt/client/unittests/query_builder_ut.cpp b/yt/yt/client/unittests/query_builder_ut.cpp index 30b8045b5c..e47027b23f 100644 --- a/yt/yt/client/unittests/query_builder_ut.cpp +++ b/yt/yt/client/unittests/query_builder_ut.cpp @@ -27,6 +27,9 @@ TEST(TQueryBuilderTest, Simple) b.AddGroupByExpression("x + y * z", "group_expr"); b.AddGroupByExpression("x - 1"); + b.AddHavingConjunct("group_expr > 42"); + b.AddHavingConjunct("group_expr < 420"); + b.SetLimit(43); EXPECT_EQ(xIndex, 0); @@ -37,8 +40,9 @@ TEST(TQueryBuilderTest, Simple) "(x), (y) AS y_alias, (z) " "FROM [//t] " "WHERE (x > y_alias) AND (y = 177 OR y % 2 = 0) " - "ORDER BY (z) ASC, (x) DESC, (x + y) DESC, (z - y_alias) " "GROUP BY (x + y * z) AS group_expr, (x - 1) " + "HAVING (group_expr > 42) AND (group_expr < 420) " + "ORDER BY (z) ASC, (x) DESC, (x + y) DESC, (z - y_alias) " "LIMIT 43"); } diff --git a/yt/yt/core/actions/callback_internal.h b/yt/yt/core/actions/callback_internal.h index 7eab2be430..735e350885 100644 --- a/yt/yt/core/actions/callback_internal.h +++ b/yt/yt/core/actions/callback_internal.h @@ -65,7 +65,7 @@ public: //! Returns |true| iff this callback is not equal to the other (which may be null). bool operator != (const TCallbackBase& other) const; #else - bool operator== (const TCallbackBase&) const = default; + bool operator== (const TCallbackBase& other) const = default; #endif protected: diff --git a/yt/yt/core/actions/future-inl.h b/yt/yt/core/actions/future-inl.h index 5073d404ba..51289611b0 100644 --- a/yt/yt/core/actions/future-inl.h +++ b/yt/yt/core/actions/future-inl.h @@ -939,11 +939,6 @@ inline bool operator==(const TCancelable& lhs, const TCancelable& rhs) return lhs.Impl_ == rhs.Impl_; } -inline bool operator!=(const TCancelable& lhs, const TCancelable& rhs) -{ - return !(lhs == rhs); -} - inline void swap(TCancelable& lhs, TCancelable& rhs) { using std::swap; @@ -957,12 +952,6 @@ bool operator==(const TFuture<T>& lhs, const TFuture<T>& rhs) } template <class T> -bool operator!=(const TFuture<T>& lhs, const TFuture<T>& rhs) -{ - return !(lhs == rhs); -} - -template <class T> void swap(TFuture<T>& lhs, TFuture<T>& rhs) { using std::swap; @@ -976,12 +965,6 @@ bool operator==(const TPromise<T>& lhs, const TPromise<T>& rhs) } template <class T> -bool operator!=(const TPromise<T>& lhs, const TPromise<T>& rhs) -{ - return *(lhs == rhs); -} - -template <class T> void swap(TPromise<T>& lhs, TPromise<T>& rhs) { using std::swap; diff --git a/yt/yt/core/actions/future.h b/yt/yt/core/actions/future.h index aa31d8e690..6656dd47e9 100644 --- a/yt/yt/core/actions/future.h +++ b/yt/yt/core/actions/future.h @@ -97,15 +97,11 @@ template <class T> template <class T> bool operator==(const TFuture<T>& lhs, const TFuture<T>& rhs); template <class T> -bool operator!=(const TFuture<T>& lhs, const TFuture<T>& rhs); -template <class T> void swap(TFuture<T>& lhs, TFuture<T>& rhs); template <class T> bool operator==(const TPromise<T>& lhs, const TPromise<T>& rhs); template <class T> -bool operator!=(const TPromise<T>& lhs, const TPromise<T>& rhs); -template <class T> void swap(TPromise<T>& lhs, TPromise<T>& rhs); //////////////////////////////////////////////////////////////////////////////// @@ -153,7 +149,6 @@ private: TIntrusivePtr<NYT::NDetail::TCancelableStateBase> Impl_; friend bool operator==(const TCancelable& lhs, const TCancelable& rhs); - friend bool operator!=(const TCancelable& lhs, const TCancelable& rhs); friend void swap(TCancelable& lhs, TCancelable& rhs); template <class U> friend struct ::THash; @@ -322,8 +317,6 @@ protected: template <class U> friend bool operator==(const TFuture<U>& lhs, const TFuture<U>& rhs); template <class U> - friend bool operator!=(const TFuture<U>& lhs, const TFuture<U>& rhs); - template <class U> friend void swap(TFuture<U>& lhs, TFuture<U>& rhs); template <class U> friend struct ::THash; @@ -486,8 +479,6 @@ protected: template <class U> friend bool operator==(const TPromise<U>& lhs, const TPromise<U>& rhs); template <class U> - friend bool operator!=(const TPromise<U>& lhs, const TPromise<U>& rhs); - template <class U> friend void swap(TPromise<U>& lhs, TPromise<U>& rhs); template <class U> friend struct ::hash; diff --git a/yt/yt/core/concurrency/retrying_periodic_executor.cpp b/yt/yt/core/concurrency/retrying_periodic_executor.cpp index 3be49c6001..3ac46ea6d1 100644 --- a/yt/yt/core/concurrency/retrying_periodic_executor.cpp +++ b/yt/yt/core/concurrency/retrying_periodic_executor.cpp @@ -23,7 +23,10 @@ TRetryingInvocationTimePolicy::TRetryingInvocationTimePolicy( const TOptions& options) : TDefaultInvocationTimePolicy(options) , Backoff_(options) -{ } +{ + CachedBackoffDuration_.store(options.MinBackoff, std::memory_order::relaxed); + CachedBackoffJitter_.store(options.BackoffJitter,std::memory_order::relaxed); +} void TRetryingInvocationTimePolicy::ProcessResult(TError result) { @@ -73,6 +76,10 @@ void TRetryingInvocationTimePolicy::SetOptions( backoffOptions->BackoffJitter, std::memory_order::relaxed); + if (!IsInBackoffMode()) { + Backoff_.Restart(); + } + Backoff_.UpdateOptions(*backoffOptions); } } diff --git a/yt/yt/core/misc/arithmetic_formula.cpp b/yt/yt/core/misc/arithmetic_formula.cpp index 2134f4970a..283befb37a 100644 --- a/yt/yt/core/misc/arithmetic_formula.cpp +++ b/yt/yt/core/misc/arithmetic_formula.cpp @@ -891,11 +891,6 @@ bool TBooleanFormulaTags::operator==(const TBooleanFormulaTags& other) const return Tags_ == other.Tags_; } -bool TBooleanFormulaTags::operator!=(const TBooleanFormulaTags& other) const -{ - return !operator==(other); -} - void Serialize(const TBooleanFormulaTags& tags, NYson::IYsonConsumer* consumer) { BuildYsonFluently(consumer) diff --git a/yt/yt/core/misc/arithmetic_formula.h b/yt/yt/core/misc/arithmetic_formula.h index 09f99767ab..c2eb3cd2e0 100644 --- a/yt/yt/core/misc/arithmetic_formula.h +++ b/yt/yt/core/misc/arithmetic_formula.h @@ -86,7 +86,6 @@ public: void Load(TStreamLoadContext& context); bool operator==(const TBooleanFormulaTags& other) const; - bool operator!=(const TBooleanFormulaTags& other) const; private: THashSet<TString> Tags_; diff --git a/yt/yt/core/misc/error.cpp b/yt/yt/core/misc/error.cpp index 2740ae34c9..2c3b79db5c 100644 --- a/yt/yt/core/misc/error.cpp +++ b/yt/yt/core/misc/error.cpp @@ -1022,11 +1022,6 @@ bool operator == (const TError& lhs, const TError& rhs) lhs.InnerErrors() == rhs.InnerErrors(); } -bool operator != (const TError& lhs, const TError& rhs) -{ - return !(lhs == rhs); -} - void FormatValue(TStringBuilderBase* builder, const TError& error, TStringBuf /*spec*/) { AppendError(builder, error, 0); diff --git a/yt/yt/core/misc/error.h b/yt/yt/core/misc/error.h index fe1b928476..0d2b4bd456 100644 --- a/yt/yt/core/misc/error.h +++ b/yt/yt/core/misc/error.h @@ -235,7 +235,6 @@ private: void MakeMutable(); friend bool operator == (const TError& lhs, const TError& rhs); - friend bool operator != (const TError& lhs, const TError& rhs); friend void ToProto(NProto::TError* protoError, const TError& error); friend void FromProto(TError* error, const NProto::TError& protoError); @@ -250,7 +249,6 @@ private: }; bool operator == (const TError& lhs, const TError& rhs); -bool operator != (const TError& lhs, const TError& rhs); void ToProto(NProto::TError* protoError, const TError& error); void FromProto(TError* error, const NProto::TError& protoError); diff --git a/yt/yt/core/misc/hazard_ptr-inl.h b/yt/yt/core/misc/hazard_ptr-inl.h index 4fe703389e..ab9ab05a58 100644 --- a/yt/yt/core/misc/hazard_ptr-inl.h +++ b/yt/yt/core/misc/hazard_ptr-inl.h @@ -179,18 +179,12 @@ THazardPtr<T>::THazardPtr(T* ptr, std::atomic<void*>* hazardPtr) //////////////////////////////////////////////////////////////////////////////// -template <class U> -bool operator==(const THazardPtr<U>& lhs, const U* rhs) +template <class T> +bool operator==(const THazardPtr<T>& lhs, const T* rhs) { return lhs.Get() == rhs; } -template <class U> -bool operator!=(const THazardPtr<U>& lhs, const U* rhs) -{ - return lhs.Get() != rhs; -} - //////////////////////////////////////////////////////////////////////////////// } // namespace NYT diff --git a/yt/yt/core/misc/hazard_ptr.h b/yt/yt/core/misc/hazard_ptr.h index 431d09c208..df31004c03 100644 --- a/yt/yt/core/misc/hazard_ptr.h +++ b/yt/yt/core/misc/hazard_ptr.h @@ -85,6 +85,11 @@ private: //////////////////////////////////////////////////////////////////////////////// +template <class T> +bool operator==(const THazardPtr<T>& lhs, const T* rhs); + +//////////////////////////////////////////////////////////////////////////////// + } // namespace NYT #define HAZARD_PTR_INL_H_ diff --git a/yt/yt/core/misc/persistent_queue-inl.h b/yt/yt/core/misc/persistent_queue-inl.h index f122be2d94..d94ee4948c 100644 --- a/yt/yt/core/misc/persistent_queue-inl.h +++ b/yt/yt/core/misc/persistent_queue-inl.h @@ -44,18 +44,6 @@ const T& TPersistentQueueIterator<T, ChunkSize>::operator*() const } template <class T, size_t ChunkSize> -bool TPersistentQueueIterator<T, ChunkSize>::operator==(const TPersistentQueueIterator& other) const -{ - return CurrentChunk_ == other.CurrentChunk_ && CurrentIndex_ == other.CurrentIndex_; -} - -template <class T, size_t ChunkSize> -bool TPersistentQueueIterator<T, ChunkSize>::operator!=(const TPersistentQueueIterator& other) const -{ - return !(*this == other); -} - -template <class T, size_t ChunkSize> TPersistentQueueIterator<T, ChunkSize>::TPersistentQueueIterator( TChunkPtr chunk, size_t index) diff --git a/yt/yt/core/misc/persistent_queue.h b/yt/yt/core/misc/persistent_queue.h index 32329cecf0..fb78fc37b5 100644 --- a/yt/yt/core/misc/persistent_queue.h +++ b/yt/yt/core/misc/persistent_queue.h @@ -41,8 +41,7 @@ public: const T& operator * () const; - bool operator == (const TPersistentQueueIterator& other) const; - bool operator != (const TPersistentQueueIterator& other) const; + bool operator==(const TPersistentQueueIterator& other) const = default; private: using TChunk = TPersistentQueueChunk<T, ChunkSize>; @@ -55,7 +54,6 @@ private: TChunkPtr CurrentChunk_; size_t CurrentIndex_ = 0; - }; template <class T, size_t ChunkSize> diff --git a/yt/yt/core/misc/ring_queue.h b/yt/yt/core/misc/ring_queue.h index e0463e2f45..471871603e 100644 --- a/yt/yt/core/misc/ring_queue.h +++ b/yt/yt/core/misc/ring_queue.h @@ -59,11 +59,6 @@ public: return Ptr_ == other.Ptr_; } - bool operator != (TIterator other) const - { - return Ptr_ != other.Ptr_; - } - TIterator& operator = (TIterator other) { Ptr_ = other.Ptr_; diff --git a/yt/yt/core/misc/serialize-inl.h b/yt/yt/core/misc/serialize-inl.h index 63db8744ac..cb1eb526bf 100644 --- a/yt/yt/core/misc/serialize-inl.h +++ b/yt/yt/core/misc/serialize-inl.h @@ -309,16 +309,6 @@ inline constexpr TEntitySerializationKey::TEntitySerializationKey(int index) : Index(index) { } -inline constexpr bool TEntitySerializationKey::operator == (TEntitySerializationKey rhs) const -{ - return Index == rhs.Index; -} - -inline constexpr bool TEntitySerializationKey::operator != (TEntitySerializationKey rhs) const -{ - return !(*this == rhs); -} - inline constexpr TEntitySerializationKey::operator bool() const { return Index != -1; @@ -1027,15 +1017,9 @@ public: return Index_ == other.Index_; } - bool operator != (const TIteratorWrapper& other) const - { - return Index_ != other.Index_; - } - private: const TIterators* const Iterators_; size_t Index_; - }; explicit TCollectionSorter(const T& set) diff --git a/yt/yt/core/misc/serialize.h b/yt/yt/core/misc/serialize.h index 751b5fcac3..539f980a91 100644 --- a/yt/yt/core/misc/serialize.h +++ b/yt/yt/core/misc/serialize.h @@ -217,8 +217,7 @@ struct TEntitySerializationKey constexpr TEntitySerializationKey(); constexpr explicit TEntitySerializationKey(int index); - constexpr bool operator == (TEntitySerializationKey rhs) const; - constexpr bool operator != (TEntitySerializationKey rhs) const; + constexpr bool operator==(const TEntitySerializationKey& other) const = default; constexpr explicit operator bool() const; diff --git a/yt/yt/core/net/address.cpp b/yt/yt/core/net/address.cpp index 7dc06ae06e..756be2a889 100644 --- a/yt/yt/core/net/address.cpp +++ b/yt/yt/core/net/address.cpp @@ -474,11 +474,6 @@ bool operator == (const TNetworkAddress& lhs, const TNetworkAddress& rhs) return rawLhs == rawRhs; } -bool operator != (const TNetworkAddress& lhs, const TNetworkAddress& rhs) -{ - return !(lhs == rhs); -} - //////////////////////////////////////////////////////////////////////////////// namespace { @@ -760,11 +755,6 @@ bool operator == (const TIP6Address& lhs, const TIP6Address& rhs) return ::memcmp(lhs.GetRawBytes(), rhs.GetRawBytes(), TIP6Address::ByteSize) == 0; } -bool operator != (const TIP6Address& lhs, const TIP6Address& rhs) -{ - return !(lhs == rhs); -} - TIP6Address operator|(const TIP6Address& lhs, const TIP6Address& rhs) { auto result = lhs; diff --git a/yt/yt/core/net/address.h b/yt/yt/core/net/address.h index 6d28a01efd..b9352f8c3f 100644 --- a/yt/yt/core/net/address.h +++ b/yt/yt/core/net/address.h @@ -96,7 +96,6 @@ struct TNetworkAddressFormatOptions TString ToString(const TNetworkAddress& address, const TNetworkAddressFormatOptions& options = {}); bool operator == (const TNetworkAddress& lhs, const TNetworkAddress& rhs); -bool operator != (const TNetworkAddress& lhs, const TNetworkAddress& rhs); //////////////////////////////////////////////////////////////////////////////// @@ -131,7 +130,6 @@ void FormatValue(TStringBuilderBase* builder, const TIP6Address& address, TStrin TString ToString(const TIP6Address& address); bool operator == (const TIP6Address& lhs, const TIP6Address& rhs); -bool operator != (const TIP6Address& lhs, const TIP6Address& rhs); TIP6Address operator & (const TIP6Address& lhs, const TIP6Address& rhs); TIP6Address operator | (const TIP6Address& lhs, const TIP6Address& rhs); diff --git a/yt/yt/core/rpc/protocol_version.cpp b/yt/yt/core/rpc/protocol_version.cpp index 80ef534547..66610f2687 100644 --- a/yt/yt/core/rpc/protocol_version.cpp +++ b/yt/yt/core/rpc/protocol_version.cpp @@ -34,16 +34,6 @@ TProtocolVersion TProtocolVersion::FromString(TStringBuf protocolVersionString) return result; } -bool operator == (const TProtocolVersion& lhs, const TProtocolVersion& rhs) -{ - return (lhs.Major == rhs.Major) && (lhs.Minor == rhs.Minor); -} - -bool operator != (const TProtocolVersion& lhs, const TProtocolVersion& rhs) -{ - return !(lhs == rhs); -} - void FormatValue(TStringBuilderBase* builder, TProtocolVersion version, TStringBuf /*spec*/) { builder->AppendFormat("%v.%v", version.Major, version.Minor); diff --git a/yt/yt/core/rpc/protocol_version.h b/yt/yt/core/rpc/protocol_version.h index 160d17047f..7d87d49597 100644 --- a/yt/yt/core/rpc/protocol_version.h +++ b/yt/yt/core/rpc/protocol_version.h @@ -13,12 +13,11 @@ struct TProtocolVersion int Major; int Minor; + bool operator==(const TProtocolVersion& other) const = default; + static TProtocolVersion FromString(TStringBuf protocolVersionString); }; -bool operator == (const TProtocolVersion& lhs, const TProtocolVersion& rhs); -bool operator != (const TProtocolVersion& lhs, const TProtocolVersion& rhs); - void FormatValue(TStringBuilderBase* builder, TProtocolVersion version, TStringBuf spec); TString ToString(TProtocolVersion protocolVersion); diff --git a/yt/yt/core/rpc/service.cpp b/yt/yt/core/rpc/service.cpp index 95749e42d2..23e76917aa 100644 --- a/yt/yt/core/rpc/service.cpp +++ b/yt/yt/core/rpc/service.cpp @@ -77,16 +77,6 @@ TServiceId::TServiceId(std::string serviceName, TRealmId realmId) , RealmId(realmId) { } -bool operator == (const TServiceId& lhs, const TServiceId& rhs) -{ - return lhs.ServiceName == rhs.ServiceName && lhs.RealmId == rhs.RealmId; -} - -bool operator != (const TServiceId& lhs, const TServiceId& rhs) -{ - return !(lhs == rhs); -} - TString ToString(const TServiceId& serviceId) { auto result = TString(serviceId.ServiceName); diff --git a/yt/yt/core/rpc/service.h b/yt/yt/core/rpc/service.h index 8f5e3164a3..1c2e721730 100644 --- a/yt/yt/core/rpc/service.h +++ b/yt/yt/core/rpc/service.h @@ -277,13 +277,12 @@ struct TServiceId TServiceId() = default; TServiceId(std::string serviceName, TRealmId realmId = NullRealmId); + bool operator==(const TServiceId& other) const = default; + std::string ServiceName; TRealmId RealmId; }; -bool operator == (const TServiceId& lhs, const TServiceId& rhs); -bool operator != (const TServiceId& lhs, const TServiceId& rhs); - TString ToString(const TServiceId& serviceId); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/core/ytree/helpers.cpp b/yt/yt/core/ytree/helpers.cpp index c8c794a22e..de0d6d21cd 100644 --- a/yt/yt/core/ytree/helpers.cpp +++ b/yt/yt/core/ytree/helpers.cpp @@ -44,11 +44,6 @@ bool operator == (const IAttributeDictionary& lhs, const IAttributeDictionary& r return true; } -bool operator != (const IAttributeDictionary& lhs, const IAttributeDictionary& rhs) -{ - return !(lhs == rhs); -} - //////////////////////////////////////////////////////////////////////////////// class TEphemeralAttributeDictionary diff --git a/yt/yt/core/ytree/helpers.h b/yt/yt/core/ytree/helpers.h index 3320456f78..cc7c736c51 100644 --- a/yt/yt/core/ytree/helpers.h +++ b/yt/yt/core/ytree/helpers.h @@ -16,7 +16,6 @@ namespace NYT::NYTree { // NB: Pretty slow. bool operator == (const IAttributeDictionary& lhs, const IAttributeDictionary& rhs); -bool operator != (const IAttributeDictionary& lhs, const IAttributeDictionary& rhs); //! Creates attributes dictionary in memory. IAttributeDictionaryPtr CreateEphemeralAttributes(std::optional<int> ysonNestingLevelLimit = std::nullopt); diff --git a/yt/yt/library/named_value/named_value.cpp b/yt/yt/library/named_value/named_value.cpp index 912d9069e0..a283e28849 100644 --- a/yt/yt/library/named_value/named_value.cpp +++ b/yt/yt/library/named_value/named_value.cpp @@ -106,21 +106,11 @@ bool operator ==(const TNamedValue::TAny& lhs, const TNamedValue::TAny& rhs) return lhs.Value == rhs.Value; } -bool operator !=(const TNamedValue::TAny& lhs, const TNamedValue::TAny& rhs) -{ - return !(lhs == rhs); -} - bool operator ==(const TNamedValue::TComposite& lhs, const TNamedValue::TComposite& rhs) { return lhs.Value == rhs.Value; } -bool operator !=(const TNamedValue::TComposite& lhs, const TNamedValue::TComposite& rhs) -{ - return !(lhs.Value == rhs.Value); -} - //////////////////////////////////////////////////////////////////////////////// } // namespace NYT diff --git a/yt/yt/library/named_value/named_value.h b/yt/yt/library/named_value/named_value.h index 9ac205c702..3a76346589 100644 --- a/yt/yt/library/named_value/named_value.h +++ b/yt/yt/library/named_value/named_value.h @@ -93,10 +93,7 @@ private: //////////////////////////////////////////////////////////////////////////////// bool operator ==(const TNamedValue::TAny& lhs, const TNamedValue::TAny& rhs); -bool operator !=(const TNamedValue::TAny& lhs, const TNamedValue::TAny& rhs); - bool operator ==(const TNamedValue::TComposite& lhs, const TNamedValue::TComposite& rhs); -bool operator !=(const TNamedValue::TComposite& lhs, const TNamedValue::TComposite& rhs); //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/library/numeric/double_array.h b/yt/yt/library/numeric/double_array.h index 1416851707..f618e68277 100644 --- a/yt/yt/library/numeric/double_array.h +++ b/yt/yt/library/numeric/double_array.h @@ -311,12 +311,6 @@ constexpr bool operator==(const TDerived& lhs, const TDerived& rhs) } template <class TDerived, class = std::enable_if_t<IsDoubleArray<TDerived>>> -constexpr bool operator!=(const TDerived& lhs, const TDerived& rhs) -{ - return !(lhs == rhs); -} - -template <class TDerived, class = std::enable_if_t<IsDoubleArray<TDerived>>> constexpr TDerived operator+(const TDerived& lhs, const TDerived& rhs) { return TDerived::Apply(lhs, rhs, [](auto x, auto y) { return x + y; }); diff --git a/yt/yt/library/profiling/histogram_snapshot.cpp b/yt/yt/library/profiling/histogram_snapshot.cpp index 0deb9afa8c..cb04374b91 100644 --- a/yt/yt/library/profiling/histogram_snapshot.cpp +++ b/yt/yt/library/profiling/histogram_snapshot.cpp @@ -105,11 +105,6 @@ bool THistogramSnapshot::operator == (const THistogramSnapshot& other) const return Values == other.Values && Bounds == other.Bounds; } -bool THistogramSnapshot::operator != (const THistogramSnapshot& other) const -{ - return !(*this == other); -} - //////////////////////////////////////////////////////////////////////////////// } // namespace NYT::NProfiling diff --git a/yt/yt/library/profiling/histogram_snapshot.h b/yt/yt/library/profiling/histogram_snapshot.h index 782215da14..8fd0296942 100644 --- a/yt/yt/library/profiling/histogram_snapshot.h +++ b/yt/yt/library/profiling/histogram_snapshot.h @@ -17,7 +17,6 @@ struct THistogramSnapshot THistogramSnapshot& operator += (const THistogramSnapshot& other); bool operator == (const THistogramSnapshot& other) const; - bool operator != (const THistogramSnapshot& other) const; bool IsEmpty() const; }; diff --git a/yt/yt/library/profiling/summary-inl.h b/yt/yt/library/profiling/summary-inl.h index 1402f1ff47..93691613e5 100644 --- a/yt/yt/library/profiling/summary-inl.h +++ b/yt/yt/library/profiling/summary-inl.h @@ -58,22 +58,6 @@ TSummarySnapshot<T>& TSummarySnapshot<T>::operator += (const TSummarySnapshot<T> } template <class T> -bool TSummarySnapshot<T>::operator == (const TSummarySnapshot<T>& other) const -{ - return Sum_ == other.Sum_ && - Min_ == other.Min_ && - Max_ == other.Max_ && - Last_ == other.Last_ && - Count_ == other.Count_; -} - -template <class T> -bool TSummarySnapshot<T>::operator != (const TSummarySnapshot<T>& other) const -{ - return !(*this == other); -} - -template <class T> T TSummarySnapshot<T>::Sum() const { return Sum_; diff --git a/yt/yt/library/profiling/summary.h b/yt/yt/library/profiling/summary.h index 29768d1e2b..13fcee1b4a 100644 --- a/yt/yt/library/profiling/summary.h +++ b/yt/yt/library/profiling/summary.h @@ -17,8 +17,7 @@ public: TSummarySnapshot() = default; TSummarySnapshot(T sum, T min, T max, T last, i64 count); - bool operator == (const TSummarySnapshot& other) const; - bool operator != (const TSummarySnapshot& other) const; + bool operator == (const TSummarySnapshot& other) const = default; T Sum() const; T Min() const; diff --git a/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto b/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto index 721e576ed8..3782b5e9fb 100644 --- a/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto +++ b/yt/yt_proto/yt/client/api/rpc_proxy/proto/api_service.proto @@ -590,7 +590,7 @@ message TReqSelectRows optional bool new_range_inference = 19; optional bool use_canonical_null_relations = 20; optional bool merge_versioned_rows = 21; - optional int32 syntax_version = 22; + optional int32 syntax_version = 22 [default = 1]; optional TSuppressableAccessTrackingOptions suppressable_access_tracking_options = 104; } |