From 46cebe9b5c99ba80922b3691d2cec1a5e1bb439e Mon Sep 17 00:00:00 2001
From: Yahor Yuzefovich <yahor@cockroachlabs.com>
Date: Tue, 15 Aug 2023 17:41:17 -0700
Subject: [PATCH] row: remove no longer nil txn check

I believe this non-nil txn check is no longer needed as of
8f7f2f405d4989d1cb22d1ab50fc0e20aadebcec (which fixed the only known
place where we forgot to set the txn field on the FlowCtx).

Release note: None
---
 pkg/sql/row/kv_fetcher.go | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/pkg/sql/row/kv_fetcher.go b/pkg/sql/row/kv_fetcher.go
index ee5720cd7e15..678cff19b49c 100644
--- a/pkg/sql/row/kv_fetcher.go
+++ b/pkg/sql/row/kv_fetcher.go
@@ -87,8 +87,7 @@ func newTxnKVFetcher(
 			return br, nil
 		}
 	}
-
-	fetcherArgs := newTxnKVFetcherArgs{
+	return newTxnKVFetcherInternal(newTxnKVFetcherArgs{
 		sendFn:                     sendFn,
 		reverse:                    reverse,
 		lockStrength:               lockStrength,
@@ -98,15 +97,9 @@ func newTxnKVFetcher(
 		forceProductionKVBatchSize: forceProductionKVBatchSize,
 		kvPairsRead:                new(int64),
 		batchRequestsIssued:        &batchRequestsIssued,
-	}
-	if txn != nil {
-		// In most cases, the txn is non-nil; however, in some code paths (e.g.
-		// when executing EXPLAIN (VEC)) it might be nil, so we need to have
-		// this check.
-		fetcherArgs.requestAdmissionHeader = txn.AdmissionHeader()
-		fetcherArgs.responseAdmissionQ = txn.DB().SQLKVResponseAdmissionQ
-	}
-	return newTxnKVFetcherInternal(fetcherArgs)
+		requestAdmissionHeader:     txn.AdmissionHeader(),
+		responseAdmissionQ:         txn.DB().SQLKVResponseAdmissionQ,
+	})
 }
 
 // NewDirectKVBatchFetcher creates a new KVBatchFetcher that uses the