|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/relation.h"#include "catalog/pg_type.h"#include "fmgr.h"#include "funcapi.h"#include "storage/aio.h"#include "storage/aio_internal.h"#include "storage/buf_internals.h"#include "storage/bufmgr.h"#include "storage/checksum.h"#include "storage/condition_variable.h"#include "storage/lwlock.h"#include "storage/proc.h"#include "storage/procnumber.h"#include "storage/read_stream.h"#include "utils/array.h"#include "utils/builtins.h"#include "utils/injection_point.h"#include "utils/rel.h"#include "utils/tuplestore.h"#include "utils/wait_event.h"
Go to the source code of this file.
Data Structures | |
| struct | InjIoErrorState |
| struct | BlocksReadStreamData |
Macros | |
| #define | MAX_BUFFERS_TO_EXTEND_BY 64 |
Typedefs | |
| typedef struct InjIoErrorState | InjIoErrorState |
| typedef struct BlocksReadStreamData | BlocksReadStreamData |
Variables | |
| PG_MODULE_MAGIC | |
| static InjIoErrorState * | inj_io_error_state |
| static const ShmemCallbacks | inj_io_shmem_callbacks |
| static PgAioHandle * | last_handle |
| #define MAX_BUFFERS_TO_EXTEND_BY 64 |
Definition at line 145 of file test_aio.c.
References inj_io_shmem_callbacks, process_shared_preload_libraries_in_progress, and RegisterShmemCallbacks().
| Datum batch_end | ( | PG_FUNCTION_ARGS | ) |
Definition at line 982 of file test_aio.c.
References PG_RETURN_VOID, and pgaio_exit_batchmode().
| Datum batch_start | ( | PG_FUNCTION_ARGS | ) |
Definition at line 974 of file test_aio.c.
References PG_RETURN_VOID, and pgaio_enter_batchmode().
Referenced by log_newpages().
| Datum buffer_call_start_io | ( | PG_FUNCTION_ARGS | ) |
Definition at line 610 of file test_aio.c.
References buf, BUFFER_IO_READY_FOR_IO, BufferIsLocal, CurrentResourceOwner, DebugPrintBufferRefcount(), ereport, errhidecontext(), errhidestmt(), errmsg, fb(), GetBufferDescriptor(), GetLocalBufferDescriptor(), LOG, PG_GETARG_BOOL, PG_GETARG_INT32, PG_RETURN_BOOL, ResourceOwnerForgetBufferIO(), result, StartLocalBufferIO(), and StartSharedBufferIO().
| Datum buffer_call_terminate_io | ( | PG_FUNCTION_ARGS | ) |
Definition at line 645 of file test_aio.c.
References BM_IO_ERROR, BM_VALID, buf, BufferIsLocal, DebugPrintBufferRefcount(), ereport, errhidecontext(), errhidestmt(), errmsg, fb(), GetBufferDescriptor(), GetLocalBufferDescriptor(), LOG, PG_GETARG_BOOL, PG_GETARG_INT32, PG_RETURN_VOID, TerminateBufferIO(), and TerminateLocalBufferIO().
| Datum buffer_create_toy | ( | PG_FUNCTION_ARGS | ) |
Definition at line 591 of file test_aio.c.
References AccessExclusiveLock, buf, create_toy_buffer(), NoLock, PG_GETARG_OID, PG_GETARG_UINT32, PG_RETURN_INT32, relation_close(), relation_open(), and ReleaseBuffer().
|
static |
Definition at line 325 of file test_aio.c.
References BM_DIRTY, BM_VALID, buf, BUF_STATE_GET_REFCOUNT, BUFFER_LOCK_UNLOCK, elog, ERROR, fb(), GetBufferDescriptor(), GetLocalBufferDescriptor(), LockBuffer(), LockBufHdr(), MAIN_FORKNUM, pg_atomic_read_u64(), pg_atomic_unlocked_write_u64(), RBM_ZERO_AND_LOCK, ReadBufferExtended(), RelationUsesLocalBuffers, and UnlockBufHdrExt().
Referenced by buffer_create_toy(), and read_rel_block_ll().
| Datum errno_from_string | ( | PG_FUNCTION_ARGS | ) |
Definition at line 156 of file test_aio.c.
References EAGAIN, EINTR, ereport, errcode(), errmsg_internal(), ERROR, fb(), PG_GETARG_TEXT_PP, PG_RETURN_INT32, and text_to_cstring().
| Datum evict_rel | ( | PG_FUNCTION_ARGS | ) |
Definition at line 542 of file test_aio.c.
References AccessExclusiveLock, EvictRelUnpinnedBuffers(), fb(), invalidate_one_block(), MAIN_FORKNUM, MAX_FORKNUM, PG_GETARG_OID, PG_RETURN_VOID, relation_close(), relation_open(), RelationGetSmgr(), RelationUsesLocalBuffers, smgrexists(), and smgrnblocks().
| Datum grow_rel | ( | PG_FUNCTION_ARGS | ) |
Definition at line 179 of file test_aio.c.
References AccessExclusiveLock, BMR_REL, ExtendBufferedRelBy(), fb(), i, MAIN_FORKNUM, MAX_BUFFERS_TO_EXTEND_BY, Min, NoLock, PG_GETARG_OID, PG_GETARG_UINT32, PG_RETURN_VOID, relation_close(), relation_open(), and ReleaseBuffer().
| Datum handle_get | ( | PG_FUNCTION_ARGS | ) |
Definition at line 921 of file test_aio.c.
References CurrentResourceOwner, fb(), last_handle, PG_RETURN_VOID, and pgaio_io_acquire().
| Datum handle_get_and_error | ( | PG_FUNCTION_ARGS | ) |
Definition at line 942 of file test_aio.c.
References CurrentResourceOwner, elog, ERROR, fb(), PG_RETURN_VOID, and pgaio_io_acquire().
| Datum handle_get_release | ( | PG_FUNCTION_ARGS | ) |
Definition at line 962 of file test_aio.c.
References CurrentResourceOwner, fb(), PG_RETURN_VOID, pgaio_io_acquire(), and pgaio_io_release().
| Datum handle_get_twice | ( | PG_FUNCTION_ARGS | ) |
Definition at line 952 of file test_aio.c.
References CurrentResourceOwner, fb(), PG_RETURN_VOID, and pgaio_io_acquire().
| Datum handle_release_last | ( | PG_FUNCTION_ARGS | ) |
Definition at line 930 of file test_aio.c.
References elog, ERROR, last_handle, PG_RETURN_VOID, and pgaio_io_release().
| Datum inj_io_completion_continue | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1186 of file test_aio.c.
References InjIoErrorState::completion_wait_blockno, InjIoErrorState::completion_wait_pid, InjIoErrorState::completion_wait_relfilenode, ConditionVariableBroadcast(), InjIoErrorState::cv, elog, InjIoErrorState::enabled_completion_wait, ERROR, inj_io_error_state, InvalidBlockNumber, InvalidOid, InvalidPid, and PG_RETURN_VOID.
| Datum inj_io_completion_wait | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1167 of file test_aio.c.
References InjIoErrorState::completion_wait_blockno, InjIoErrorState::completion_wait_pid, InjIoErrorState::completion_wait_relfilenode, elog, InjIoErrorState::enabled_completion_wait, ERROR, inj_io_error_state, InvalidBlockNumber, InvalidOid, InvalidPid, PG_ARGISNULL, PG_GETARG_INT32, PG_GETARG_OID, PG_GETARG_UINT32, and PG_RETURN_VOID.
| Datum inj_io_reopen_attach | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1235 of file test_aio.c.
References elog, InjIoErrorState::enabled_reopen, ERROR, inj_io_error_state, and PG_RETURN_VOID.
| Datum inj_io_reopen_detach | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1248 of file test_aio.c.
References elog, InjIoErrorState::enabled_reopen, ERROR, inj_io_error_state, and PG_RETURN_VOID.
| Datum inj_io_short_read_attach | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1203 of file test_aio.c.
References elog, InjIoErrorState::enabled_short_read, ERROR, inj_io_error_state, InvalidOid, InvalidPid, PG_ARGISNULL, PG_GETARG_INT32, PG_GETARG_OID, PG_RETURN_VOID, InjIoErrorState::short_read_pid, InjIoErrorState::short_read_relfilenode, InjIoErrorState::short_read_result, and InjIoErrorState::short_read_result_set.
| Datum inj_io_short_read_detach | ( | PG_FUNCTION_ARGS | ) |
Definition at line 1223 of file test_aio.c.
References elog, InjIoErrorState::enabled_short_read, ERROR, inj_io_error_state, and PG_RETURN_VOID.
|
static |
Definition at line 481 of file test_aio.c.
References BM_DIRTY, buf, BUFFER_LOCK_EXCLUSIVE, BufferIsLocal, BufferIsValid(), elog, ERROR, EvictUnpinnedBuffer(), fb(), FlushLocalBuffer(), FlushOneBuffer(), GetBufferDescriptor(), GetLocalBufferDescriptor(), InvalidateLocalBuffer(), LockBuffer(), pg_atomic_read_u64(), PrefetchBuffer(), RelationData::rd_locator, ReadRecentBuffer(), and UnlockReleaseBuffer().
Referenced by evict_rel(), and invalidate_rel_block().
| Datum invalidate_rel_block | ( | PG_FUNCTION_ARGS | ) |
Definition at line 525 of file test_aio.c.
References AccessExclusiveLock, invalidate_one_block(), MAIN_FORKNUM, PG_GETARG_OID, PG_GETARG_UINT32, PG_RETURN_VOID, relation_close(), and relation_open().
| Datum modify_rel_block | ( | PG_FUNCTION_ARGS | ) |
Definition at line 218 of file test_aio.c.
References AccessExclusiveLock, buf, BUFFER_LOCK_EXCLUSIVE, BufferGetPage(), BufferGetPageSize(), BufferIsLocal, elog, ERROR, EvictUnpinnedBuffer(), fb(), GetLocalBufferDescriptor(), i, InvalidateLocalBuffer(), LockBuffer(), LOG, MAIN_FORKNUM, memcpy(), NoLock, PageInit(), PageIsEmpty(), PageSetChecksum(), palloc_aligned(), pg_checksum_page(), PG_GETARG_BOOL, PG_GETARG_OID, PG_GETARG_UINT32, PG_IO_ALIGN_SIZE, PG_RETURN_VOID, RBM_ZERO_ON_ERROR, ReadBufferExtended(), relation_close(), relation_open(), RelationGetSmgr(), smgrwrite(), and UnlockReleaseBuffer().
| PG_FUNCTION_INFO_V1 | ( | batch_end | ) |
| PG_FUNCTION_INFO_V1 | ( | batch_start | ) |
| PG_FUNCTION_INFO_V1 | ( | buffer_call_start_io | ) |
| PG_FUNCTION_INFO_V1 | ( | buffer_call_terminate_io | ) |
| PG_FUNCTION_INFO_V1 | ( | buffer_create_toy | ) |
| PG_FUNCTION_INFO_V1 | ( | errno_from_string | ) |
| PG_FUNCTION_INFO_V1 | ( | evict_rel | ) |
| PG_FUNCTION_INFO_V1 | ( | grow_rel | ) |
| PG_FUNCTION_INFO_V1 | ( | handle_get | ) |
| PG_FUNCTION_INFO_V1 | ( | handle_get_and_error | ) |
| PG_FUNCTION_INFO_V1 | ( | handle_get_release | ) |
| PG_FUNCTION_INFO_V1 | ( | handle_get_twice | ) |
| PG_FUNCTION_INFO_V1 | ( | handle_release_last | ) |
| PG_FUNCTION_INFO_V1 | ( | inj_io_completion_continue | ) |
| PG_FUNCTION_INFO_V1 | ( | inj_io_completion_wait | ) |
| PG_FUNCTION_INFO_V1 | ( | inj_io_reopen_attach | ) |
| PG_FUNCTION_INFO_V1 | ( | inj_io_reopen_detach | ) |
| PG_FUNCTION_INFO_V1 | ( | inj_io_short_read_attach | ) |
| PG_FUNCTION_INFO_V1 | ( | inj_io_short_read_detach | ) |
| PG_FUNCTION_INFO_V1 | ( | invalidate_rel_block | ) |
| PG_FUNCTION_INFO_V1 | ( | modify_rel_block | ) |
| PG_FUNCTION_INFO_V1 | ( | read_buffers | ) |
| PG_FUNCTION_INFO_V1 | ( | read_rel_block_ll | ) |
| PG_FUNCTION_INFO_V1 | ( | read_stream_for_blocks | ) |
| Datum read_buffers | ( | PG_FUNCTION_ARGS | ) |
Definition at line 696 of file test_aio.c.
References AccessShareLock, Assert, BoolGetDatum(), buf, BufferGetBlockNumber(), construct_array_builtin(), fb(), i, InitMaterializedSRF(), Int32GetDatum(), io_combine_limit, MAIN_FORKNUM, Min, NoLock, operation, palloc0(), pfree(), PG_GETARG_INT32, PG_GETARG_OID, PG_GETARG_UINT32, PointerGetDatum(), RelationData::rd_rel, relation_close(), relation_open(), RelationGetSmgr(), ReleaseBuffer(), StartReadBuffers(), tuplestore_putvalues(), UInt32GetDatum(), values, and WaitReadBuffers().
| Datum read_rel_block_ll | ( | PG_FUNCTION_ARGS | ) |
Definition at line 382 of file test_aio.c.
References AccessShareLock, BufferGetBlock(), BufferIsLocal, create_toy_buffer(), CurrentResourceOwner, RelFileLocator::dbOid, elog, ERROR, fb(), GetBufferDescriptor(), GetLocalBufferDescriptor(), i, ignore_checksum_failure, RelFileLocatorBackend::locator, MAIN_FORKNUM, NoLock, PG_GETARG_BOOL, PG_GETARG_INT32, PG_GETARG_OID, PG_GETARG_UINT32, PG_IOV_MAX, PG_RETURN_VOID, pgaio_enter_batchmode(), pgaio_exit_batchmode(), PGAIO_HCB_LOCAL_BUFFER_READV, PGAIO_HCB_SHARED_BUFFER_READV, PGAIO_HF_REFERENCES_LOCAL, pgaio_io_acquire(), pgaio_io_get_wref(), pgaio_io_register_callbacks(), pgaio_io_set_flag(), pgaio_io_set_handle_data_32(), pgaio_result_report(), PGAIO_RS_ERROR, PGAIO_RS_OK, pgaio_wref_wait(), pgstat_prepare_report_checksum_failure(), READ_BUFFERS_IGNORE_CHECKSUM_FAILURES, READ_BUFFERS_ZERO_ON_ERROR, relation_close(), relation_open(), RelationGetSmgr(), RelationUsesLocalBuffers, ReleaseBuffer(), SMgrRelationData::smgr_rlocator, smgrreleaseall(), smgrstartreadv(), StartLocalBufferIO(), StartSharedBufferIO(), WARNING, and zero_damaged_pages.
| Datum read_stream_for_blocks | ( | PG_FUNCTION_ARGS | ) |
Definition at line 854 of file test_aio.c.
References AccessShareLock, ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_HASNULL, ARR_NDIM, buf, BufferIsValid(), elog, ERROR, fb(), i, InitMaterializedSRF(), Int32GetDatum(), InvalidBuffer, MAIN_FORKNUM, NoLock, PG_GETARG_ARRAYTYPE_P, PG_GETARG_OID, read_stream_begin_relation(), read_stream_end(), read_stream_for_blocks_cb(), READ_STREAM_FULL, read_stream_next_buffer(), relation_close(), relation_open(), ReleaseBuffer(), tuplestore_putvalues(), UInt32GetDatum(), and values.
|
static |
Definition at line 841 of file test_aio.c.
References BlocksReadStreamData::blocks, fb(), and InvalidBlockNumber.
Referenced by read_stream_for_blocks().
Definition at line 131 of file test_aio.c.
References elog, InjectionPointLoad(), and LOG.
Definition at line 102 of file test_aio.c.
References InjIoErrorState::completion_wait_event, ConditionVariableInit(), InjIoErrorState::cv, InjIoErrorState::enabled_completion_wait, InjIoErrorState::enabled_reopen, InjIoErrorState::enabled_short_read, fb(), inj_io_error_state, InjectionPointAttach(), InjectionPointLoad(), and WaitEventInjectionPointNew().
Definition at line 93 of file test_aio.c.
References inj_io_error_state, name, and ShmemRequestStruct.
|
static |
Definition at line 74 of file test_aio.c.
Referenced by inj_io_completion_continue(), inj_io_completion_wait(), inj_io_reopen_attach(), inj_io_reopen_detach(), inj_io_short_read_attach(), inj_io_short_read_detach(), test_aio_shmem_init(), and test_aio_shmem_request().
|
static |
Definition at line 81 of file test_aio.c.
Referenced by _PG_init().
|
static |
Definition at line 88 of file test_aio.c.
Referenced by handle_get(), and handle_release_last().
| PG_MODULE_MAGIC |
Definition at line 43 of file test_aio.c.