MCPcopy Create free account
hub / github.com/baidu/tera / AsyncReadAck

Method AsyncReadAck

src/observer/executor/scanner_impl.cc:499–538  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

497}
498
499void ScannerImpl::AsyncReadAck(std::shared_ptr<NotifyCell> notify_cell) {
500 VLOG(12) << "[time] Check ACK start. [cf:qu] " << notify_cell->observed_column.family
501 << notify_cell->observed_column.qualifier;
502
503 const std::string& ack_qualifier_prefix = GetAckQualifierPrefix(
504 notify_cell->observed_column.family, notify_cell->observed_column.qualifier);
505
506 // use transaction to read column Ack
507 std::shared_ptr<tera::Transaction> row_transaction(
508 notify_cell->table->StartRowTransaction(notify_cell->row));
509 NotificationContext* context = new NotificationContext();
510
511 // read Acks
512 tera::RowReader* row_reader = notify_cell->table->NewRowReader(notify_cell->row);
513
514 const std::string& ack_qualifier =
515 GetAckQualifier(ack_qualifier_prefix, notify_cell->observer->GetObserverName());
516 context->ack_qualifier = ack_qualifier;
517
518 row_reader->AddColumn(notify_cell->observed_column.family, ack_qualifier);
519
520 context->notify_cell = notify_cell;
521 context->scanner_impl = this;
522 context->ack_transaction = row_transaction;
523 row_reader->SetContext(context);
524 row_reader->SetCallBack([](RowReader* ack_reader) {
525 NotificationContext* context = (NotificationContext*)(ack_reader->GetContext());
526 if (!context->scanner_impl->quit_) {
527 context->scanner_impl->transaction_callback_threads_->AddTask(
528 std::bind(&ScannerImpl::ValidateAckConfict, context->scanner_impl, ack_reader));
529 } else {
530 // call auto unlocker
531 delete context;
532 context = NULL;
533 delete ack_reader;
534 }
535 });
536
537 row_transaction->Get(row_reader);
538}
539
540std::string ScannerImpl::GetAckQualifierPrefix(const std::string& family,
541 const std::string& qualifier) const {

Callers

nothing calls this directly

Calls 9

AddTaskMethod · 0.80
StartRowTransactionMethod · 0.45
NewRowReaderMethod · 0.45
GetObserverNameMethod · 0.45
AddColumnMethod · 0.45
SetContextMethod · 0.45
SetCallBackMethod · 0.45
GetContextMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected