|
20 | 20 | package org.apache.iotdb.db.pipe.sink.protocol.writeback; |
21 | 21 |
|
22 | 22 | import org.apache.iotdb.common.rpc.thrift.TSStatus; |
| 23 | +import org.apache.iotdb.commons.exception.pipe.PipeRuntimeSinkNonReportTimeConfigurableException; |
23 | 24 | import org.apache.iotdb.db.auth.AuthorityChecker; |
24 | 25 | import org.apache.iotdb.db.conf.IoTDBDescriptor; |
25 | 26 | import org.apache.iotdb.db.pipe.event.common.heartbeat.PipeHeartbeatEvent; |
@@ -131,7 +132,8 @@ private void doTransfer( |
131 | 132 | status = statement.isEmpty() ? RpcUtils.SUCCESS_STATUS : executeStatement(statement); |
132 | 133 |
|
133 | 134 | if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { |
134 | | - throw new PipeException( |
| 135 | + throwWriteBackExceptionIfNecessary( |
| 136 | + status, |
135 | 137 | String.format( |
136 | 138 | "Transfer PipeInsertNodeTabletInsertionEvent %s error, result status %s", |
137 | 139 | pipeInsertNodeTabletInsertionEvent, status)); |
@@ -162,13 +164,23 @@ private void doTransfer(final PipeRawTabletInsertionEvent pipeRawTabletInsertion |
162 | 164 | statement.isEmpty() ? RpcUtils.SUCCESS_STATUS : executeStatement(statement); |
163 | 165 |
|
164 | 166 | if (status.getCode() != TSStatusCode.SUCCESS_STATUS.getStatusCode()) { |
165 | | - throw new PipeException( |
| 167 | + throwWriteBackExceptionIfNecessary( |
| 168 | + status, |
166 | 169 | String.format( |
167 | 170 | "Transfer PipeRawTabletInsertionEvent %s error, result status %s", |
168 | 171 | pipeRawTabletInsertionEvent, status)); |
169 | 172 | } |
170 | 173 | } |
171 | 174 |
|
| 175 | + private static void throwWriteBackExceptionIfNecessary( |
| 176 | + final TSStatus status, final String exceptionMessage) { |
| 177 | + if (status.getCode() == TSStatusCode.NO_PERMISSION.getStatusCode()) { |
| 178 | + throw new PipeRuntimeSinkNonReportTimeConfigurableException(exceptionMessage, Long.MAX_VALUE); |
| 179 | + } |
| 180 | + |
| 181 | + throw new PipeException(exceptionMessage); |
| 182 | + } |
| 183 | + |
172 | 184 | private TSStatus executeStatement(final InsertBaseStatement statement) { |
173 | 185 | return Coordinator.getInstance() |
174 | 186 | .executeForTreeModel( |
|
0 commit comments