diff --git a/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/storage/StorageChainController.java b/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/storage/StorageChainController.java index 889a9ee7e..a18e78769 100644 --- a/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/storage/StorageChainController.java +++ b/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/storage/StorageChainController.java @@ -1,8 +1,9 @@ package com.ai.cloud.skywalking.reciever.storage; import com.ai.cloud.skywalking.protocol.Span; -import com.ai.cloud.skywalking.reciever.conf.Config; import com.ai.cloud.skywalking.reciever.conf.Constants; +import com.ai.cloud.skywalking.reciever.selfexamination.ServerHealthCollector; +import com.ai.cloud.skywalking.reciever.selfexamination.ServerHeathReading; import com.ai.cloud.skywalking.reciever.storage.chain.AlarmChain; import com.ai.cloud.skywalking.reciever.storage.chain.SaveToHBaseChain; import com.ai.cloud.skywalking.reciever.storage.chain.SaveToMySQLChain; @@ -49,19 +50,13 @@ public class StorageChainController { } } - int retryTimes = 0; - while(retryTimes++ < Config.StorageChain.RETRY_STORAGE_TIMES) { - try { - Chain chain = new Chain(chainArray); - chain.doChain(spans); - } catch (Throwable e) { - // 主要的异常可能跟环境有关系,比如Redis,HBase,将会重试N次 - try { - Thread.sleep(Config.StorageChain.RETRY_STORAGE_WAIT_TIME); - } catch (InterruptedException e1) { - logger.error("Sleep failure", e); - } - } + try { + Chain chain = new Chain(chainArray); + chain.doChain(spans); + } catch (Throwable e) { + logger.error("Failed to storage chain.", e); + ServerHealthCollector.getCurrentHeathReading("storage-chain").updateData(ServerHeathReading.ERROR, + "Failed to storage chain.Cause:" + e.getMessage()); } } } diff --git a/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/storage/chain/SaveToHBaseChain.java b/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/storage/chain/SaveToHBaseChain.java index 6b228ea57..6f68e2db8 100644 --- a/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/storage/chain/SaveToHBaseChain.java +++ b/skywalking-server/src/main/java/com/ai/cloud/skywalking/reciever/storage/chain/SaveToHBaseChain.java @@ -122,9 +122,7 @@ public class SaveToHBaseChain implements IStorageChain { int index = 0; for (Object result : resultArrays) { if (result == null) { - while (!insert(tableName, data.get(index))) { - Thread.sleep(100L); - } + throw new RuntimeException("Failed to storage puts to Table[" + tableName + "]"); } index++; } @@ -132,6 +130,8 @@ public class SaveToHBaseChain implements IStorageChain { throw new ChainException(e); } catch (InterruptedException e) { throw new ChainException(e); + }catch (RuntimeException e){ + throw new ChainException(e); } }