isapego commented on a change in pull request #719: URL: https://github.com/apache/ignite-3/pull/719#discussion_r825832380
########## File path: modules/platforms/dotnet/Apache.Ignite/ClientOperationType.cs ########## @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite +{ + using Table; + + /// <summary> + /// Client operation type. + /// </summary> + public enum ClientOperationType + { + /// <summary> + /// Get tables (<see cref="ITables.GetTablesAsync"/>). + /// </summary> + TablesGet, + + /// <summary> + /// Get table (<see cref="ITables.GetTableAsync"/>). + /// </summary> + TableGet, + + /// <summary> + /// Upsert (<see cref="IRecordView{T}.UpsertAsync"/>). + /// </summary> + TupleUpsert, + + /// <summary> + /// Upsert (<see cref="IRecordView{T}.GetAsync"/>). Review comment: ```suggestion /// Get (<see cref="IRecordView{T}.GetAsync"/>). ``` ########## File path: modules/platforms/dotnet/Apache.Ignite/ClientOperationType.cs ########## @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite +{ + using Table; + + /// <summary> + /// Client operation type. + /// </summary> + public enum ClientOperationType + { + /// <summary> + /// Get tables (<see cref="ITables.GetTablesAsync"/>). + /// </summary> + TablesGet, + + /// <summary> + /// Get table (<see cref="ITables.GetTableAsync"/>). + /// </summary> + TableGet, + + /// <summary> + /// Upsert (<see cref="IRecordView{T}.UpsertAsync"/>). + /// </summary> + TupleUpsert, + + /// <summary> + /// Upsert (<see cref="IRecordView{T}.GetAsync"/>). + /// </summary> + TupleGet, + + /// <summary> + /// Upsert (<see cref="IRecordView{T}.UpsertAllAsync"/>). Review comment: ```suggestion /// UpsertAll (<see cref="IRecordView{T}.UpsertAllAsync"/>). ``` ########## File path: modules/platforms/dotnet/Apache.Ignite/ClientOperationType.cs ########## @@ -0,0 +1,112 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +namespace Apache.Ignite +{ + using Table; + + /// <summary> + /// Client operation type. + /// </summary> + public enum ClientOperationType + { + /// <summary> + /// Get tables (<see cref="ITables.GetTablesAsync"/>). + /// </summary> + TablesGet, + + /// <summary> + /// Get table (<see cref="ITables.GetTableAsync"/>). + /// </summary> + TableGet, + + /// <summary> + /// Upsert (<see cref="IRecordView{T}.UpsertAsync"/>). + /// </summary> + TupleUpsert, + + /// <summary> + /// Upsert (<see cref="IRecordView{T}.GetAsync"/>). + /// </summary> + TupleGet, + + /// <summary> + /// Upsert (<see cref="IRecordView{T}.UpsertAllAsync"/>). + /// </summary> + TupleUpsertAll, + + /// <summary> + /// Upsert (<see cref="IRecordView{T}.GetAllAsync"/>). Review comment: ```suggestion /// TupleGetAll (<see cref="IRecordView{T}.GetAllAsync"/>). ``` ... And so on ########## File path: modules/platforms/dotnet/Apache.Ignite/IgniteClientConfiguration.cs ########## @@ -97,5 +99,24 @@ public IgniteClientConfiguration(IgniteClientConfiguration other) /// * my-host.com:780..787 (custom port range). /// </summary> public IList<string> Endpoints { get; } = new List<string>(); + + /// <summary> + /// Gets or sets the retry policy. When a request fails due to a connection error, + /// Ignite will retry the request if the specified policy allows it. + /// <para /> + /// Default is <see cref="RetryNonePolicy"/> - does not retry anything. + /// <para /> + /// See also <see cref="RetryAllPolicy"/>, <see cref="RetryReadPolicy"/>, <see cref="RetryNonePolicy"/>, <see cref="RetryLimit"/>. + /// </summary> + public IRetryPolicy RetryPolicy { get; set; } = RetryNonePolicy.Instance; + + /// <summary> + /// Gets or sets the retry limit. When a request fails due to a connection error, + /// Ignite will retry the request if the specified <see cref="RetryPolicy"/> allows it. When this property is + /// greater than <c>0</c>, Ignite will limit the number of retries. + /// <para /> + /// Default is <c>0</c>: no limit on retries. + /// </summary> + public int RetryLimit { get; set; } Review comment: Why do we need retry limit as a separate property, if we have a retry policy? ########## File path: modules/platforms/dotnet/Apache.Ignite/Internal/ClientFailoverSocket.cs ########## @@ -252,5 +268,95 @@ private IEnumerable<IPAddress> GetIps(string host, bool suppressExceptions = fal throw; } } + + /// <summary> + /// Gets a value indicating whether a failed operation should be retried. + /// </summary> + /// <param name="exception">Exception that caused the operation to fail.</param> + /// <param name="op">Operation code.</param> + /// <param name="attempt">Current attempt.</param> + /// <returns> + /// <c>true</c> if the operation should be retried on another connection, <c>false</c> otherwise. + /// </returns> + private bool ShouldRetry(Exception exception, ClientOp op, int attempt) + { + var e = exception; + + while (e != null && !(e is SocketException)) + { + e = e.InnerException; + } + + if (e == null) + { + // Only retry socket exceptions. Review comment: Why only socket exceptions? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
