Skip to content

Commit

Permalink
Fix stuff I broke during rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
balegas committed Jul 25, 2024
1 parent 3fa1467 commit d1daaad
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/sync-service/lib/electric/shape_cache.ex
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,9 @@ defmodule Electric.ShapeCache do
GenServer.cast(parent, {:snapshot_xmin_known, shape_id, xmin})
{query, stream} = Querying.stream_initial_data(conn, shape)

Storage.make_new_snapshot!(shape_id, query, stream, storage)
# could pass the shape and then make_new_snapshot! can pass it to row_to_snapshot_item
# that way it has the relation, but it is still missing the pk_cols
Storage.make_new_snapshot!(shape_id, shape, query, stream, storage)
end)
end)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ defmodule Electric.ShapeCache.CubDbStorage do
(snapshot_exists?(shape_id, opts) and offset == LogOffset.first())
end

def make_new_snapshot!(shape_id, query_info, data_stream, opts) do
def make_new_snapshot!(shape_id, shape, query_info, data_stream, opts) do
OpenTelemetry.with_span("make_new_snapshot", [], fn ->
data_stream
|> Stream.with_index()
Expand Down
4 changes: 2 additions & 2 deletions packages/sync-service/lib/electric/shapes/querying.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ defmodule Electric.Shapes.Querying do

@spec stream_initial_data(DBConnection.t(), Shape.t()) ::
{Postgrex.Query.t(), Enumerable.t(row())}
def stream_initial_data(conn, %Shape{} = shape) do
def stream_initial_data(conn, %Shape{root_table: root_table, table_info: table_info} = shape) do
OpenTelemetry.with_span("query_initial_data", [], fn ->
table = Utils.relation_to_sql(shape.root_table)
table = Utils.relation_to_sql(root_table)

where =
if not is_nil(shape.where), do: " WHERE " <> shape.where.query, else: ""
Expand Down

0 comments on commit d1daaad

Please sign in to comment.