Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/result/CloudFetchResultHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default class CloudFetchResultHandler implements IResultsProvider<ArrowBa

this.context
.getLogger()
.log(LogLevel.info, `Result File Download speed from cloud storage ${cleanUrl}: ${speedMBps.toFixed(4)} MB/s`);
.log(LogLevel.debug, `Result File Download speed from cloud storage ${cleanUrl}: ${speedMBps.toFixed(4)} MB/s`);

const speedThresholdMBps = this.context.getConfig().cloudFetchSpeedThresholdMBps;
if (speedMBps < speedThresholdMBps) {
Expand Down
21 changes: 21 additions & 0 deletions tests/unit/result/CloudFetchResultHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import LZ4 from 'lz4';
import { Request, Response } from 'node-fetch';
import { ShouldRetryResult } from '../../../lib/connection/contracts/IRetryPolicy';
import { HttpTransactionDetails } from '../../../lib/connection/contracts/IConnectionProvider';
import { LogLevel } from '../../../lib/contracts/IDBSQLLogger';
import CloudFetchResultHandler from '../../../lib/result/CloudFetchResultHandler';
import ResultsProviderStub from '../.stubs/ResultsProviderStub';
import { TRowSet, TSparkArrowResultLink, TStatusCode } from '../../../thrift/TCLIService_types';
Expand Down Expand Up @@ -199,6 +200,26 @@ describe('CloudFetchResultHandler', () => {
expect(context.invokeWithRetryStub.called).to.be.false;
});

it('should log cloud fetch download speed at debug level', async () => {
const context = new ClientContextStub({ cloudFetchConcurrentDownloads: 1 });
const rowSetProvider = new ResultsProviderStub([sampleRowSet1], undefined);
const result = new CloudFetchResultHandler(context, rowSetProvider, {
status: { statusCode: TStatusCode.SUCCESS_STATUS },
});

const logStub = sinon.stub(context.logger, 'log');
context.invokeWithRetryStub.callsFake(async () => ({
request: new Request('localhost'),
response: new Response(Buffer.concat([sampleArrowSchema, sampleArrowBatch]), { status: 200 }),
}));

await result.fetchNext({ limit: 10000 });

expect(logStub.calledWith(LogLevel.debug, sinon.match(/Result File Download speed from cloud storage/))).to.be.true;
expect(logStub.neverCalledWith(LogLevel.info, sinon.match(/Result File Download speed from cloud storage/))).to.be
.true;
});

it('should download batches according to settings', async () => {
const context = new ClientContextStub({ cloudFetchConcurrentDownloads: 3 });
const clientConfig = context.getConfig();
Expand Down