Browse Source

Add range read border to key sampler KIKIMR-20859 (#1253)

Aleksei Borzenkov 1 year ago
parent
commit
8a21d0ef87
1 changed files with 10 additions and 0 deletions
  1. 10 0
      ydb/core/tx/datashard/datashard__read_iterator.cpp

+ 10 - 0
ydb/core/tx/datashard/datashard__read_iterator.cpp

@@ -364,6 +364,16 @@ public:
         iterRange.MaxInclusive = toInclusive;
         const bool reverse = State.Reverse;
 
+        if (TArrayRef<const TCell> cells = keyFromCells.GetCells()) {
+            if (!fromInclusive || cells.size() >= TableInfo.KeyColumnTypes.size()) {
+                Self->GetKeyAccessSampler()->AddSample(TableId, cells);
+            } else {
+                TVector<TCell> extended(cells.begin(), cells.end());
+                extended.resize(TableInfo.KeyColumnTypes.size());
+                Self->GetKeyAccessSampler()->AddSample(TableId, extended);
+            }
+        }
+
         EReadStatus result;
         if (!reverse) {
             auto iter = txc.DB.IterateRange(TableInfo.LocalTid, iterRange, State.Columns, State.ReadVersion, GetReadTxMap(), GetReadTxObserver());