Skip to content

Commit c723ac7

Browse files
msbutlerdt
authored andcommitted
backup/kvserver: plumb backing file size through addSSTablePreApply()
Epic: none Release note: none
1 parent bfa276d commit c723ac7

File tree

7 files changed

+21
-7
lines changed

7 files changed

+21
-7
lines changed

pkg/ccl/backupccl/restore_job.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3202,7 +3202,11 @@ func sendAddRemoteSSTs(
32023202
}
32033203
}
32043204

3205-
loc := kvpb.AddSSTableRequest_RemoteFile{Locator: uris[i], Path: file.Path}
3205+
loc := kvpb.AddSSTableRequest_RemoteFile{
3206+
Locator: uris[i],
3207+
Path: file.Path,
3208+
BackingFileSize: file.BackingFileSize,
3209+
}
32063210
// TODO(dt): see if KV has any better ideas for making these up.
32073211
fileStats := &enginepb.MVCCStats{
32083212
ContainsEstimates: 1,

pkg/ccl/backupccl/restore_span_covering.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,9 @@ func generateAndSendImportSpans(
476476
Path: f.Path,
477477
Dir: backups[layer].Dir,
478478
BackupFileEntrySpan: f.Span,
479-
BackupFileEntryCounts: f.EntryCounts}
479+
BackupFileEntryCounts: f.EntryCounts,
480+
BackingFileSize: f.BackingFileSize,
481+
}
480482
if dir, ok := backupLocalityMap[layer][f.LocalityKV]; ok {
481483
fileSpec.Dir = dir
482484
}

pkg/kv/kvpb/api.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,9 +2004,11 @@ message AddSSTableRequest {
20042004
//
20052005
// TODO(dt, msbutler, bilal): This is unsupported.
20062006
// TOOD(dt, msbutler, bilal): support sst_timestamp_to_request_timestamp.
2007+
// TODO(msbutler): rename to ExternalFile.
20072008
message RemoteFile {
20082009
string locator = 1;
20092010
string path = 2;
2011+
uint64 backing_file_size = 3;
20102012
}
20112013
RemoteFile remote_file = 10 [(gogoproto.nullable) = false];
20122014

pkg/kv/kvserver/batcheval/cmd_add_sstable.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,10 @@ func EvalAddSSTable(
174174
return result.Result{
175175
Replicated: kvserverpb.ReplicatedEvalResult{
176176
AddSSTable: &kvserverpb.ReplicatedEvalResult_AddSSTable{
177-
RemoteFileLoc: args.RemoteFile.Locator,
178-
RemoteFilePath: args.RemoteFile.Path,
179-
Span: roachpb.Span{Key: start.Key, EndKey: end.Key},
177+
RemoteFileLoc: args.RemoteFile.Locator,
178+
RemoteFilePath: args.RemoteFile.Path,
179+
BackingFileSize: args.RemoteFile.BackingFileSize,
180+
Span: roachpb.Span{Key: start.Key, EndKey: end.Key},
180181
},
181182
MVCCHistoryMutation: mvccHistoryMutation,
182183
},

pkg/kv/kvserver/kvserverpb/proposer_kv.proto

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,11 @@ message ReplicatedEvalResult {
193193
// taken place since 22.1, to make sure all Raft log entries from 21.2 or
194194
// older have been applied on all replicas.
195195
bool at_write_timestamp = 4;
196-
196+
197+
// TODO(msbutler,dt): bikeshed the name of these fields.
197198
string remote_file_loc = 5;
198199
string remote_file_path = 6;
200+
uint64 backing_file_size = 7;
199201
}
200202
AddSSTable add_sstable = 17 [(gogoproto.customname) = "AddSSTable"];
201203

pkg/kv/kvserver/replica_proposal.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,9 @@ func addSSTablePreApply(
601601
) bool {
602602
if sst.RemoteFilePath != "" {
603603
// TODO(dt, bilal, msbutler): Replace this with eng.IngestRemoteFile()
604-
log.Warningf(ctx, "EXPERIMENTAL AddSSTABLE REMOTE FILE UNSUPPORTED; downloading %s from %s and adding it whole, ignoring span %s", sst.RemoteFilePath, sst.RemoteFileLoc, sst.Span)
604+
log.Warningf(ctx, "EXPERIMENTAL AddSSTABLE REMOTE FILE UNSUPPORTED; downloading %s ("+
605+
"with size %d) from %s and adding it whole, ignoring span %s", sst.RemoteFilePath,
606+
sst.BackingFileSize, sst.RemoteFileLoc, sst.Span)
605607
s, err := env.external.OpenURL(ctx, sst.RemoteFileLoc, username.SQLUsername{})
606608
if err != nil {
607609
log.Fatalf(ctx, "failed to open remote location %q below raft: %v", sst.RemoteFileLoc, err)

pkg/sql/execinfrapb/processors_bulk_io.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ message RestoreFileSpec {
294294
reserved 4;
295295
optional roachpb.Span backup_file_entry_span = 5 [(gogoproto.nullable) = false];
296296
optional roachpb.RowCount backup_file_entry_counts = 6 [(gogoproto.nullable) = false];
297+
optional uint64 backing_file_size = 7 [(gogoproto.nullable) = false];
297298
}
298299

299300
message TableRekey {

0 commit comments

Comments
 (0)