Current section

20 Versions

Jump to

Compare versions

20 files changed
+597 additions
-226 deletions
  @@ -1,5 +1,18 @@
1 1 # Changelog for v0.x
2 2
3 + ## v0.4 (2024-01-16)
4 +
5 + ### Enhancements
6 +
7 + * [Large Structs](Ecto.Adapters.FoundationDB.html#module-advanced-options): If your struct encodes to a size larger than 100,000 Bytes, it will now be split across several FDB key-values automatically.
8 + Previously, EctoFDB did not attempt to detect this and allowed FoundationDB to throw error code 2103: "value_too_large - Value length exceeds limit".
9 + See documentation for configuration options.
10 + * `EctoFoundationDB.Sandbox` now uses `m:erlfdb_sandbox`. Sandbox directory name is now `.erlfdb_sandbox`. Directories named `.erlfdb` should be removed.
11 +
12 + ### Bug fixes
13 +
14 + * Upgrade erlfdb to v0.2.2
15 +
3 16 ## v0.3.1 (2024-10-24)
4 17
5 18 ### Bug fixes
  @@ -25,7 +25,7 @@ Include `:ecto_foundationdb` in your list of dependencies in `mix.exs`:
25 25 ```elixir
26 26 defp deps do
27 27 [
28 - {:ecto_foundationdb, "~> 0.3"}
28 + {:ecto_foundationdb, "~> 0.4"}
29 29 ]
30 30 end
31 31 ```
  @@ -2,7 +2,7 @@
2 2 [{<<"GitHub">>,
3 3 <<"https://github.com/foundationdb-beam/ecto_foundationdb">>}]}.
4 4 {<<"name">>,<<"ecto_foundationdb">>}.
5 - {<<"version">>,<<"0.3.1">>}.
5 + {<<"version">>,<<"0.4.0">>}.
6 6 {<<"description">>,<<"FoundationDB adapter for Ecto">>}.
7 7 {<<"elixir">>,<<"~> 1.15">>}.
8 8 {<<"app">>,<<"ecto_foundationdb">>}.
  @@ -37,11 +37,14 @@
37 37 <<"lib/ecto_foundationdb/index.ex">>,<<"lib/ecto_foundationdb/future.ex">>,
38 38 <<"lib/ecto_foundationdb/progressive_job.ex">>,
39 39 <<"lib/ecto_foundationdb/migration.ex">>,<<"lib/ecto_foundationdb/layer">>,
40 + <<"lib/ecto_foundationdb/layer/primary_kv_codec.ex">>,
40 41 <<"lib/ecto_foundationdb/layer/tx_insert.ex">>,
42 + <<"lib/ecto_foundationdb/layer/internal_metadata.ex">>,
41 43 <<"lib/ecto_foundationdb/layer/index_inventory.ex">>,
42 44 <<"lib/ecto_foundationdb/layer/pack.ex">>,
43 45 <<"lib/ecto_foundationdb/layer/fields.ex">>,
44 46 <<"lib/ecto_foundationdb/layer/query.ex">>,
47 + <<"lib/ecto_foundationdb/layer/decoded_kv.ex">>,
45 48 <<"lib/ecto_foundationdb/layer/tx.ex">>,
46 49 <<"lib/ecto_foundationdb/layer/ordering.ex">>,
47 50 <<"lib/ecto_foundationdb/migrator.ex">>,<<"lib/ecto_foundationdb/sandbox">>,
  @@ -26,7 +26,7 @@ defmodule Ecto.Adapters.FoundationDB do
26 26 ```elixir
27 27 defp deps do
28 28 [
29 - {:ecto_foundationdb, "~> 0.3"}
29 + {:ecto_foundationdb, "~> 0.4"}
30 30 ]
31 31 end
32 32 ```
  @@ -641,6 +641,16 @@ defmodule Ecto.Adapters.FoundationDB do
641 641 * `:idx_cache` - When set to `:enabled`, the Ecto ets cache is used to store the
642 642 available indexes per tenant. This speeds up all database operations.
643 643 Defaults to `:enabled`.
644 + * `:max_single_value_size` - Number of Bytes above which an encoded struct will
645 + be split into multiple FDB key-value pairs upon insert and update. Defaults to `100_000`.
646 + Any value beyond `100_000` is unsupported by FoundationDB. You probably do not
647 + want to change this value. Also see `:max_value_size`.
648 + * `:max_value_size` - Number of Bytes above which an encoded struct will be
649 + rejected by EctoFDB upon insert and update. Defaults to `:infinity`, which
650 + means that a single encoded struct of any size can be written to any number of
651 + keys. Please remember that FDB's transaction size limit of 10MB still applies.
652 + The maximum number of key-value pairs for a given encoded struct, not counting
653 + indexes, is computed by `1 + ceil(:max_value_size / :max_single_value_size)`.
644 654
645 655 ## Optimizing for throughput and latency
646 656
  @@ -818,8 +828,9 @@ defmodule Ecto.Adapters.FoundationDB do
818 828
819 829 def await(futures) when is_list(futures) do
820 830 futures
821 - |> Future.await_all()
822 - |> Enum.map(&Future.result/1)
831 + |> Future.await_stream()
832 + |> Stream.map(&Future.result/1)
833 + |> Enum.to_list()
823 834 end
824 835
825 836 def await(future) do
  @@ -10,6 +10,7 @@ defmodule Ecto.Adapters.FoundationDB.EctoAdapterQueryable do
10 10 alias EctoFoundationDB.Layer.Tx
11 11 alias EctoFoundationDB.QueryPlan
12 12 alias EctoFoundationDB.Schema
13 + alias EctoFoundationDB.Tenant
13 14
14 15 @impl Ecto.Adapter.Queryable
15 16 def prepare(
  @@ -137,7 +138,7 @@ defmodule Ecto.Adapters.FoundationDB.EctoAdapterQueryable do
137 138 Use `prefix: tenant` in your query.
138 139 """
139 140
140 - {true, tenant} ->
141 + {true, tenant = %Tenant{}} ->
141 142 {context, %Ecto.Query{query | prefix: tenant}}
142 143 end
143 144 end
  @@ -180,7 +181,7 @@ defmodule Ecto.Adapters.FoundationDB.EctoAdapterQueryable do
180 181
181 182 defp execute_update_all(
182 183 tenant,
183 - adapter_meta = %{opts: _adapter_opts},
184 + adapter_meta = %{opts: options},
184 185 context,
185 186 %Ecto.Query{
186 187 from: %Ecto.Query.FromExpr{source: {source, schema}},
  @@ -190,7 +191,7 @@ defmodule Ecto.Adapters.FoundationDB.EctoAdapterQueryable do
190 191 params
191 192 ) do
192 193 plan = QueryPlan.get(tenant, source, schema, context, wheres, updates, params)
193 - Query.update(tenant, adapter_meta, plan)
194 + Query.update(tenant, adapter_meta, plan, options)
194 195 end
195 196
196 197 defp stream_all(
Loading more files…