@@ -708,7 +708,7 @@ CREATE TABLE crdb_internal.pg_catalog_table_is_implemented (
708
708
name STRING NOT NULL,
709
709
implemented BOOL
710
710
)` ,
711
- generator : func (ctx context.Context , p * planner , dbDesc catalog.DatabaseDescriptor , stopper * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
711
+ generator : func (ctx context.Context , p * planner , dbDesc catalog.DatabaseDescriptor , _ int64 , stopper * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
712
712
row := make (tree.Datums , 2 )
713
713
worker := func (ctx context.Context , pusher rowPusher ) error {
714
714
addDesc := func (table * virtualDefEntry , dbName tree.Datum , scName string ) error {
@@ -3851,7 +3851,7 @@ CREATE TABLE crdb_internal.table_columns (
3851
3851
hidden BOOL NOT NULL
3852
3852
)
3853
3853
` ,
3854
- generator : func (ctx context.Context , p * planner , dbContext catalog.DatabaseDescriptor , stopper * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
3854
+ generator : func (ctx context.Context , p * planner , dbContext catalog.DatabaseDescriptor , _ int64 , stopper * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
3855
3855
const numDatums = 8
3856
3856
row := make (tree.Datums , numDatums )
3857
3857
worker := func (ctx context.Context , pusher rowPusher ) error {
@@ -3920,7 +3920,7 @@ CREATE TABLE crdb_internal.table_indexes (
3920
3920
create_statement STRING NOT NULL
3921
3921
)
3922
3922
` ,
3923
- generator : func (ctx context.Context , p * planner , dbContext catalog.DatabaseDescriptor , stopper * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
3923
+ generator : func (ctx context.Context , p * planner , dbContext catalog.DatabaseDescriptor , _ int64 , stopper * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
3924
3924
primary := tree .NewDString ("primary" )
3925
3925
secondary := tree .NewDString ("secondary" )
3926
3926
const numDatums = 13
@@ -4489,7 +4489,7 @@ CREATE TABLE crdb_internal.ranges_no_leases (
4489
4489
)
4490
4490
` ,
4491
4491
resultColumns : colinfo .RangesNoLeases ,
4492
- generator : func (ctx context.Context , p * planner , _ catalog.DatabaseDescriptor , _ * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
4492
+ generator : func (ctx context.Context , p * planner , _ catalog.DatabaseDescriptor , limit int64 , _ * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
4493
4493
hasAdmin , err := p .HasAdminRole (ctx )
4494
4494
if err != nil {
4495
4495
return nil , nil , err
@@ -4524,7 +4524,11 @@ CREATE TABLE crdb_internal.ranges_no_leases (
4524
4524
}
4525
4525
4526
4526
execCfg := p .ExecCfg ()
4527
- rangeDescIterator , err := execCfg .RangeDescIteratorFactory .NewIterator (ctx , execCfg .Codec .TenantSpan ())
4527
+ pageSize := int64 (128 )
4528
+ if limit > 0 {
4529
+ pageSize = min (limit , pageSize )
4530
+ }
4531
+ rangeDescIterator , err := execCfg .RangeDescIteratorFactory .NewLazyIterator (ctx , execCfg .Codec .TenantSpan (), int (pageSize ))
4528
4532
if err != nil {
4529
4533
return nil , nil , err
4530
4534
}
@@ -5428,7 +5432,7 @@ CREATE TABLE crdb_internal.partitions (
5428
5432
subzone_id INT -- references a subzone id in the crdb_internal.zones table
5429
5433
)
5430
5434
` ,
5431
- generator : func (ctx context.Context , p * planner , dbContext catalog.DatabaseDescriptor , stopper * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
5435
+ generator : func (ctx context.Context , p * planner , dbContext catalog.DatabaseDescriptor , _ int64 , stopper * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
5432
5436
dbName := ""
5433
5437
if dbContext != nil {
5434
5438
dbName = dbContext .GetName ()
@@ -6874,7 +6878,7 @@ CREATE TABLE crdb_internal.index_usage_statistics (
6874
6878
total_reads INT NOT NULL,
6875
6879
last_read TIMESTAMPTZ
6876
6880
);` ,
6877
- generator : func (ctx context.Context , p * planner , dbContext catalog.DatabaseDescriptor , stopper * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
6881
+ generator : func (ctx context.Context , p * planner , dbContext catalog.DatabaseDescriptor , _ int64 , stopper * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
6878
6882
// Perform RPC Fanout.
6879
6883
stats , err :=
6880
6884
p .extendedEvalCtx .SQLStatusServer .IndexUsageStatistics (ctx , & serverpb.IndexUsageStatisticsRequest {})
@@ -6939,7 +6943,7 @@ CREATE TABLE crdb_internal.cluster_statement_statistics (
6939
6943
aggregation_interval INTERVAL NOT NULL,
6940
6944
index_recommendations STRING[] NOT NULL
6941
6945
);` ,
6942
- generator : func (ctx context.Context , p * planner , db catalog.DatabaseDescriptor , stopper * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
6946
+ generator : func (ctx context.Context , p * planner , db catalog.DatabaseDescriptor , _ int64 , stopper * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
6943
6947
// TODO(azhng): we want to eventually implement memory accounting within the
6944
6948
// RPC handlers. See #69032.
6945
6949
acc := p .Mon ().MakeBoundAccount ()
@@ -7370,7 +7374,7 @@ CREATE TABLE crdb_internal.cluster_transaction_statistics (
7370
7374
statistics JSONB NOT NULL,
7371
7375
aggregation_interval INTERVAL NOT NULL
7372
7376
);` ,
7373
- generator : func (ctx context.Context , p * planner , db catalog.DatabaseDescriptor , stopper * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
7377
+ generator : func (ctx context.Context , p * planner , db catalog.DatabaseDescriptor , _ int64 , stopper * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
7374
7378
// TODO(azhng): we want to eventually implement memory accounting within the
7375
7379
// RPC handlers. See #69032.
7376
7380
acc := p .Mon ().MakeBoundAccount ()
@@ -7691,7 +7695,7 @@ CREATE TABLE crdb_internal.transaction_contention_events (
7691
7695
index_name STRING,
7692
7696
contention_type STRING NOT NULL
7693
7697
);` ,
7694
- generator : func (ctx context.Context , p * planner , db catalog.DatabaseDescriptor , stopper * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
7698
+ generator : func (ctx context.Context , p * planner , db catalog.DatabaseDescriptor , _ int64 , stopper * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
7695
7699
// Check permission first before making RPC fanout.
7696
7700
// If a user has VIEWACTIVITYREDACTED role option but the user does not
7697
7701
// have the ADMIN role option, then the contending key should be redacted.
@@ -7970,8 +7974,8 @@ type clusterLocksFilters struct {
7970
7974
7971
7975
func genClusterLocksGenerator (
7972
7976
filters clusterLocksFilters ,
7973
- ) func (ctx context.Context , p * planner , db catalog.DatabaseDescriptor , stopper * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
7974
- return func (ctx context.Context , p * planner , _ catalog.DatabaseDescriptor , _ * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
7977
+ ) func (ctx context.Context , p * planner , db catalog.DatabaseDescriptor , _ int64 , stopper * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
7978
+ return func (ctx context.Context , p * planner , _ catalog.DatabaseDescriptor , _ int64 , _ * stop.Stopper ) (virtualTableGenerator , cleanupFunc , error ) {
7975
7979
hasAdmin , err := p .HasAdminRole (ctx )
7976
7980
if err != nil {
7977
7981
return nil , nil , err
@@ -8234,7 +8238,7 @@ func populateClusterLocksWithFilter(
8234
8238
) (matched bool , err error ) {
8235
8239
var rowGenerator virtualTableGenerator
8236
8240
generator := genClusterLocksGenerator (filters )
8237
- rowGenerator , _ , err = generator (ctx , p , db , nil /* stopper */ )
8241
+ rowGenerator , _ , err = generator (ctx , p , db , 0 /* limit */ , nil /* stopper */ )
8238
8242
if err != nil {
8239
8243
return false , err
8240
8244
}
0 commit comments