Skip to content

Commit 9f9456b

Browse files
authored
Release 1.6.4 (#869)
* Prepare release 1.6.4. * Update parson vendored-in dependency. * Update changelog with latest addition.
1 parent 679badd commit 9f9456b

9 files changed

Lines changed: 80 additions & 20 deletions

File tree

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
### pg_auto_failover v1.6.4 (January 22, 2022) ###
2+
3+
This is a bug fix release for the 1.6 series.
4+
5+
### Added
6+
* Compat with Postgres 15devel. (#838, #842)
7+
* Add support for more environment variables. (#846)
8+
* Add support for tablespaces (#870)
9+
10+
### Fixed
11+
* Handle return events for poll() (#836)
12+
* No need to checkpoint and restart if pg is not running (#839)
13+
* Fix a race condition in node registration. (#847)
14+
* Couple of fixes to the demo app. (#860)
15+
* Check return value of strdup calls (#862)
16+
117
### pg_auto_failover v1.6.3 (November 5, 2021) ###
218

319
This is a bug fix release for the 1.6 series.

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ AZURE_LOCATION ?= francecentral
9999
# postgresql-${AZ_PG_VERSION}-auto-failover-${AZ_PGAF_DEB_VERSION}=${AZ_PGAF_VERSION}
100100
AZ_PG_VERSION ?= 13
101101
AZ_PGAF_DEB_VERSION ?= 1.6
102-
AZ_PGAF_DEB_REVISION ?= 1.6.3-1
102+
AZ_PGAF_DEB_REVISION ?= 1.6.4-1
103103

104104
export AZ_PG_VERSION
105105
export AZ_PGAF_DEB_VERSION

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def __init__(self, **options):
7373
# The short X.Y version.
7474
version = "1.6"
7575
# The full version, including alpha/beta/rc tags.
76-
release = "1.6.3"
76+
release = "1.6.4"
7777

7878
# The language for content autogenerated by Sphinx. Refer to documentation
7979
# for a list of supported languages.

docs/fsm.png

61.3 KB
Loading

src/bin/lib/parson/parson.c

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
SPDX-License-Identifier: MIT
33
4-
Parson 1.2.1 ( http://kgabis.github.com/parson/ )
5-
Copyright (c) 2012 - 2021 Krzysztof Gabis
4+
Parson 1.3.0 ( http://kgabis.github.com/parson/ )
5+
Copyright (c) 2012 - 2022 Krzysztof Gabis
66
77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal
@@ -31,8 +31,8 @@
3131
#include "parson.h"
3232

3333
#define PARSON_IMPL_VERSION_MAJOR 1
34-
#define PARSON_IMPL_VERSION_MINOR 2
35-
#define PARSON_IMPL_VERSION_PATCH 1
34+
#define PARSON_IMPL_VERSION_MINOR 3
35+
#define PARSON_IMPL_VERSION_PATCH 0
3636

3737
#if (PARSON_VERSION_MAJOR != PARSON_IMPL_VERSION_MAJOR)\
3838
|| (PARSON_VERSION_MINOR != PARSON_IMPL_VERSION_MINOR)\
@@ -63,8 +63,13 @@
6363
#define STARTING_CAPACITY 16
6464
#define MAX_NESTING 2048
6565

66-
#define FLOAT_FORMAT "%1.17g" /* do not increase precision without incresing NUM_BUF_SIZE */
67-
#define NUM_BUF_SIZE 64 /* double printed with "%1.17g" shouldn't be longer than 25 bytes so let's be paranoid and use 64 */
66+
#ifndef PARSON_DEFAULT_FLOAT_FORMAT
67+
#define PARSON_DEFAULT_FLOAT_FORMAT "%1.17g" /* do not increase precision without incresing NUM_BUF_SIZE */
68+
#endif
69+
70+
#ifndef PARSON_NUM_BUF_SIZE
71+
#define PARSON_NUM_BUF_SIZE 64 /* double printed with "%1.17g" shouldn't be longer than 25 bytes so let's be paranoid and use 64 */
72+
#endif
6873

6974
#define SIZEOF_TOKEN(a) (sizeof(a) - 1)
7075
#define SKIP_CHAR(str) ((*str)++)
@@ -87,6 +92,8 @@ static JSON_Free_Function parson_free = free;
8792

8893
static int parson_escape_slashes = 1;
8994

95+
static char *parson_float_format = NULL;
96+
9097
#define IS_CONT(b) (((unsigned char)(b) & 0xC0) == 0x80) /* is utf-8 continuation byte */
9198

9299
typedef int parson_bool_t;
@@ -1212,7 +1219,11 @@ static int json_serialize_to_buffer_r(const JSON_Value *value, char *buf, int le
12121219
if (buf != NULL) {
12131220
num_buf = buf;
12141221
}
1215-
written = sprintf(num_buf, FLOAT_FORMAT, num);
1222+
if (parson_float_format) {
1223+
written = sprintf(num_buf, parson_float_format, num);
1224+
} else {
1225+
written = sprintf(num_buf, PARSON_DEFAULT_FLOAT_FORMAT, num);
1226+
}
12161227
if (written < 0) {
12171228
return -1;
12181229
}
@@ -1757,7 +1768,7 @@ JSON_Value * json_value_deep_copy(const JSON_Value *value) {
17571768
}
17581769

17591770
size_t json_serialization_size(const JSON_Value *value) {
1760-
char num_buf[NUM_BUF_SIZE]; /* recursively allocating buffer on stack is a bad idea, so let's do it only once */
1771+
char num_buf[PARSON_NUM_BUF_SIZE]; /* recursively allocating buffer on stack is a bad idea, so let's do it only once */
17611772
int res = json_serialize_to_buffer_r(value, NULL, 0, PARSON_FALSE, num_buf);
17621773
return res < 0 ? 0 : (size_t)(res) + 1;
17631774
}
@@ -1817,7 +1828,7 @@ char * json_serialize_to_string(const JSON_Value *value) {
18171828
}
18181829

18191830
size_t json_serialization_size_pretty(const JSON_Value *value) {
1820-
char num_buf[NUM_BUF_SIZE]; /* recursively allocating buffer on stack is a bad idea, so let's do it only once */
1831+
char num_buf[PARSON_NUM_BUF_SIZE]; /* recursively allocating buffer on stack is a bad idea, so let's do it only once */
18211832
int res = json_serialize_to_buffer_r(value, NULL, 0, PARSON_TRUE, num_buf);
18221833
return res < 0 ? 0 : (size_t)(res) + 1;
18231834
}
@@ -2422,3 +2433,14 @@ void json_set_allocation_functions(JSON_Malloc_Function malloc_fun, JSON_Free_Fu
24222433
void json_set_escape_slashes(int escape_slashes) {
24232434
parson_escape_slashes = escape_slashes;
24242435
}
2436+
2437+
void json_set_float_serialization_format(const char *format) {
2438+
if (parson_float_format) {
2439+
parson_free(parson_float_format);
2440+
}
2441+
if (!format) {
2442+
parson_float_format = NULL;
2443+
return;
2444+
}
2445+
parson_float_format = parson_strdup(format);
2446+
}

src/bin/lib/parson/parson.h

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
SPDX-License-Identifier: MIT
33
4-
Parson 1.2.1 ( http://kgabis.github.com/parson/ )
5-
Copyright (c) 2012 - 2021 Krzysztof Gabis
4+
Parson 1.3.0 ( http://kgabis.github.com/parson/ )
5+
Copyright (c) 2012 - 2022 Krzysztof Gabis
66
77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal
@@ -30,12 +30,15 @@
3030
extern "C"
3131
{
3232
#endif
33+
#if 0
34+
} /* unconfuse xcode */
35+
#endif
3336

3437
#define PARSON_VERSION_MAJOR 1
35-
#define PARSON_VERSION_MINOR 2
36-
#define PARSON_VERSION_PATCH 1
38+
#define PARSON_VERSION_MINOR 3
39+
#define PARSON_VERSION_PATCH 0
3740

38-
#define PARSON_VERSION_STRING "1.2.1"
41+
#define PARSON_VERSION_STRING "1.3.0"
3942

4043
#include <stddef.h> /* size_t */
4144

@@ -72,6 +75,11 @@ void json_set_allocation_functions(JSON_Malloc_Function malloc_fun, JSON_Free_Fu
7275
This function sets a global setting and is not thread safe. */
7376
void json_set_escape_slashes(int escape_slashes);
7477

78+
/* Sets float format used for serialization of numbers.
79+
Make sure it can't serialize to a string longer than PARSON_NUM_BUF_SIZE.
80+
If format is null then the default format is used. */
81+
void json_set_float_serialization_format(const char *format);
82+
7583
/* Parses first JSON value in a file, returns NULL in case of error */
7684
JSON_Value * json_parse_file(const char *filename);
7785

src/bin/lib/parson/tests.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
SPDX-License-Identifier: MIT
33
44
Parson ( http://kgabis.github.com/parson/ )
5-
Copyright (c) 2012 - 2021 Krzysztof Gabis
5+
Copyright (c) 2012 - 2022 Krzysztof Gabis
66
77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal
@@ -62,6 +62,7 @@ void test_suite_10(void); /* Testing for memory leaks */
6262
void test_suite_11(void); /* Additional things that require testing */
6363
void test_memory_leaks(void);
6464
void test_failing_allocations(void);
65+
void test_custom_number_format(void);
6566

6667
void print_commits_info(const char *username, const char *repo);
6768
void persistence_example(void);
@@ -97,6 +98,9 @@ int main(int argc, char *argv[]) {
9798
#else
9899
int tests_main(int argc, char *argv[]);
99100
int tests_main(int argc, char *argv[]) {
101+
#endif
102+
#if 0 /* unconfuse xcode */
103+
}
100104
#endif
101105
/* Example functions from readme file: */
102106
/* print_commits_info("torvalds", "linux"); */
@@ -127,6 +131,7 @@ int tests_main(int argc, char *argv[]) {
127131
test_suite_11();
128132
test_memory_leaks();
129133
test_failing_allocations();
134+
test_custom_number_format();
130135

131136
printf("Tests failed: %d\n", g_tests_failed);
132137
printf("Tests passed: %d\n", g_tests_passed);
@@ -682,10 +687,19 @@ void test_failing_allocations() {
682687
}
683688
}
684689

685-
json_set_allocation_functions(NULL, NULL);
690+
json_set_allocation_functions(malloc, free);
686691
printf("OK (tested %d failing allocations)\n", n - 1);
687692
g_tests_passed++;
693+
}
688694

695+
void test_custom_number_format() {
696+
char *serialized = NULL;
697+
JSON_Value *val = json_value_init_number(0.6);
698+
json_set_float_serialization_format("%.1f");
699+
serialized = json_serialize_to_string(val);
700+
TEST(STREQ(serialized, "0.6"));
701+
json_free_serialized_string(serialized);
702+
json_value_free(val);
689703
}
690704

691705
void print_commits_info(const char *username, const char *repo) {

src/bin/pg_autoctl/azure.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ azure_prepare_target_versions(KeyVal *env)
11421142
/* default values */
11431143
sformat(env->values[0], MAXCONNINFO, "13"); /* AZ_PG_VERSION */
11441144
sformat(env->values[1], MAXCONNINFO, "1.6"); /* AZ_PGAF_DEB_VERSION */
1145-
sformat(env->values[2], MAXCONNINFO, "1.6.3-1"); /* AZ_PGAF_DEB_REVISION */
1145+
sformat(env->values[2], MAXCONNINFO, "1.6.4-1"); /* AZ_PGAF_DEB_REVISION */
11461146

11471147
for (int i = 0; i < 3; i++)
11481148
{

src/bin/pg_autoctl/defaults.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#define PG_AUTOCTL_STATE_VERSION 1
1515

1616
/* additional version information for printing version on CLI */
17-
#define PG_AUTOCTL_VERSION "1.6.3"
17+
#define PG_AUTOCTL_VERSION "1.6.4"
1818

1919
/* version of the extension that we requite to talk to on the monitor */
2020
#define PG_AUTOCTL_EXTENSION_VERSION "1.6"

0 commit comments

Comments
 (0)