pg 1.4.1 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a5aece061d9d89ecf67827b8bdd6db7ea023df6ef00cca23555d9ee8b0e0102d
4
- data.tar.gz: de1b7e0bcdae378c3ccebb1513945f67e95c5f0a36cf7e809cdd30aeeb6c6316
3
+ metadata.gz: 4978742f10cf7b28bae9bb25698563f13a116bbf2aebd503063dd28f2b3e128b
4
+ data.tar.gz: '076801209c5d5e3f49e7bebe46a2bf86c806d8150313a0248649942b81b932bc'
5
5
  SHA512:
6
- metadata.gz: b86daa15aa2ad933127de6876b47d6c68bc0be82014a8c6912c0b95c7dd801be53f1ddab69d1488a12e059323eddb83dd6d40ea74fde19ccbd68fe9830cca130
7
- data.tar.gz: b2fd717ed50bf0886e5daf37eef5e689b8f6170906ab1d8b372f430285c61d03f47a11da783d9ba18592ae8de0f70bc22ec97a274f6b2cf9dde15b7aaceb8727
6
+ metadata.gz: c9e28051c8929433b47b41aaf1fbabf2b708f28044307b66d133da0f6fc2192582a7dda52e4b23ffc9cf2d22bec0a5c7456265331ba1a885828eac99496e0d6d
7
+ data.tar.gz: e5a99bb04b80c6dc2628c72f79b6ce07aa1f15b10dc53ab71f1a5d667bf349171e31611c6217075f3475d611e905db4103f3f5553f2b9bf9a576d857b346f1f2
checksums.yaml.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,17 @@
1
+ == v1.4.3 [2022-08-09] Lars Kanis <lars@greiz-reinsdorf.de>
2
+
3
+ - Avoid memory bloat possible in put_copy_data in pg-1.4.0 to 1.4.2. #473
4
+ - Use Encoding::BINARY for JOHAB, removing some useless code. #472
5
+
6
+
7
+ == v1.4.2 [2022-07-27] Lars Kanis <lars@greiz-reinsdorf.de>
8
+
9
+ Bugfixes:
10
+
11
+ - Properly handle empty host parameter when connecting. #471
12
+ - Update Windows fat binary gem to OpenSSL-1.1.1q.
13
+
14
+
1
15
  == v1.4.1 [2022-06-24] Lars Kanis <lars@greiz-reinsdorf.de>
2
16
 
3
17
  Bugfixes:
data/Rakefile.cross CHANGED
@@ -31,7 +31,7 @@ class CrossLibrary < OpenStruct
31
31
  self.host_platform = toolchain
32
32
 
33
33
  # Cross-compilation constants
34
- self.openssl_version = ENV['OPENSSL_VERSION'] || '1.1.1o'
34
+ self.openssl_version = ENV['OPENSSL_VERSION'] || '1.1.1q'
35
35
  self.postgresql_version = ENV['POSTGRESQL_VERSION'] || '14.4'
36
36
 
37
37
  # Check if symlinks work in the current working directory.
data/ext/pg.c CHANGED
@@ -127,26 +127,6 @@ const char * const (pg_enc_pg2ruby_mapping[][2]) = {
127
127
  static struct st_table *enc_pg2ruby;
128
128
 
129
129
 
130
- /*
131
- * Look up the JOHAB encoding, creating it as a dummy encoding if it's not
132
- * already defined.
133
- */
134
- static rb_encoding *
135
- pg_find_or_create_johab(void)
136
- {
137
- static const char * const aliases[] = { "JOHAB", "Windows-1361", "CP1361" };
138
- int enc_index;
139
- size_t i;
140
-
141
- for (i = 0; i < sizeof(aliases)/sizeof(aliases[0]); ++i) {
142
- enc_index = rb_enc_find_index(aliases[i]);
143
- if (enc_index > 0) return rb_enc_from_index(enc_index);
144
- }
145
-
146
- enc_index = rb_define_dummy_encoding(aliases[0]);
147
- return rb_enc_from_index(enc_index);
148
- }
149
-
150
130
  /*
151
131
  * Return the given PostgreSQL encoding ID as an rb_encoding.
152
132
  *
@@ -187,10 +167,6 @@ pg_get_pg_encname_as_rb_encoding( const char *pg_encname )
187
167
  return rb_enc_find( pg_enc_pg2ruby_mapping[i][1] );
188
168
  }
189
169
 
190
- /* JOHAB isn't a builtin encoding, so make up a dummy encoding if it's seen */
191
- if ( strncmp(pg_encname, "JOHAB", 5) == 0 )
192
- return pg_find_or_create_johab();
193
-
194
170
  /* Fallthrough to ASCII-8BIT */
195
171
  return rb_ascii8bit_encoding();
196
172
  }
data/ext/pg_connection.c CHANGED
@@ -266,6 +266,7 @@ pgconn_s_allocate( VALUE klass )
266
266
  this->encoder_for_put_copy_data = Qnil;
267
267
  this->decoder_for_get_copy_data = Qnil;
268
268
  this->trace_stream = Qnil;
269
+ rb_ivar_set(self, rb_intern("@calls_to_put_copy_data"), INT2FIX(0));
269
270
 
270
271
  return self;
271
272
  }
data/lib/pg/connection.rb CHANGED
@@ -408,7 +408,17 @@ class PG::Connection
408
408
  # See also #copy_data.
409
409
  #
410
410
  def put_copy_data(buffer, encoder=nil)
411
+ # sync_put_copy_data does a non-blocking attept to flush data.
411
412
  until res=sync_put_copy_data(buffer, encoder)
413
+ # It didn't flush immediately and allocation of more buffering memory failed.
414
+ # Wait for all data sent by doing a blocking flush.
415
+ res = flush
416
+ end
417
+
418
+ # And do a blocking flush every 100 calls.
419
+ # This is to avoid memory bloat, when sending the data is slower than calls to put_copy_data happen.
420
+ if (@calls_to_put_copy_data += 1) > 100
421
+ @calls_to_put_copy_data = 0
412
422
  res = flush
413
423
  end
414
424
  res
@@ -431,6 +441,7 @@ class PG::Connection
431
441
  until sync_put_copy_end(*args)
432
442
  flush
433
443
  end
444
+ @calls_to_put_copy_data = 0
434
445
  flush
435
446
  end
436
447
  alias async_put_copy_end put_copy_end
@@ -699,7 +710,7 @@ class PG::Connection
699
710
  c = connect_internal(oopts, errors)
700
711
  return c if c
701
712
  end
702
- elsif iopts[:host]
713
+ elsif iopts[:host] && !iopts[:host].empty?
703
714
  # Resolve DNS in Ruby to avoid blocking state while connecting, when it ...
704
715
  ihosts = iopts[:host].split(",", -1)
705
716
 
data/lib/pg/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module PG
2
2
  # Library version
3
- VERSION = '1.4.1'
3
+ VERSION = '1.4.3'
4
4
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Granger
@@ -36,7 +36,7 @@ cert_chain:
36
36
  oL1mUdzB8KrZL4/WbG5YNX6UTtJbIOu9qEFbBAy4/jtIkJX+dlNoFwd4GXQW1YNO
37
37
  nA==
38
38
  -----END CERTIFICATE-----
39
- date: 2022-06-24 00:00:00.000000000 Z
39
+ date: 2022-08-09 00:00:00.000000000 Z
40
40
  dependencies: []
41
41
  description: Pg is the Ruby interface to the PostgreSQL RDBMS. It works with PostgreSQL
42
42
  9.3 and later.
metadata.gz.sig CHANGED
Binary file