Example #1
0
static ib_status_t ib_streamedit_callback(
    ib_tx_t                   *tx,
    ib_server_direction_t      dir,
    off_t                      start,
    size_t                     bytes,
    const char                *repl,
    size_t                     repl_len,
    void                      *dummy
)
{
    ib_status_t rc;
    ib_vector_t *edits;
    edit_t edit;
    ngxib_req_ctx *ctx = tx->sctx;
    if (dir == IB_SERVER_REQUEST) {
#if 0
        edits = ctx->in.edits;
        if (edits == NULL) {
            rc = ib_vector_create(&edits, tx->mm, 0);
            assert((rc == IB_OK) && (edits != NULL));
            ctx->in.edits = edits;
        }
#else
        return IB_ENOTIMPL;
#endif
    }
    else {
        edits = ctx->out.edits;
        if (edits == NULL) {
            rc = ib_vector_create(&edits, tx->mm, 0);
            assert((rc == IB_OK) && (edits != NULL));
            ctx->out.edits = edits;
        }
    }
    edit.start = start;
    edit.bytes = bytes;
    edit.repl = repl;
    edit.repl_len = repl_len;

    rc = ib_vector_append(edits, &edit, sizeof(edit_t));
    assert(rc == IB_OK);

    return rc;
}
Example #2
0
static ib_status_t ib_streamedit_callback(
    ib_tx_t                   *tx,
    ib_server_direction_t      dir,
    off_t                      start,
    size_t                     bytes,
    const char                *repl,
    size_t                     repl_len,
    void                      *dummy
)
{
    ib_status_t rc;
    edit_t edit;
    tsib_txn_ctx *txndata = tx->sctx;
    tsib_filter_ctx *fctx = (dir == tsib_direction_client_req.dir)
                                 ? &txndata->in
                                 : &txndata->out;
    /* Check we're in time to edit this stream */
    if (fctx->bytes_done > (size_t)start) {
        ib_log_error_tx(tx, "Tried to edit data that's already been forwarded");
        rc = IB_EINVAL;
    }
    else { /* All's well */
        if (!fctx->edits) {
            rc = ib_vector_create(&fctx->edits, tx->mm, 0);
            assert((rc == IB_OK) && (fctx->edits != NULL));
        }
        edit.start = start;
        edit.bytes = bytes;
        edit.repl = repl;
        edit.repl_len = repl_len;

        rc = ib_vector_append(fctx->edits, &edit, sizeof(edit_t));
        assert(rc == IB_OK);
    }

    return rc;
}
Example #3
0
/****************************************************************//**
Creates and initializes a transaction object.
@return	own: the transaction */
UNIV_INTERN
trx_t*
trx_create(
/*=======*/
	sess_t*	sess)	/*!< in: session */
{
	trx_t*	trx;

	ut_ad(mutex_own(&kernel_mutex));
	ut_ad(sess);

	trx = mem_alloc(sizeof(trx_t));

	trx->magic_n = TRX_MAGIC_N;

	trx->op_info = "";

	trx->is_purge = 0;
	trx->is_recovered = 0;
	trx->conc_state = TRX_NOT_STARTED;
	trx->start_time = time(NULL);

	trx->isolation_level = TRX_ISO_REPEATABLE_READ;

	trx->id = ut_dulint_zero;
	trx->no = ut_dulint_max;

	trx->support_xa = TRUE;

	trx->check_foreigns = TRUE;
	trx->check_unique_secondary = TRUE;

	trx->flush_log_later = FALSE;
	trx->must_flush_log_later = FALSE;

	trx->dict_operation = TRX_DICT_OP_NONE;
	trx->table_id = ut_dulint_zero;

	trx->mysql_thd = NULL;
	trx->active_trans = 0;
	trx->duplicates = 0;

	trx->n_mysql_tables_in_use = 0;
	trx->mysql_n_tables_locked = 0;

	trx->mysql_log_file_name = NULL;
	trx->mysql_log_offset = 0;

	mutex_create(&trx->undo_mutex, SYNC_TRX_UNDO);

	trx->rseg = NULL;

	trx->undo_no = ut_dulint_zero;
	trx->last_sql_stat_start.least_undo_no = ut_dulint_zero;
	trx->insert_undo = NULL;
	trx->update_undo = NULL;
	trx->undo_no_arr = NULL;

	trx->error_state = DB_SUCCESS;
	trx->error_key_num = 0;
	trx->detailed_error[0] = '\0';

	trx->sess = sess;
	trx->que_state = TRX_QUE_RUNNING;
	trx->n_active_thrs = 0;

	trx->handling_signals = FALSE;

	UT_LIST_INIT(trx->signals);
	UT_LIST_INIT(trx->reply_signals);

	trx->graph = NULL;

	trx->wait_lock = NULL;
	trx->was_chosen_as_deadlock_victim = FALSE;
	UT_LIST_INIT(trx->wait_thrs);

	trx->lock_heap = mem_heap_create_in_buffer(256);
	UT_LIST_INIT(trx->trx_locks);

	UT_LIST_INIT(trx->trx_savepoints);

	trx->dict_operation_lock_mode = 0;
	trx->has_search_latch = FALSE;
	trx->search_latch_timeout = BTR_SEA_TIMEOUT;

	trx->declared_to_be_inside_innodb = FALSE;
	trx->n_tickets_to_enter_innodb = 0;

	trx->global_read_view_heap = mem_heap_create(256);
	trx->global_read_view = NULL;
	trx->read_view = NULL;

	/* Set X/Open XA transaction identification to NULL */
	memset(&trx->xid, 0, sizeof(trx->xid));
	trx->xid.formatID = -1;

	trx->n_autoinc_rows = 0;

	/* Remember to free the vector explicitly. */
	trx->autoinc_locks = ib_vector_create(
		mem_heap_create(sizeof(ib_vector_t) + sizeof(void*) * 4), 4);

	return(trx);
}