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

Commit195d596

Browse files
author
Vladimir Ershov
committed
shceduler for 10
1 parentc08857f commit195d596

File tree

6 files changed

+61
-5
lines changed

6 files changed

+61
-5
lines changed

‎src/pgpro_scheduler.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,12 @@ void parent_scheduler_main(Datum arg)
392392
}
393393
}
394394
rc=WaitLatch(MyLatch,
395+
#ifPG_VERSION_NUM<100000
395396
WL_LATCH_SET |WL_POSTMASTER_DEATH,0);
397+
#else
398+
WL_LATCH_SET |WL_POSTMASTER_DEATH,0,
399+
PG_WAIT_EXTENSION);
400+
#endif
396401
CHECK_FOR_INTERRUPTS();
397402
ResetLatch(MyLatch);
398403
}
@@ -411,7 +416,9 @@ pg_scheduler_startup(void)
411416
BGWORKER_BACKEND_DATABASE_CONNECTION;
412417
worker.bgw_start_time=BgWorkerStart_ConsistentState;
413418
worker.bgw_restart_time=10;
419+
#ifPG_VERSION_NUM<100000
414420
worker.bgw_main=NULL;
421+
#endif
415422
worker.bgw_notify_pid=0;
416423
worker.bgw_main_arg=Int32GetDatum(0);
417424
worker.bgw_extra[0]=0;

‎src/sched_manager_poll.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,9 @@ pid_t registerManagerWorker(schd_manager_t *man)
211211
BGWORKER_BACKEND_DATABASE_CONNECTION;
212212
worker.bgw_start_time=BgWorkerStart_ConsistentState;
213213
worker.bgw_restart_time=BGW_NEVER_RESTART;
214+
#ifPG_VERSION_NUM<100000
214215
worker.bgw_main=NULL;
216+
#endif
215217
worker.bgw_main_arg=UInt32GetDatum(dsm_segment_handle(man->shared));
216218
sprintf(worker.bgw_library_name,"pgpro_scheduler");
217219
sprintf(worker.bgw_function_name,"manager_worker_main");

‎src/scheduler_executor.c‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include"utils/builtins.h"
2828
#include"utils/timestamp.h"
2929
#include"utils/memutils.h"
30+
#include"utils/regproc.h"
3031
#include"utils/guc.h"
3132

3233
#include"pgpro_scheduler.h"
@@ -160,7 +161,12 @@ void executor_worker_main(Datum arg)
160161
}
161162

162163
pgstat_report_activity(STATE_IDLE,"waiting for a job");
164+
#ifPG_VERSION_NUM<100000
163165
rc=WaitLatch(MyLatch,WL_LATCH_SET |WL_POSTMASTER_DEATH,0L);
166+
#else
167+
rc=WaitLatch(MyLatch,WL_LATCH_SET |WL_POSTMASTER_DEATH,0L,
168+
PG_WAIT_EXTENSION);
169+
#endif
164170
ResetLatch(MyLatch);
165171
if(rc&&rc&WL_POSTMASTER_DEATH)break;
166172
}
@@ -237,8 +243,6 @@ int do_one_job(schd_executor_share_t *shared, schd_executor_status_t *status)
237243

238244
pgstat_report_activity(STATE_RUNNING,"process job");
239245
CHECK_FOR_INTERRUPTS();
240-
/* rc = WaitLatch(MyLatch, WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, 0);
241-
ResetLatch(MyLatch); */
242246
SetConfigOption("schedule.transaction_state","running",PGC_INTERNAL,PGC_S_SESSION);
243247

244248
if(job->same_transaction)
@@ -737,7 +741,12 @@ void at_executor_worker_main(Datum arg)
737741
{
738742
pgstat_report_activity(STATE_IDLE,"waiting for a job");
739743
rc=WaitLatch(MyLatch,
744+
#ifPG_VERSION_NUM<100000
740745
WL_LATCH_SET |WL_POSTMASTER_DEATH |WL_TIMEOUT,1000L);
746+
#else
747+
WL_LATCH_SET |WL_POSTMASTER_DEATH |WL_TIMEOUT,1000L,
748+
PG_WAIT_EXTENSION);
749+
#endif
741750
ResetLatch(MyLatch);
742751
if(rc&&rc&WL_POSTMASTER_DEATH)break;
743752
lets_sleep= false;

‎src/scheduler_manager.c‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include"utils/snapmgr.h"
2525
#include"utils/builtins.h"
2626
#include"utils/timestamp.h"
27+
#include"utils/regproc.h"
2728
#include<sys/time.h>
2829
#include"utils/lsyscache.h"
2930
#include"catalog/namespace.h"
@@ -304,7 +305,12 @@ int refresh_scheduler_manager_context(scheduler_manager_ctx_t *ctx)
304305
if(got_sighup)return0;/* need to refresh it again */
305306
}
306307
rc=WaitLatch(MyLatch,
308+
#ifPG_VERSION_NUM<100000
307309
WL_LATCH_SET |WL_TIMEOUT |WL_POSTMASTER_DEATH,500L);
310+
#else
311+
WL_LATCH_SET |WL_TIMEOUT |WL_POSTMASTER_DEATH,500L,
312+
PG_WAIT_EXTENSION);
313+
#endif
308314
ResetLatch(MyLatch);
309315
}
310316

@@ -883,7 +889,9 @@ int launch_executor_worker(scheduler_manager_ctx_t *ctx, scheduler_manager_slot_
883889
BGWORKER_BACKEND_DATABASE_CONNECTION;
884890
worker.bgw_start_time=BgWorkerStart_ConsistentState;
885891
worker.bgw_restart_time=BGW_NEVER_RESTART;
892+
#ifPG_VERSION_NUM<100000
886893
worker.bgw_main=NULL;
894+
#endif
887895
worker.bgw_main_arg=UInt32GetDatum(dsm_segment_handle(seg));
888896
sprintf(worker.bgw_library_name,"pgpro_scheduler");
889897
sprintf(worker.bgw_function_name,"executor_worker_main");
@@ -1705,7 +1713,9 @@ int start_at_worker(scheduler_manager_ctx_t *ctx, int pos)
17051713
BGWORKER_BACKEND_DATABASE_CONNECTION;
17061714
worker.bgw_start_time=BgWorkerStart_ConsistentState;
17071715
worker.bgw_restart_time=BGW_NEVER_RESTART;
1716+
#ifPG_VERSION_NUM<100000
17081717
worker.bgw_main=NULL;
1718+
#endif
17091719
worker.bgw_main_arg=UInt32GetDatum(dsm_segment_handle(seg));
17101720
sprintf(worker.bgw_library_name,"pgpro_scheduler");
17111721
sprintf(worker.bgw_function_name,"at_executor_worker_main");
@@ -1882,7 +1892,12 @@ void manager_worker_main(Datum arg)
18821892

18831893
delete_worker_mem_ctx(old);
18841894
rc=WaitLatch(MyLatch,
1895+
#ifPG_VERSION_NUM<100000
18851896
WL_LATCH_SET |WL_TIMEOUT |WL_POSTMASTER_DEATH,1500L);
1897+
#else
1898+
WL_LATCH_SET |WL_TIMEOUT |WL_POSTMASTER_DEATH,1500L,
1899+
PG_WAIT_EXTENSION);
1900+
#endif
18861901
ResetLatch(MyLatch);
18871902
}
18881903
scheduler_manager_stop(ctx);

‎test/perl/runtest.pl‎

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,29 @@
4242
exit(-1);
4343
}
4444

45+
my$data =$dbh->selectall_arrayref('show shared_preload_libraries', {Slice=> {} });
46+
if($data)
47+
{
48+
my$v =$data->[0]->{shared_preload_libraries};
49+
unless($v =~/pgpro_scheduler/)
50+
{
51+
my$cdata =$dbh->selectall_arrayref('show config_file', {Slice=> {} });
52+
if($cdata)
53+
{
54+
printSTDERR"Put 'pgpro_scheduler' into 'shared_preload_libraries'$cdata->[0]->{config_file}.\n";
55+
exit 1;
56+
}
57+
printSTDERR"Put 'pgpro_scheduler' into 'shared_preload_libraries'.\n";
58+
exit 1;
59+
60+
}
61+
}
62+
else
63+
{
64+
printSTDERR"Cannot get information about 'shared_preload_libraries' check config.\n";
65+
exit 2;
66+
}
67+
4568
my@sqls = (
4669
"ALTER SYSTEM SET schedule.enabled=off",
4770
"SELECT pg_reload_conf()",
@@ -86,7 +109,7 @@
86109
);
87110
my$harness = TAP::Harness->new( \%args );
88111
my@tests =glob('t/*.t' );
89-
### @tests = ('t/jobMaxRunTime.t');
112+
## @tests = ('t/jobNextTime.t'); - PGPROEE10 тут валится
90113
$harness->runtests(@tests);
91114

92115

‎test/perl/t/jobWithBlock.t‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ $query = "VACUUM FULL ANALYZE;";
4545
my$sth =$dbh->prepare($query);
4646
$sth->execute();
4747

48-
sleep60;
48+
sleep120;
4949
$query ="SELECT count(*) FROM test_results";
5050
$sth =$dbh->prepare($query);
5151
ok($sth->execute())or (print$DBI::errstrand$dbh->disconnect()and BAIL_OUT);
5252

5353
my$result =$sth->fetchrow_array()and$sth->finish();
54-
ok ($result > 1)orprint"Count <= 1\n";
54+
ok ($result > 1)orprint"Count$result<= 1\n";
5555

5656
my$query ="DELETE FROM test_results;";
5757
$dbh->do($query);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp