Skip to content

Commit

Permalink
Release 1.6.4 (#869)
Browse files Browse the repository at this point in the history
* Prepare release 1.6.4.

* Update parson vendored-in dependency.

* Update changelog with latest addition.
  • Loading branch information
DimCitus committed Apr 6, 2022
1 parent 679badd commit 9f9456b
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 20 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
### pg_auto_failover v1.6.4 (January 22, 2022) ###

This is a bug fix release for the 1.6 series.

### Added
* Compat with Postgres 15devel. (#838, #842)
* Add support for more environment variables. (#846)
* Add support for tablespaces (#870)

### Fixed
* Handle return events for poll() (#836)
* No need to checkpoint and restart if pg is not running (#839)
* Fix a race condition in node registration. (#847)
* Couple of fixes to the demo app. (#860)
* Check return value of strdup calls (#862)

### pg_auto_failover v1.6.3 (November 5, 2021) ###

This is a bug fix release for the 1.6 series.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ AZURE_LOCATION ?= francecentral
# postgresql-${AZ_PG_VERSION}-auto-failover-${AZ_PGAF_DEB_VERSION}=${AZ_PGAF_VERSION}
AZ_PG_VERSION ?= 13
AZ_PGAF_DEB_VERSION ?= 1.6
AZ_PGAF_DEB_REVISION ?= 1.6.3-1
AZ_PGAF_DEB_REVISION ?= 1.6.4-1

export AZ_PG_VERSION
export AZ_PGAF_DEB_VERSION
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(self, **options):
# The short X.Y version.
version = "1.6"
# The full version, including alpha/beta/rc tags.
release = "1.6.3"
release = "1.6.4"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
Binary file modified docs/fsm.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 31 additions & 9 deletions src/bin/lib/parson/parson.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
SPDX-License-Identifier: MIT
Parson 1.2.1 ( http://kgabis.github.com/parson/ )
Copyright (c) 2012 - 2021 Krzysztof Gabis
Parson 1.3.0 ( http://kgabis.github.com/parson/ )
Copyright (c) 2012 - 2022 Krzysztof Gabis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -31,8 +31,8 @@
#include "parson.h"

#define PARSON_IMPL_VERSION_MAJOR 1
#define PARSON_IMPL_VERSION_MINOR 2
#define PARSON_IMPL_VERSION_PATCH 1
#define PARSON_IMPL_VERSION_MINOR 3
#define PARSON_IMPL_VERSION_PATCH 0

#if (PARSON_VERSION_MAJOR != PARSON_IMPL_VERSION_MAJOR)\
|| (PARSON_VERSION_MINOR != PARSON_IMPL_VERSION_MINOR)\
Expand Down Expand Up @@ -63,8 +63,13 @@
#define STARTING_CAPACITY 16
#define MAX_NESTING 2048

#define FLOAT_FORMAT "%1.17g" /* do not increase precision without incresing NUM_BUF_SIZE */
#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 */
#ifndef PARSON_DEFAULT_FLOAT_FORMAT
#define PARSON_DEFAULT_FLOAT_FORMAT "%1.17g" /* do not increase precision without incresing NUM_BUF_SIZE */
#endif

#ifndef PARSON_NUM_BUF_SIZE
#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 */
#endif

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

static int parson_escape_slashes = 1;

static char *parson_float_format = NULL;

#define IS_CONT(b) (((unsigned char)(b) & 0xC0) == 0x80) /* is utf-8 continuation byte */

typedef int parson_bool_t;
Expand Down Expand Up @@ -1212,7 +1219,11 @@ static int json_serialize_to_buffer_r(const JSON_Value *value, char *buf, int le
if (buf != NULL) {
num_buf = buf;
}
written = sprintf(num_buf, FLOAT_FORMAT, num);
if (parson_float_format) {
written = sprintf(num_buf, parson_float_format, num);
} else {
written = sprintf(num_buf, PARSON_DEFAULT_FLOAT_FORMAT, num);
}
if (written < 0) {
return -1;
}
Expand Down Expand Up @@ -1757,7 +1768,7 @@ JSON_Value * json_value_deep_copy(const JSON_Value *value) {
}

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

size_t json_serialization_size_pretty(const JSON_Value *value) {
char num_buf[NUM_BUF_SIZE]; /* recursively allocating buffer on stack is a bad idea, so let's do it only once */
char num_buf[PARSON_NUM_BUF_SIZE]; /* recursively allocating buffer on stack is a bad idea, so let's do it only once */
int res = json_serialize_to_buffer_r(value, NULL, 0, PARSON_TRUE, num_buf);
return res < 0 ? 0 : (size_t)(res) + 1;
}
Expand Down Expand Up @@ -2422,3 +2433,14 @@ void json_set_allocation_functions(JSON_Malloc_Function malloc_fun, JSON_Free_Fu
void json_set_escape_slashes(int escape_slashes) {
parson_escape_slashes = escape_slashes;
}

void json_set_float_serialization_format(const char *format) {
if (parson_float_format) {
parson_free(parson_float_format);
}
if (!format) {
parson_float_format = NULL;
return;
}
parson_float_format = parson_strdup(format);
}
18 changes: 13 additions & 5 deletions src/bin/lib/parson/parson.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
SPDX-License-Identifier: MIT
Parson 1.2.1 ( http://kgabis.github.com/parson/ )
Copyright (c) 2012 - 2021 Krzysztof Gabis
Parson 1.3.0 ( http://kgabis.github.com/parson/ )
Copyright (c) 2012 - 2022 Krzysztof Gabis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -30,12 +30,15 @@
extern "C"
{
#endif
#if 0
} /* unconfuse xcode */
#endif

#define PARSON_VERSION_MAJOR 1
#define PARSON_VERSION_MINOR 2
#define PARSON_VERSION_PATCH 1
#define PARSON_VERSION_MINOR 3
#define PARSON_VERSION_PATCH 0

#define PARSON_VERSION_STRING "1.2.1"
#define PARSON_VERSION_STRING "1.3.0"

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

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

/* Sets float format used for serialization of numbers.
Make sure it can't serialize to a string longer than PARSON_NUM_BUF_SIZE.
If format is null then the default format is used. */
void json_set_float_serialization_format(const char *format);

/* Parses first JSON value in a file, returns NULL in case of error */
JSON_Value * json_parse_file(const char *filename);

Expand Down
18 changes: 16 additions & 2 deletions src/bin/lib/parson/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
SPDX-License-Identifier: MIT
Parson ( http://kgabis.github.com/parson/ )
Copyright (c) 2012 - 2021 Krzysztof Gabis
Copyright (c) 2012 - 2022 Krzysztof Gabis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -62,6 +62,7 @@ void test_suite_10(void); /* Testing for memory leaks */
void test_suite_11(void); /* Additional things that require testing */
void test_memory_leaks(void);
void test_failing_allocations(void);
void test_custom_number_format(void);

void print_commits_info(const char *username, const char *repo);
void persistence_example(void);
Expand Down Expand Up @@ -97,6 +98,9 @@ int main(int argc, char *argv[]) {
#else
int tests_main(int argc, char *argv[]);
int tests_main(int argc, char *argv[]) {
#endif
#if 0 /* unconfuse xcode */
}
#endif
/* Example functions from readme file: */
/* print_commits_info("torvalds", "linux"); */
Expand Down Expand Up @@ -127,6 +131,7 @@ int tests_main(int argc, char *argv[]) {
test_suite_11();
test_memory_leaks();
test_failing_allocations();
test_custom_number_format();

printf("Tests failed: %d\n", g_tests_failed);
printf("Tests passed: %d\n", g_tests_passed);
Expand Down Expand Up @@ -682,10 +687,19 @@ void test_failing_allocations() {
}
}

json_set_allocation_functions(NULL, NULL);
json_set_allocation_functions(malloc, free);
printf("OK (tested %d failing allocations)\n", n - 1);
g_tests_passed++;
}

void test_custom_number_format() {
char *serialized = NULL;
JSON_Value *val = json_value_init_number(0.6);
json_set_float_serialization_format("%.1f");
serialized = json_serialize_to_string(val);
TEST(STREQ(serialized, "0.6"));
json_free_serialized_string(serialized);
json_value_free(val);
}

void print_commits_info(const char *username, const char *repo) {
Expand Down
2 changes: 1 addition & 1 deletion src/bin/pg_autoctl/azure.c
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,7 @@ azure_prepare_target_versions(KeyVal *env)
/* default values */
sformat(env->values[0], MAXCONNINFO, "13"); /* AZ_PG_VERSION */
sformat(env->values[1], MAXCONNINFO, "1.6"); /* AZ_PGAF_DEB_VERSION */
sformat(env->values[2], MAXCONNINFO, "1.6.3-1"); /* AZ_PGAF_DEB_REVISION */
sformat(env->values[2], MAXCONNINFO, "1.6.4-1"); /* AZ_PGAF_DEB_REVISION */

for (int i = 0; i < 3; i++)
{
Expand Down
2 changes: 1 addition & 1 deletion src/bin/pg_autoctl/defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define PG_AUTOCTL_STATE_VERSION 1

/* additional version information for printing version on CLI */
#define PG_AUTOCTL_VERSION "1.6.3"
#define PG_AUTOCTL_VERSION "1.6.4"

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

0 comments on commit 9f9456b

Please sign in to comment.