Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit93bc3d7

Browse files
anarazelnbyavuz
andcommitted
aio: Add test_aio module
To make the tests possible, a few functions from bufmgr.c/localbuf.c had to beexported, via buf_internals.h.Reviewed-by: Noah Misch <noah@leadboat.com>Co-authored-by: Andres Freund <andres@anarazel.de>Co-authored-by: Nazir Bilal Yavuz <byavuz81@gmail.com>Discussion:https://postgr.es/m/uvrtrknj4kdytuboidbhwclo4gxhswwcpgadptsjvjqcluzmah%40brqs62irg4dt
1 parent60f566b commit93bc3d7

File tree

13 files changed

+2622
-8
lines changed

13 files changed

+2622
-8
lines changed

‎src/backend/storage/buffer/bufmgr.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -518,10 +518,6 @@ static uint32 WaitBufHdrUnlocked(BufferDesc *buf);
518518
staticintSyncOneBuffer(intbuf_id,boolskip_recently_used,
519519
WritebackContext*wb_context);
520520
staticvoidWaitIO(BufferDesc*buf);
521-
staticboolStartBufferIO(BufferDesc*buf,boolforInput,boolnowait);
522-
staticvoidTerminateBufferIO(BufferDesc*buf,boolclear_dirty,
523-
uint32set_flag_bits,boolforget_owner,
524-
boolrelease_aio);
525521
staticvoidAbortBufferIO(Bufferbuffer);
526522
staticvoidshared_buffer_write_error_callback(void*arg);
527523
staticvoidlocal_buffer_write_error_callback(void*arg);
@@ -5962,7 +5958,7 @@ WaitIO(BufferDesc *buf)
59625958
* find out if they can perform the I/O as part of a larger operation, without
59635959
* waiting for the answer or distinguishing the reasons why not.
59645960
*/
5965-
staticbool
5961+
bool
59665962
StartBufferIO(BufferDesc*buf,boolforInput,boolnowait)
59675963
{
59685964
uint32buf_state;
@@ -6019,7 +6015,7 @@ StartBufferIO(BufferDesc *buf, bool forInput, bool nowait)
60196015
* resource owner. (forget_owner=false is used when the resource owner itself
60206016
* is being released)
60216017
*/
6022-
staticvoid
6018+
void
60236019
TerminateBufferIO(BufferDesc*buf,boolclear_dirty,uint32set_flag_bits,
60246020
boolforget_owner,boolrelease_aio)
60256021
{

‎src/backend/storage/buffer/localbuf.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ static intNLocalPinnedBuffers = 0;
5757
staticvoidInitLocalBuffers(void);
5858
staticBlockGetLocalBufferStorage(void);
5959
staticBufferGetLocalVictimBuffer(void);
60-
staticvoidInvalidateLocalBuffer(BufferDesc*bufHdr,boolcheck_unreferenced);
6160

6261

6362
/*
@@ -597,7 +596,7 @@ TerminateLocalBufferIO(BufferDesc *bufHdr, bool clear_dirty, uint32 set_flag_bit
597596
*
598597
* See also InvalidateBuffer().
599598
*/
600-
staticvoid
599+
void
601600
InvalidateLocalBuffer(BufferDesc*bufHdr,boolcheck_unreferenced)
602601
{
603602
Bufferbuffer=BufferDescriptorGetBuffer(bufHdr);

‎src/include/storage/buf_internals.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,12 @@ extern void IssuePendingWritebacks(WritebackContext *wb_context, IOContext io_co
434434
externvoidScheduleBufferTagForWriteback(WritebackContext*wb_context,
435435
IOContextio_context,BufferTag*tag);
436436

437+
/* solely to make it easier to write tests */
438+
externboolStartBufferIO(BufferDesc*buf,boolforInput,boolnowait);
439+
externvoidTerminateBufferIO(BufferDesc*buf,boolclear_dirty,uint32set_flag_bits,
440+
boolforget_owner,boolrelease_aio);
441+
442+
437443
/* freelist.c */
438444
externIOContextIOContextForStrategy(BufferAccessStrategystrategy);
439445
externBufferDesc*StrategyGetBuffer(BufferAccessStrategystrategy,
@@ -478,6 +484,7 @@ extern void TerminateLocalBufferIO(BufferDesc *bufHdr, bool clear_dirty,
478484
uint32set_flag_bits,boolrelease_aio);
479485
externboolStartLocalBufferIO(BufferDesc*bufHdr,boolforInput,boolnowait);
480486
externvoidFlushLocalBuffer(BufferDesc*bufHdr,SMgrRelationreln);
487+
externvoidInvalidateLocalBuffer(BufferDesc*bufHdr,boolcheck_unreferenced);
481488
externvoidDropRelationLocalBuffers(RelFileLocatorrlocator,
482489
ForkNumberforkNum,
483490
BlockNumberfirstDelBlock);

‎src/test/modules/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ SUBDIRS = \
1414
oauth_validator\
1515
plsample\
1616
spgist_name_ops\
17+
test_aio\
1718
test_bloomfilter\
1819
test_copy_callbacks\
1920
test_custom_rmgrs\

‎src/test/modules/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ subdir('oauth_validator')
1313
subdir('plsample')
1414
subdir('spgist_name_ops')
1515
subdir('ssl_passphrase_callback')
16+
subdir('test_aio')
1617
subdir('test_bloomfilter')
1718
subdir('test_copy_callbacks')
1819
subdir('test_custom_rmgrs')

‎src/test/modules/test_aio/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Generated subdirectories
2+
/tmp_check/

‎src/test/modules/test_aio/Makefile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# src/test/modules/test_aio/Makefile
2+
3+
PGFILEDESC = "test_aio - test code for AIO"
4+
5+
MODULE_big = test_aio
6+
OBJS =\
7+
$(WIN32RES)\
8+
test_aio.o
9+
10+
EXTENSION = test_aio
11+
DATA = test_aio--1.0.sql
12+
13+
TAP_TESTS = 1
14+
15+
exportenable_injection_points
16+
17+
ifdefUSE_PGXS
18+
PG_CONFIG = pg_config
19+
PGXS :=$(shell$(PG_CONFIG) --pgxs)
20+
include$(PGXS)
21+
else
22+
subdir = src/test/modules/test_aio
23+
top_builddir = ../../../..
24+
include$(top_builddir)/src/Makefile.global
25+
include$(top_srcdir)/contrib/contrib-global.mk
26+
endif

‎src/test/modules/test_aio/meson.build

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Copyright (c) 2024-2025, PostgreSQL Global Development Group
2+
3+
test_aio_sources=files(
4+
'test_aio.c',
5+
)
6+
7+
if host_system=='windows'
8+
test_aio_sources+= rc_lib_gen.process(win32ver_rc,extra_args: [
9+
'--NAME','test_aio',
10+
'--FILEDESC','test_aio - test code for AIO',])
11+
endif
12+
13+
test_aio=shared_module('test_aio',
14+
test_aio_sources,
15+
kwargs: pg_test_mod_args,
16+
)
17+
test_install_libs+= test_aio
18+
19+
test_install_data+=files(
20+
'test_aio.control',
21+
'test_aio--1.0.sql',
22+
)
23+
24+
tests+= {
25+
'name':'test_aio',
26+
'sd':meson.current_source_dir(),
27+
'bd':meson.current_build_dir(),
28+
'tap': {
29+
'env': {
30+
'enable_injection_points':get_option('injection_points') ?'yes' :'no',
31+
},
32+
'tests': [
33+
't/001_aio.pl',
34+
't/002_io_workers.pl',
35+
],
36+
},
37+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp