Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
radeusgd committed Jun 23, 2023
1 parent cd737af commit 9f58d7d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ dispose_reference reference =
brought back to life.

This method must be run in a critical section guaranteeing that no other
operations will be performed on the associated connection in parallel.
operations will be performed on the associated connection in parallel. Thanks
to running it in a critical section, there is no risk that a table that is
just being dropped will come back to life in the meantime - since no other
code can be creating tables on this connection at the same time.
run_maintenance_table_cleanup connection =
registry = connection.hidden_table_registry
reference_counter = registry.reference_counter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ type JDBC_Connection
transaction to ensure consistency.
batch_insert : Text -> Statement_Setter -> Materialized_Table -> Integer -> Integer | Nothing -> Nothing
batch_insert self insert_template statement_setter table batch_size row_limit=Nothing =
In_Transaction.ensure_in_transaction <| self.with_connection java_connection->
In_Transaction.ensure_in_transaction <| self.with_connection java_connection-> handle_sql_errors related_query=insert_template <|
Managed_Resource.bracket (java_connection.prepareStatement insert_template) .close stmt->
table_row_count = table.row_count
num_rows = case row_limit of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ default_key_columns (table : Database_Table | In_Memory_Table) =
TODO [RW] fix keys for SQLite temporary tables #7037
get_primary_key table =
connection = table.connection
connection.jdbc_connection.with_connection java_connection->
rs = java_connection.getMetaData.getPrimaryKeys Nothing Nothing table.name
connection.jdbc_connection.with_metadata metadata->
rs = metadata.getPrimaryKeys Nothing Nothing table.name
keys_table = result_set_to_table rs connection.dialect.make_column_fetcher_for_type
# The names of the columns are sometimes lowercase and sometimes uppercase, so we do a case insensitive select first.
selected = keys_table.select_columns [Column_Selector.By_Name "COLUMN_NAME", Column_Selector.By_Name "KEY_SEQ"] reorder=True
Expand All @@ -470,7 +470,7 @@ dry_run_row_limit = 1000
It is a panic, because it is never expected to happen in user code - if it
happens, it is a bug in our code.
check_transaction_ddl_support connection =
supports_ddl = connection.jdbc_connection.with_connection java_connection->
java_connection.getMetaData.supportsDataDefinitionAndDataManipulationTransactions
supports_ddl = connection.jdbc_connection.with_metadata metadata->
metadata.supportsDataDefinitionAndDataManipulationTransactions
if supports_ddl.not then
Panic.throw (Illegal_State.Error "The connection "+connection.to_text+" does not support transactional DDL statements. Our current implementation of table updates relies on transactional DDL. To support this driver, the logic needs to be amended.")

0 comments on commit 9f58d7d

Please sign in to comment.