// 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); }
private static void PrintAdlsException(AdlsException exp) { Console.WriteLine("ADLException"); Console.WriteLine($" Http Status: {exp.HttpStatus}"); Console.WriteLine($" Http Message: {exp.HttpMessage}"); Console.WriteLine($" Remote Exception Name: {exp.RemoteExceptionName}"); Console.WriteLine($" Server Trace Id: {exp.TraceId}"); Console.WriteLine($" Exception Message: {exp.Message}"); Console.WriteLine($" Exception Stack Trace: {exp.StackTrace}"); Console.WriteLine(); }
private AdlsException PerformConcatSingle(List <string> fileList, string destGuid) { AdlsException exception = null; try { Client.ConcatenateFilesParallelAsync(destGuid, fileList).GetAwaiter().GetResult(); } catch (AdlsException ex) { exception = ex; } return(exception); }
private AdlsException PerformConcatSingle(List <string> fileList, string destGuid) { AdlsException exception = null; try { Client.ConcatenateFiles(destGuid, fileList); } catch (AdlsException ex) { exception = ex; } return(exception); }