// Perform concat with retries. Currently retries only once. If the concat fails, checks whether it can be retried based on HttpStatuscode, // If true then check whether the destiantion already exists and the source is deleted. If there is no intermediate state then returns true. private bool PerformConcatWithRetries(out AdlsException excep) { var retryPolicy = new ExponentialRetryPolicy(); string destGuid = ChunkSegmentFolder + FileUploader.DestTempGuidForConcat; var chunkList = new List <string>((int)_totalChunks); for (int i = 0; i < _totalChunks; i++) { chunkList.Add(ChunkSegmentFolder + "/" + i); } int retries = 0; do { excep = PerformConcatSingle(chunkList, destGuid); if (excep == null) { return(true); } if (!retryPolicy.ShouldRetryBasedOnHttpOutput((int)excep.HttpStatus, excep.Ex)) { return(false); } if (VerifyAdlExists(destGuid)) { if (Client.CheckExists(ChunkSegmentFolder)) { // If both destination and source folder exist then end-no way to recover return(false); } return(true); } } while (retries++ < UploadRetryTime); return(false); }