Esempio n. 1
0
/*
 * Internal Function: Which sets up ldt chunk array element.
 *
 * Parameters:
 * 		lchunk  - ldt_chunk to be setup
 * 		h_urec    - initialized
 * 		keyd    - digest of the subrecord
 *
 * Return value : nothing
 *
 * Description:
 * 		1. Sets up transaction and digest
 * 		2. Sets up the partition reservation (same as parent)
 *
 * Callers:
 *      ldt_aerospike_crec_open
 *      ldt_aerospike_crec_create
 */
void
ldt_chunk_setup(ldt_chunk *lchunk, as_rec *h_urec, cf_digest *keyd)
{
	udf_record     * h_urecord = (udf_record *)as_rec_source(h_urec);
	as_transaction * h_tr      = h_urecord->tr;
	as_transaction * c_tr      = &lchunk->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;
	// 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));
	c_tr->keyd                 = *keyd;
	udf_record *c_urecord      = (udf_record *)as_rec_source(lchunk->c_urec_p);
	c_urecord->keyd            = *keyd;

	// There are 4 place digest is
	// 1. tr->keyd
	// 2. r_ref->r->key
	// 3. rd->keyd
	// 4. urecord->keyd
	//
	// First three are always equal. At the start tr->keyd is setup which then
	// sets or gets r_ref / rd as normal work goes ...
	//
	// urecord->keyd is the digest which gets exposed to lua world. In this
	// version bits are always set to zero.
	cf_detail(AS_LDT, "LDT_VERSION Resetting @ create LDT version %p", *(uint64_t *)&c_urecord->keyd);
	as_ldt_subdigest_resetversion(&c_urecord->keyd);
}
Esempio n. 2
0
void
slot_setup_digest(ldt_slot *lslotp, cf_digest *keyd)
{
	as_transaction * c_tr      = &lslotp->tr;
	c_tr->keyd                 = *keyd;
	udf_record *c_urecord      = (udf_record *)as_rec_source(lslotp->c_urec_p);
	c_urecord->keyd            = *keyd;

	// There are 4 place digest is
	// 1. tr->keyd
	// 2. r_ref->r->key
	// 3. rd->keyd
	// 4. urecord->keyd
	//
	// First three are always equal. At the start tr->keyd is setup which then
	// sets or gets r_ref / rd as normal work goes ...
	//
	// urecord->keyd is the digest which gets exposed to lua world. In this
	// version bits are always set to zero.
	cf_detail(AS_LDT, "LDT_VERSION Resetting @ create LDT version %p", *(uint64_t *)&c_urecord->keyd);
	as_ldt_subdigest_resetversion(&c_urecord->keyd);

}