<commit_before>
/*к*/
static inline void __cursor_set_recno(WT_CURSOR_BTREE* cbt, uint64_t v)
{
	cbt->iface.recno = v;
	cbt->recno = v;
}

/*CURSOR_BTREEṹ*/
static inline void __cursor_pos_clear(WT_CURSOR_BTREE* cbt)
{
	cbt->recno = 0;

	cbt->ins = NULL;
	cbt->ins_head = NULL;
	cbt->ins_stack[0] = NULL;

	cbt->cip_saved = NULL;
	cbt->rip_saved = NULL;

	/*flagsWT_CBT_ACTIVEֵ*/
	F_CLR(cbt, ~WT_CBT_ACTIVE);
}

/*Ƿcursorsession,ûУcacheǷģģֱӷһ*/
static inline int __cursor_enter(WT_SESSION_IMPL *session)
{
	/*
	* If there are no other cursors positioned in the session, check
	* whether the cache is full.
	*/
	if (session->ncursors == 0)
		WT_RET(__wt_cache_full_check(session));
	++session->ncursors;
	return (0);
}

/*sessionӦcursorsΪЧ,ûм״̬cursorǽͷΪ˶snapshot*/
static inline void __cursor_leave(WT_SESSION_IMPL* session)
{
	/*
	 * Decrement the count of active cursors in the session.  When that
	 * goes to zero, there are no active cursors, and we can release any
	 * snapshot we're holding for read committed isolation.
	 */

	WT_ASSERT(session, session->ncursors > 0);
	-- session->ncursors;
	if(session->ncursors == 0){
		__wt_txn_read_last(session);
	}
}

/*һCURSOR_BTREE*/
static inline int __curfile_enter(WT_CURSOR_BTREE *cbt)
{
	WT_SESSION_IMPL *session;

	session = (WT_SESSION_IMPL *)cbt->iface.session;

	WT_RET(__cursor_enter(session));
	F_SET(cbt, WT_CBT_ACTIVE);

	return 0;
}

/*cbtиλ*/
static inline int __curfile_leave(WT_CURSOR_BTREE* cbt)
{
	WT_SESSION_IMPL* session;

	session = (WT_SESSION_IMPL *)cbt->iface.session;

	/*cursor_btree״̬activeACTIVEʶ*/
	if(F_ISSET(cbt, WT_CBT_ACTIVE)){
		__cursor_leave(session);
		F_CLR(cbt, WT_CBT_ACTIVE);
	}

	/*ĳpageɾ̫ļ¼ôͷcursorʱ᳢evictpage*/
	if(cbt->ref != NULL && cbt->page_deleted_count > WT_BTREE_DELETE_THRESHOLD)
		__wt_page_evict_soon(cbt->ref->page);

	cbt->page_deleted_count = 0;

	WT_RET(__wt_page_release(session, cbt->ref, 0));
	cbt->ref = NULL;

	return 0;
}

/*sessiondhandlein-use +տʼΪ0ʱtimeofdeathΪ0*/
static inline void __wt_cursor_dhandle_incr_use(WT_SESSION_IMPL* session)
{
	WT_DATA_HANDLE* dhandle;

	dhandle = session->dhandle;

	if(WT_ATOMIC_ADD4(dhandle->session_inuse, 1) == 1 && dhandle->timeofdeath != 0)
		dhandle->timeofdeath = 0;
}

/*sessiondhandlein-use-1*/
static inline void __wt_cursor_dhandle_decr_use(WT_SESSION_IMPL *session)
{
	WT_DATA_HANDLE *dhandle;

	dhandle = session->dhandle;

	/* If we close a handle with a time of death set, clear it. */
	WT_ASSERT(session, dhandle->session_inuse > 0);
	if (WT_ATOMIC_SUB4(dhandle->session_inuse, 1) == 0 && dhandle->timeofdeath != 0)
		dhandle->timeofdeath = 0;
}

/*cbtгʼ*/
static inline int __cursor_func_init(WT_CURSOR_BTREE* cbt, int reenter)
{
	WT_SESSION_IMPL *session;

	session = (WT_SESSION_IMPL*)(cbt->iface.session);
	if(reenter){ /*cbtг*/
		WT_RET(__curfile_leave(cbt));
	}

	/* If the transaction is idle, check that the cache isn't full. */
	WT_RET(__wt_txn_idle_cache_check(session));

	/*cbt*/
	if(!F_ISSET(cbt, WT_CBT_ACTIVE)){
		WT_RET(__curfile_enter(cbt));
	}

	__wt_txn_cursor_op(session);

	return 0;
}

/*cbt*/
static inline int __cursor_reset(WT_CURSOR_BTREE* cbt)
{
	WT_DECL_RET;
	/*cbtг״̬λ*/
	ret = __curfile_leave(cbt);
	__cursor_pos_clear(cbt);

	return ret;
}

/*һ(row)ҶpageslotKVֵԣֵǴcursorvalue*/
static inline __cursor_row_slot_return(WT_CURSOR_BTREE* cbt, WT_ROW* rip, WT_UPDATE* upd)
{
	WT_BTREE *btree;
	WT_ITEM *kb, *vb;
	WT_CELL *cell;
	WT_CELL_UNPACK *unpack, _unpack;<commit_msg>增加事务相关注释<commit_after>
/*к*/
static inline void __cursor_set_recno(WT_CURSOR_BTREE* cbt, uint64_t v)
{
	cbt->iface.recno = v;
	cbt->recno = v;
}

/*CURSOR_BTREEṹ*/
static inline void __cursor_pos_clear(WT_CURSOR_BTREE* cbt)
{
	cbt->recno = 0;

	cbt->ins = NULL;
	cbt->ins_head = NULL;
	cbt->ins_stack[0] = NULL;

	cbt->cip_saved = NULL;
	cbt->rip_saved = NULL;

	/*flagsWT_CBT_ACTIVEֵ*/
	F_CLR(cbt, ~WT_CBT_ACTIVE);
}

/*Ƿcursorsession,ûУcacheǷģģֱӷһ*/
static inline int __cursor_enter(WT_SESSION_IMPL *session)
{
	/*
	* If there are no other cursors positioned in the session, check
	* whether the cache is full.
	*/
	if (session->ncursors == 0)
		WT_RET(__wt_cache_full_check(session));
	++session->ncursors;
	return (0);
}

/*sessionӦcursorsΪЧ,ûм״̬cursorǽͷΪ˶snapshot*/
static inline void __cursor_leave(WT_SESSION_IMPL* session)
{
	/*
	 * Decrement the count of active cursors in the session.  When that
	 * goes to zero, there are no active cursors, and we can release any
	 * snapshot we're holding for read committed isolation.
	 */

	WT_ASSERT(session, session->ncursors > 0);
	-- session->ncursors;
	if(session->ncursors == 0){
		__wt_txn_read_last(session);
	}
}

/*һCURSOR_BTREE*/
static inline int __curfile_enter(WT_CURSOR_BTREE *cbt)
{
	WT_SESSION_IMPL *session;

	session = (WT_SESSION_IMPL *)cbt->iface.session;

	WT_RET(__cursor_enter(session));
	F_SET(cbt, WT_CBT_ACTIVE);

	return 0;
}

/*cbtиλ*/
static inline int __curfile_leave(WT_CURSOR_BTREE* cbt)
{
	WT_SESSION_IMPL* session;

	session = (WT_SESSION_IMPL *)cbt->iface.session;

	/*cursor_btree״̬activeACTIVEʶ*/
	if(F_ISSET(cbt, WT_CBT_ACTIVE)){
		__cursor_leave(session);
		F_CLR(cbt, WT_CBT_ACTIVE);
	}

	/*ĳpageɾ̫ļ¼ôͷcursorʱ᳢evictpage*/
	if(cbt->ref != NULL && cbt->page_deleted_count > WT_BTREE_DELETE_THRESHOLD)
		__wt_page_evict_soon(cbt->ref->page);

	cbt->page_deleted_count = 0;

	WT_RET(__wt_page_release(session, cbt->ref, 0));
	cbt->ref = NULL;

	return 0;
}

/*sessiondhandlein-use +տʼΪ0ʱtimeofdeathΪ0*/
static inline void __wt_cursor_dhandle_incr_use(WT_SESSION_IMPL* session)
{
	WT_DATA_HANDLE* dhandle;

	dhandle = session->dhandle;

	if(WT_ATOMIC_ADD4(dhandle->session_inuse, 1) == 1 && dhandle->timeofdeath != 0)
		dhandle->timeofdeath = 0;
}

/*sessiondhandlein-use-1*/
static inline void __wt_cursor_dhandle_decr_use(WT_SESSION_IMPL *session)
{
	WT_DATA_HANDLE *dhandle;

	dhandle = session->dhandle;

	/* If we close a handle with a time of death set, clear it. */
	WT_ASSERT(session, dhandle->session_inuse > 0);
	if (WT_ATOMIC_SUB4(dhandle->session_inuse, 1) == 0 && dhandle->timeofdeath != 0)
		dhandle->timeofdeath = 0;
}

/*cbtгʼ*/
static inline int __cursor_func_init(WT_CURSOR_BTREE* cbt, int reenter)
{
	WT_SESSION_IMPL *session;

	session = (WT_SESSION_IMPL*)(cbt->iface.session);
	if(reenter){ /*cbtг*/
		WT_RET(__curfile_leave(cbt));
	}

	/* If the transaction is idle, check that the cache isn't full. */
	WT_RET(__wt_txn_idle_cache_check(session));

	/*cbt*/
	if(!F_ISSET(cbt, WT_CBT_ACTIVE)){
		WT_RET(__curfile_enter(cbt));
	}
	/*Ϊһreadcommitedsnapshotύ޸ĵݶԱɼ*/
	__wt_txn_cursor_op(session);

	return 0;
}

/*cbt*/
static inline int __cursor_reset(WT_CURSOR_BTREE* cbt)
{
	WT_DECL_RET;
	/*cbtг״̬λ*/
	ret = __curfile_leave(cbt);
	__cursor_pos_clear(cbt);

	return ret;
}

/*һ(row)ҶpageslotKVֵԣֵǴcursorvalue*/
static inline __cursor_row_slot_return(WT_CURSOR_BTREE* cbt, WT_ROW* rip, WT_UPDATE* upd)
{
	WT_BTREE *btree;
	WT_ITEM *kb, *vb;
	WT_CELL *cell;
	WT_CELL_UNPACK *unpack, _unpack;
{'fraction_non_alphanumeric': 0.1349525725783271, 'fraction_numerical': 0.0077608508192009195, 'mean_word_length': 5.235663082437276, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 73, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5479395', 'n_tokens_mistral': 3136, 'n_tokens_neox': 3036, 'n_words': 546}