Skip to content

Commit c5f2c9a

Browse files
author
chengyitian
committed
AJ-854: throw exception when PTA append error;
1 parent cbc7d80 commit c5f2c9a

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/com/xxdb/route/PartitionedTableAppender.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,15 +145,26 @@ public int append(Table table) throws IOException {
145145
int affected = 0;
146146
for(int i=0; i<tasks.size(); ++i){
147147
DBTask task = tasks.get(i);
148-
if(task.isSuccessful()){
148+
while (!task.isFinished()) {
149+
try {
150+
Thread.sleep(100);
151+
} catch (InterruptedException e) {
152+
throw new RuntimeException(e);
153+
}
154+
}
155+
156+
if (task.isSuccessful()) {
149157
Entity re = task.getResult();
150-
if(re.getDataType() == Entity.DATA_TYPE.DT_VOID){
158+
if (re.getDataType() == Entity.DATA_TYPE.DT_VOID) {
151159
affected = 0;
152-
}else{
160+
} else {
153161
affected += ((BasicInt)task.getResult()).getInt();
154162
}
163+
} else {
164+
throw new RuntimeException("Task [" + i + "] come across execption: " + task.getErrorMsg());
155165
}
156166
}
167+
157168
return affected;
158169
}
159170

0 commit comments

Comments
 (0)