-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
45472: storage/engine: Teeing engine fixes r=itsbilal a=itsbilal This change introduces some misc teeing engine fixes, such as proper cache initialization, copying of SSTs before ingestions (now that pebble also deletes SSTs after an Ingest), and better null msg handling in GetProto. The cache part fixes a segfault in GetStats. Fixes #42654 . Release note: None. 45607: sql: fix usages of ActiveVersionOrEmpty in {create, alter}_table.go r=irfansharif a=rohany Fixes #45519. This PR removes an incorrect usage of ActiveVersionOrEmpty in alter_table.go, and updates a comment in create_table.go detailing its usage. Release note: None 45609: sql: support star-expanding label-less tuples + numeric tuple indexing r=RaduBerinde a=knz Requested by @RaduBerinde / @ajwerner . Previously, it was impossible to use `(t).*` to expand a single tuple-typed column into multiple projections if the tuple was not labeled to start with. This limitation was caused by another limitation, that it was not possible to refer to a single column in a tuple if the tuple was not already labeled. This patch addresses both limitations. Release note (sql change): CockroachDB now supports expanding all columns of a tuple using the `.*` notation, for example `SELECT (t).* FROM (SELECT (1,'b',2.3) AS t)`. This is a CockroachDB-specific extension. Release note (sql change): CockroachDB now supports accessing the Nth column in a column with tuple type using the syntax `(...).@N`, for example `SELECT (t).@2 FROM (SELECT (1,'b',2.3) AS t)`. This is a CockroachDB-specific extension. 45613: pgwire: fix decimal decoding with trailing zeroes r=jordanlewis a=otan Resolves #25460 In addition to the release note, I have also modified the docker runfile to support elixir tests, and also updated the elixir tests to be run. Release note (bug fix): In previous PRs, drivers that do not truncate trailing zeroes for decimals in the binary format end up having inaccuracies of up to 10^4 during the decode step. In this PR, we fix the error by truncating the trailing zeroes as appropriate. This fixes known incorrect decoding cases with Postgrex in Elixir. Co-authored-by: Bilal Akhtar <bilal@cockroachlabs.com> Co-authored-by: Rohan Yadav <rohany@alumni.cmu.edu> Co-authored-by: Raphael 'kena' Poss <knz@thaumogen.net> Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
- Loading branch information
Showing
32 changed files
with
480 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Used by "mix format" | ||
[ | ||
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# The directory Mix will write compiled artifacts to. | ||
/_build/ | ||
|
||
# If you run "mix test --cover", coverage assets end up here. | ||
/cover/ | ||
|
||
# The directory Mix downloads your dependencies sources to. | ||
/deps/ | ||
|
||
# Where third-party dependencies like ExDoc output generated docs. | ||
/doc/ | ||
|
||
# Ignore .fetch files in case you like to edit your project deps locally. | ||
/.fetch | ||
|
||
# If the VM crashes, it generates a dump, let's ignore it too. | ||
erl_crash.dump | ||
|
||
# Also ignore archive artifacts (built via "mix archive.build"). | ||
*.ez | ||
|
||
# Ignore package tarball (built via "mix hex.build"). | ||
debug-*.tar | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
defmodule Cockroach.MixProject do | ||
use Mix.Project | ||
|
||
def project do | ||
[ | ||
app: :debug, | ||
version: "0.1.0", | ||
start_permanent: Mix.env() == :prod, | ||
deps: deps() | ||
] | ||
end | ||
|
||
def application do | ||
[ | ||
extra_applications: [:logger] | ||
] | ||
end | ||
|
||
defp deps do | ||
[{:postgrex, "~> 0.13", hex: :postgrex_cdb, override: true}] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
%{ | ||
"connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm", "4a0850c9be22a43af9920a71ab17c051f5f7d45c209e40269a1938832510e4d9"}, | ||
"db_connection": {:hex, :db_connection, "1.1.3", "89b30ca1ef0a3b469b1c779579590688561d586694a3ce8792985d4d7e575a61", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: true]}, {:sbroker, "~> 1.0", [hex: :sbroker, repo: "hexpm", optional: true]}], "hexpm", "5f0a16a58312a610d5eb0b07506280c65f5137868ad479045f2a2dc4ced80550"}, | ||
"decimal": {:hex, :decimal, "1.8.1", "a4ef3f5f3428bdbc0d35374029ffcf4ede8533536fa79896dd450168d9acdf3c", [:mix], [], "hexpm", "3cb154b00225ac687f6cbd4acc4b7960027c757a5152b369923ead9ddbca7aec"}, | ||
"postgrex": {:hex, :postgrex_cdb, "0.13.5", "83f818ea1b959d176c694bb60c36f42080c36a7413f0d3b05d58ef2093fe17f5", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 1.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "1a01ba25472ad33bafbac6f042fde2dbab93e23bdaa49ffa3722926165c1052f"}, | ||
} |
63 changes: 63 additions & 0 deletions
63
pkg/acceptance/testdata/elixir/test_crdb/test/decimal_test.exs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
defmodule Cockroach.TestDecimal do | ||
use ExUnit.Case | ||
|
||
test "handles decimal correctly" do | ||
ssl_opts = [certfile: System.get_env("PGSSLCERT"), keyfile: System.get_env("PGSSLKEY")] | ||
{port, _} = Integer.parse(System.get_env("PGPORT") || "26257") | ||
{start_ok, pid} = Postgrex.start_link( | ||
hostname: System.get_env("PGHOST") || "localhost", | ||
username: System.get_env("PGUSER") || "root", | ||
password: "", | ||
database: "testdb", | ||
port: port, | ||
ssl: (System.get_env("PGSSLCERT") != nil && true) || false, | ||
ssl_opts: ssl_opts | ||
) | ||
assert start_ok | ||
for dec <- [ | ||
Decimal.new("0"), | ||
Decimal.new("0.0"), | ||
Decimal.new("0.00"), | ||
Decimal.new("0.000"), | ||
Decimal.new("0.0000"), | ||
Decimal.new("0.00000"), | ||
Decimal.new("0.00001"), | ||
Decimal.new("0.000012"), | ||
Decimal.new("0.0000012"), | ||
Decimal.new("0.00000012"), | ||
Decimal.new("0.00000012"), | ||
Decimal.new(".00000012"), | ||
Decimal.new("1"), | ||
Decimal.new("1.0"), | ||
Decimal.new("1.000"), | ||
Decimal.new("1.0000"), | ||
Decimal.new("1.00000"), | ||
Decimal.new("1.000001"), | ||
Decimal.new("12345"), | ||
Decimal.new("12345.0"), | ||
Decimal.new("12345.000"), | ||
Decimal.new("12345.0000"), | ||
Decimal.new("12345.00000"), | ||
Decimal.new("12345.000001"), | ||
Decimal.new("12340"), | ||
Decimal.new("123400"), | ||
Decimal.new("1234000"), | ||
Decimal.new("12340000"), | ||
Decimal.new("12340.00"), | ||
Decimal.new("123400.00"), | ||
Decimal.new("1234000.00"), | ||
Decimal.new("12340000.00"), | ||
Decimal.new("1.2345e-10"), | ||
Decimal.new("1.23450e-10"), | ||
Decimal.new("1.234500e-10"), | ||
Decimal.new("1.2345000e-10"), | ||
Decimal.new("1.23450000e-10"), | ||
Decimal.new("1.234500000e-10"), | ||
] do | ||
{result_ok, result} = Postgrex.query(pid, "SELECT CAST($1 AS DECIMAL)", [dec]) | ||
assert result_ok | ||
[[ret]] = result.rows | ||
assert ret == dec | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ExUnit.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.