Skip to content

Commit 17d39e9

Browse files
committed
Fix NullPointerException during subdoc load result collection
- WorkLoadGenerate::update_subdoc_failed_mutation_result(): filter results to only track failures (status == false); previously all results were added unconditionally, causing get_task_result() to iterate successful entries with null err and throw NPE - TaskRequest::doc_load(): include subdocPercent in docsPerWorker calculation so subdoc-only loads get correct effective worker counts instead of always falling back to docsPerWorker=1
1 parent 617d100 commit 17d39e9

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/main/java/RestServer/TaskRequest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,8 @@ public ResponseEntity<Map<String, Object>> doc_load() {
697697
(this.updatePercent > 0 ? this.updatePercent : 0) +
698698
(this.readPercent > 0 ? this.readPercent : 0) +
699699
(this.deletePercent > 0 ? this.deletePercent : 0) +
700-
(this.expiryPercent > 0 ? this.expiryPercent : 0)
700+
(this.expiryPercent > 0 ? this.expiryPercent : 0) +
701+
(this.subdocPercent > 0 ? this.subdocPercent : 0)
701702
) / 100;
702703

703704
// Handle edge case where docsPerWorker might be 0

src/main/java/couchbase/loadgen/WorkLoadGenerate.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,12 @@ private void update_subdoc_failed_mutation_result(
8282
}
8383

8484
for(HashMap<String, Object> sd_res : sd_results) {
85-
result_arr.add(new Result((String)sd_res.get("id"),
86-
sd_res.get("value"),
87-
(Throwable)sd_res.get("error"),
88-
(boolean)sd_res.get("status")));
85+
if (!(boolean)sd_res.get("status")) {
86+
result_arr.add(new Result((String)sd_res.get("id"),
87+
sd_res.get("value"),
88+
(Throwable)sd_res.get("error"),
89+
false));
90+
}
8991
}
9092
}
9193

0 commit comments

Comments
 (0)