Skip to content

Commit

Permalink
[MIRROR] Remove delayed in MassInsert [MDB IGNORE] (Skyrat-SS13#25554)
Browse files Browse the repository at this point in the history
* Remove delayed in MassInsert (#80196)

Necessary to update MariaDB to a newer version. Was necessary until we
had async queries, apparently.

* Remove delayed in MassInsert

* Delayed arg is no more

---------

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: Giz <13398309+vinylspiders@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 11, 2023
1 parent a20bf25 commit 339dc45
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion code/controllers/subsystem/blackbox.dm
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ SUBSYSTEM_DEF(blackbox)
if (!length(sqlrowlist))
return

SSdbcore.MassInsert(format_table_name("feedback"), sqlrowlist, ignore_errors = TRUE, delayed = TRUE, special_columns = special_columns)
SSdbcore.MassInsert(format_table_name("feedback"), sqlrowlist, ignore_errors = TRUE, special_columns = special_columns)

/datum/controller/subsystem/blackbox/proc/Seal()
if(sealed)
Expand Down
9 changes: 2 additions & 7 deletions code/controllers/subsystem/dbcore.dm
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ SUBSYSTEM_DEF(dbcore)

// SKYRAT EDIT START - SQL-based logging
for(var/table in queued_log_entries_by_table)
MassInsert(table, rows = queued_log_entries_by_table[table], duplicate_key = FALSE, ignore_errors = FALSE, delayed = FALSE, warn = FALSE, async = TRUE, special_columns = null)
MassInsert(table, rows = queued_log_entries_by_table[table], duplicate_key = FALSE, ignore_errors = FALSE, warn = FALSE, async = TRUE, special_columns = null)
// SKYRAT EDIT END

var/datum/db_query/query_round_shutdown = SSdbcore.NewQuery(
Expand Down Expand Up @@ -404,11 +404,8 @@ The duplicate_key arg can be true to automatically generate this part of the que
or set to a string that is appended to the end of the query
Ignore_errors instructes mysql to continue inserting rows if some of them have errors.
the erroneous row(s) aren't inserted and there isn't really any way to know why or why errored
Delayed insert mode was removed in mysql 7 and only works with MyISAM type tables,
It was included because it is still supported in mariadb.
It does not work with duplicate_key and the mysql server ignores it in those cases
*/
/datum/controller/subsystem/dbcore/proc/MassInsert(table, list/rows, duplicate_key = FALSE, ignore_errors = FALSE, delayed = FALSE, warn = FALSE, async = TRUE, special_columns = null)
/datum/controller/subsystem/dbcore/proc/MassInsert(table, list/rows, duplicate_key = FALSE, ignore_errors = FALSE, warn = FALSE, async = TRUE, special_columns = null)
if (!table || !rows || !istype(rows))
return

Expand All @@ -425,8 +422,6 @@ Delayed insert mode was removed in mysql 7 and only works with MyISAM type table

// Prepare SQL query full of placeholders
var/list/query_parts = list("INSERT")
if (delayed)
query_parts += " DELAYED"
if (ignore_errors)
query_parts += " IGNORE"
query_parts += " INTO "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@
if(length(queued_log_entries_by_table[table]) < CONFIG_GET(number/sql_game_log_min_bundle_size))
return

INVOKE_ASYNC(src, PROC_REF(MassInsert), table, /*rows =*/ queued_log_entries_by_table[table], /*duplicate_key =*/ FALSE, /*ignore_errors =*/ FALSE, /*delayed =*/ FALSE, /*warn =*/ FALSE, /*async =*/ TRUE, /*special_columns =*/ null)
INVOKE_ASYNC(src, PROC_REF(MassInsert), table, /*rows =*/ queued_log_entries_by_table[table], /*duplicate_key =*/ FALSE, /*ignore_errors =*/ FALSE, /*warn =*/ FALSE, /*async =*/ TRUE, /*special_columns =*/ null)
queued_log_entries_by_table -= table

0 comments on commit 339dc45

Please sign in to comment.