Beispiel #1
0
/*
 *	hashrescan() -- rescan an index relation
 */
void
hashrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys,
		   ScanKey orderbys, int norderbys)
{
	HashScanOpaque so = (HashScanOpaque) scan->opaque;
	Relation	rel = scan->indexRelation;

	/*
	 * Before leaving current page, deal with any killed items. Also, ensure
	 * that we acquire lock on current page before calling _hash_kill_items.
	 */
	if (so->numKilled > 0)
	{
		LockBuffer(so->hashso_curbuf, BUFFER_LOCK_SHARE);
		_hash_kill_items(scan);
		LockBuffer(so->hashso_curbuf, BUFFER_LOCK_UNLOCK);
	}

	_hash_dropscanbuf(rel, so);

	/* set position invalid (this will cause _hash_first call) */
	ItemPointerSetInvalid(&(so->hashso_curpos));
	ItemPointerSetInvalid(&(so->hashso_heappos));

	/* Update scan key, if a new one is given */
	if (scankey && scan->numberOfKeys > 0)
	{
		memmove(scan->keyData,
				scankey,
				scan->numberOfKeys * sizeof(ScanKeyData));
	}

	so->hashso_buc_populated = false;
	so->hashso_buc_split = false;
}
Beispiel #2
0
/*
 *	hashendscan() -- close down a scan
 */
void
hashendscan(IndexScanDesc scan)
{
    HashScanOpaque so = (HashScanOpaque) scan->opaque;
    Relation	rel = scan->indexRelation;

    _hash_dropscanbuf(rel, so);

    pfree(so);
    scan->opaque = NULL;
}
Beispiel #3
0
/*
 *	hashendscan() -- close down a scan
 */
void
hashendscan(IndexScanDesc scan)
{
	HashScanOpaque so = (HashScanOpaque) scan->opaque;
	Relation	rel = scan->indexRelation;

	/* Before leaving current page, deal with any killed items */
	if (so->numKilled > 0)
		_hash_kill_items(scan);

	_hash_dropscanbuf(rel, so);

	if (so->killedItems != NULL)
		pfree(so->killedItems);
	pfree(so);
	scan->opaque = NULL;
}
Beispiel #4
0
/*
 *	hashendscan() -- close down a scan
 */
void
hashendscan(IndexScanDesc scan)
{
	HashScanOpaque so = (HashScanOpaque) scan->opaque;
	Relation	rel = scan->indexRelation;

	/*
	 * Before leaving current page, deal with any killed items. Also, ensure
	 * that we acquire lock on current page before calling _hash_kill_items.
	 */
	if (so->numKilled > 0)
	{
		LockBuffer(so->hashso_curbuf, BUFFER_LOCK_SHARE);
		_hash_kill_items(scan);
		LockBuffer(so->hashso_curbuf, BUFFER_LOCK_UNLOCK);
	}

	_hash_dropscanbuf(rel, so);

	if (so->killedItems != NULL)
		pfree(so->killedItems);
	pfree(so);
	scan->opaque = NULL;
}
Beispiel #5
0
/*
 *	hashrescan() -- rescan an index relation
 */
void
hashrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys,
           ScanKey orderbys, int norderbys)
{
    HashScanOpaque so = (HashScanOpaque) scan->opaque;
    Relation	rel = scan->indexRelation;

    _hash_dropscanbuf(rel, so);

    /* set position invalid (this will cause _hash_first call) */
    ItemPointerSetInvalid(&(so->hashso_curpos));
    ItemPointerSetInvalid(&(so->hashso_heappos));

    /* Update scan key, if a new one is given */
    if (scankey && scan->numberOfKeys > 0)
    {
        memmove(scan->keyData,
                scankey,
                scan->numberOfKeys * sizeof(ScanKeyData));
    }

    so->hashso_buc_populated = false;
    so->hashso_buc_split = false;
}