MCPcopy Create free account
hub / github.com/DeNA/HandlerSocket-Plugin-for-MySQL / verify_read

Method verify_read

client/hslongrun.cpp:265–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265int
266hs_longrun_thread_base::verify_read(const std::string& k,
267 uint32_t num_rows, uint32_t num_flds, const std::string rrec[4],
268 record_value& rec)
269{
270 const bool op_success = num_rows != 0;
271 int ret = 0;
272 if (!rec.unknown_state) {
273 if (!rec.deleted && !op_success) {
274 ++stat.verify_error_count;
275 if (arg.sh.verbose > 0) {
276 fprintf(stderr, "VERIFY_ERROR: %s wid=%d k=%s "
277 "unexpected_read_failure\n",
278 arg.worker_type.c_str(), arg.id, k.c_str());
279 }
280 ret = 1;
281 } else if (rec.deleted && op_success) {
282 ++stat.verify_error_count;
283 if (arg.sh.verbose > 0) {
284 fprintf(stderr, "VERIFY_ERROR: %s wid=%d k=%s "
285 "unexpected_read_success\n",
286 arg.worker_type.c_str(), arg.id, k.c_str());
287 }
288 ret = 1;
289 } else if (num_flds != 4) {
290 ++stat.verify_error_count;
291 if (arg.sh.verbose > 0) {
292 fprintf(stderr, "VERIFY_ERROR: %s wid=%d k=%s "
293 "unexpected_read_fldnum %d\n",
294 arg.worker_type.c_str(), arg.id, k.c_str(),
295 static_cast<int>(num_flds));
296 }
297 ret = 1;
298 } else if (rec.deleted) {
299 /* nothing to verify */
300 } else {
301 int diff = 0;
302 for (size_t i = 0; i < 4; ++i) {
303 if (rec.values[i] == rrec[i]) {
304 /* ok */
305 } else {
306 diff = 1;
307 }
308 }
309 if (diff) {
310 std::string mess;
311 for (size_t i = 0; i < 4; ++i) {
312 const std::string& expected = rec.values[i];
313 const std::string& val = rrec[i];
314 mess += " " + val + "/" + expected;
315 }
316 if (arg.sh.verbose > 0) {
317 fprintf(stderr, "VERIFY_ERROR: %s wid=%d k=%s "
318 "unexpected_read_value %s\n",
319 arg.worker_type.c_str(), arg.id, k.c_str(), mess.c_str());
320 }
321 ret = 1;
322 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected