Ejemplo n.º 1
0
/*
 *  Sets up udf_record
 * 	Zeroes out stuff
 * 	Setups as_rec in the lchunk
 * 	Sets up transaction and digest
 * 	Sets up the partition reservation (same as parent)
 */
void
slot_init(ldt_slot *lslotp, ldt_record *lrecord)
{
	// It is just a stub fill the proper values in
	udf_record *c_urecord   = &lslotp->c_urecord;
	udf_record_init(c_urecord, true);
	// note: crec cannot be destroyed from inside lua
	c_urecord->flag        |= UDF_RECORD_FLAG_IS_SUBRECORD;
	c_urecord->lrecord      = (void *)lrecord;
	c_urecord->tr           = &lslotp->tr; // set up tr properly
	c_urecord->rd           = &lslotp->rd;
	c_urecord->r_ref        = &lslotp->r_ref;
	lslotp->r_ref.skip_lock = true;
	lslotp->c_urec_p = as_rec_new(c_urecord, &udf_record_hooks);

	udf_record     * h_urecord = (udf_record *)as_rec_source(lrecord->h_urec);
	as_transaction * h_tr      = h_urecord->tr;
	as_transaction * c_tr      = &lslotp->tr;

	c_tr->incoming_cluster_key = h_tr->incoming_cluster_key;

	// Chunk Record Does not respond for proxy request
	c_tr->proto_fd_h           = NULL;       // Need not reply
	c_tr->proxy_node           = 0;          // ??
	c_tr->proxy_msg            = NULL;       // ??

	// Chunk Record Does not respond back to the client
	c_tr->result_code          = 0;
	c_tr->generation           = 0;
	c_tr->void_time            = 0;
	// Set this to grab some info from the msg from client like
	// set name etc ... we do not set it in wr..
	c_tr->msgp                 = h_tr->msgp;

	// We do not track microbenchmark or time for chunk today
	c_tr->microbenchmark_time  = 0;
	c_tr->microbenchmark_is_resolve = false;
	c_tr->start_time           = h_tr->start_time;
	c_tr->end_time             = h_tr->end_time;
	c_tr->trid                 = h_tr->trid;

	// Chunk transaction is always preprocessed
	c_tr->preprocessed         = true;       // keyd is hence preprocessed
	c_tr->flag                 = 0;

	// Parent reservation cannot go away as long as Chunck needs reservation.
	memcpy(&c_tr->rsv, &h_tr->rsv, sizeof(as_partition_reservation));
	//ldt_slot_print(lslotp);
}
Ejemplo n.º 2
0
/*
 * Internal Function: Which initializes ldt chunk array element.
 *
 * Parameters:
 * 		lchunk - ldt_chunk to be initialized
 *
 * Return value : nothing
 *
 * Description:
 * 		1. Sets up udf_record
 * 		2. Zeroes out stuff
 * 		3. Setups as_rec in the lchunk
 *
 * Callers:
 *      ldt_aerospike_crec_open
 *      ldt_aerospike_crec_create
 */
void
ldt_chunk_init(ldt_chunk *lchunk, ldt_record *lrecord)
{
	// It is just a stub fill the proper values in
	udf_record *c_urecord   = &lchunk->c_urecord;
	udf_record_init(c_urecord);
	// note: crec cannot be destroyed from inside lua
	c_urecord->flag        |= UDF_RECORD_FLAG_IS_SUBRECORD;
	c_urecord->lrecord      = (void *)lrecord;
	c_urecord->tr           = &lchunk->tr; // set up tr properly
	c_urecord->rd           = &lchunk->rd;
	c_urecord->r_ref        = &lchunk->r_ref;
	lchunk->r_ref.skip_lock = true;
	lchunk->c_urec_p = as_rec_new(c_urecord, &udf_record_hooks);
}