| 79 | } |
| 80 | |
| 81 | ACTOR Future<Void> bulkLoadClient(Database cx, BulkLoadWorkload* self, int clientId, int actorId) { |
| 82 | state uint64_t totalBytes = 0; |
| 83 | state int idx = 0; |
| 84 | loop { |
| 85 | state double tstart = now(); |
| 86 | state Transaction tr(cx); |
| 87 | loop { |
| 88 | state uint64_t txnBytes = 0; |
| 89 | try { |
| 90 | for (int i = 0; i < self->writesPerTransaction; i++) { |
| 91 | std::string key = format("%s/bulkload/%04x/%04x/%08x", |
| 92 | self->keyPrefix.toString().c_str(), |
| 93 | self->clientId, |
| 94 | actorId, |
| 95 | idx + i); |
| 96 | tr.set(key, self->value); |
| 97 | txnBytes += key.size() + self->value.size(); |
| 98 | } |
| 99 | tr.makeSelfConflicting(); |
| 100 | wait(success(tr.getReadVersion())); |
| 101 | wait(tr.commit()); |
| 102 | totalBytes += txnBytes; |
| 103 | break; |
| 104 | } catch (Error& e) { |
| 105 | wait(tr.onError(e)); |
| 106 | ++self->retries; |
| 107 | } |
| 108 | } |
| 109 | self->latencies.addSample(now() - tstart); |
| 110 | ++self->transactions; |
| 111 | idx += self->writesPerTransaction; |
nothing calls this directly
no test coverage detected