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

Commit8060672

Browse files
author
Artem Fadeev
committed
Fix svace warnings
Fixed arithmetics in check_dsa_file_size to avoid server startup failurewhen aqo.dsm_size_max in bytes overflows signed integer. Updatedcorresponding tap-test.Two unreachable paths were removed.(cherry-picked from master with a minor change in tap-test)
1 parentbc900f7 commit8060672

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

‎cardinality_hooks.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,6 @@ aqo_estimate_num_groups(PlannerInfo *root, List *groupExprs,
447447
/* It is unclear that to do in situation of such kind. Just report it */
448448
elog(WARNING,"AQO is in the middle of the estimate_num_groups_hook chain");
449449

450-
if (groupExprs==NIL)
451-
return1.0;
452-
453450
old_ctx_m=MemoryContextSwitchTo(AQOPredictMemCtx);
454451

455452
predicted=predict_num_groups(root,subpath,groupExprs,&fss);

‎storage.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -968,8 +968,6 @@ aqo_get_file_size(const char *filename)
968968
ereport(LOG,
969969
(errcode_for_file_access(),
970970
errmsg("could not read file \"%s\": %m",filename)));
971-
if (file)
972-
FreeFile(file);
973971
unlink(filename);
974972
return-1;
975973
}
@@ -981,7 +979,7 @@ check_dsa_file_size(void)
981979
longdata_size=aqo_get_file_size(PGAQO_DATA_FILE);
982980

983981
if (qtext_size==-1||data_size==-1||
984-
qtext_size+data_size >=dsm_size_max*1024*1024)
982+
((unsigned long)qtext_size+(unsigned long)data_size) >>20 >=dsm_size_max)
985983
{
986984
elog(ERROR,"aqo.dsm_size_max is too small");
987985
}

‎t/004_dsm_size_max.pl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use PostgreSQL::Test::Cluster;
66
use PostgreSQL::Test::Utils;
77

8-
use Test::Moretests=>5;
8+
use Test::Moretests=>6;
99

1010
my$node = PostgreSQL::Test::Cluster->new('aqotest');
1111
$node->init;
@@ -58,6 +58,12 @@
5858
$node->psql('postgres','select * from aqo_reset();');
5959
$node->stop();
6060

61+
# 3000mb (more than 2*31 bytes) overflows 4-byte signed int
62+
$node->append_conf('postgresql.conf','aqo.dsm_size_max = 3000');
63+
is($node->start(fail_ok=> 1), 1,"Large aqo.dsm_size_max doesn't cause integer overflow");
64+
$node->stop();
65+
66+
6167
my$regex;
6268
$long_string ='a'x100000;
6369
$regex =qr/.*WARNING:\[AQO\] Not enough DSA\. AQO was disabled for this query/;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp