mirror of
https://github.com/dolthub/dolt.git
synced 2026-01-30 10:45:18 -06:00
Drop the Exists call before loading the archive
This commit is contained in:
@@ -66,7 +66,7 @@ func newAWSArchiveChunkSource(ctx context.Context,
|
||||
|
||||
aRdr, err := newArchiveReaderFromFooter(ctx, &s3TableReaderAt{s3, name}, sz, footer, stats)
|
||||
if err != nil {
|
||||
return archiveChunkSource{}, err
|
||||
return emptyChunkSource{}, err
|
||||
}
|
||||
return archiveChunkSource{"", aRdr}, nil
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/service/s3"
|
||||
"github.com/aws/aws-sdk-go/service/s3/s3iface"
|
||||
"github.com/aws/aws-sdk-go/service/s3/s3manager"
|
||||
@@ -84,30 +83,14 @@ func (s3p awsTablePersister) Open(ctx context.Context, name hash.Hash, chunkCoun
|
||||
return cs, nil
|
||||
}
|
||||
|
||||
var reqErr awserr.RequestFailure
|
||||
if errors.As(err, &reqErr) {
|
||||
if reqErr.Code() != "NoSuchKey" || reqErr.StatusCode() != 404 {
|
||||
return emptyChunkSource{}, err
|
||||
}
|
||||
} else {
|
||||
// Probably won't ever happen.
|
||||
return emptyChunkSource{}, err
|
||||
}
|
||||
|
||||
archiveKey := name.String() + ArchiveFileSuffix
|
||||
e, err2 := s3p.Exists(ctx, archiveKey, chunkCount, stats)
|
||||
if e && err2 == nil {
|
||||
return newAWSArchiveChunkSource(
|
||||
ctx,
|
||||
&s3ObjectReader{s3: s3p.s3, bucket: s3p.bucket, readRl: s3p.rl, ns: s3p.ns},
|
||||
s3p.limits,
|
||||
archiveKey,
|
||||
chunkCount,
|
||||
s3p.q,
|
||||
stats)
|
||||
}
|
||||
|
||||
return emptyChunkSource{}, err
|
||||
return newAWSArchiveChunkSource(
|
||||
ctx,
|
||||
&s3ObjectReader{s3: s3p.s3, bucket: s3p.bucket, readRl: s3p.rl, ns: s3p.ns},
|
||||
s3p.limits,
|
||||
name.String()+ArchiveFileSuffix,
|
||||
chunkCount,
|
||||
s3p.q,
|
||||
stats)
|
||||
}
|
||||
|
||||
func (s3p awsTablePersister) Exists(ctx context.Context, name string, _ uint32, stats *Stats) (bool, error) {
|
||||
|
||||
Reference in New Issue
Block a user