mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
skip hlindex update if its columns aren't in the write_set
This commit is contained in:
@@ -30,7 +30,8 @@ class hlindex : public Sql_alloc
|
||||
{
|
||||
public:
|
||||
TABLE *table;
|
||||
hlindex(TABLE *t) : table(t) { }
|
||||
bool update_needed; // index columns are in write_set, only used for UPDATE
|
||||
hlindex(TABLE *t) : table(t), update_needed(false) { }
|
||||
virtual ~hlindex();
|
||||
|
||||
virtual int read_first(TABLE *tbl, KEY *keyinfo, const uchar *value,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2018, 2021, MariaDB
|
||||
Copyright (c) 2018, 2026, MariaDB plc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -449,6 +449,8 @@ void key_unpack(String *to, TABLE *table, KEY *key)
|
||||
/*
|
||||
Check if key uses field that is marked in passed field bitmap.
|
||||
|
||||
This is used to detect if updating the row might change the key value.
|
||||
|
||||
SYNOPSIS
|
||||
is_key_used()
|
||||
table TABLE object with which keys and fields are associated.
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
// mysql_derived_filling
|
||||
#include "sql_handler.h" // mysql_ha_flush
|
||||
#include "sql_test.h"
|
||||
#include "key.h" // is_key_used
|
||||
#include "sql_partition.h" // ALTER_PARTITION_PARAM_TYPE
|
||||
#include "log_event.h" // Query_log_event
|
||||
#include "sql_select.h"
|
||||
@@ -10214,6 +10215,8 @@ int TABLE::open_hlindexes_for_write()
|
||||
for (uint i= s->keys; i < s->total_keys; i++)
|
||||
if (hlindex_open(i) || hlindex_lock(i))
|
||||
return 1;
|
||||
else
|
||||
hli->update_needed= is_key_used(this, i, write_set);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -10239,7 +10242,7 @@ int TABLE::hlindexes_on_insert()
|
||||
int TABLE::hlindexes_on_update()
|
||||
{
|
||||
DBUG_ASSERT(s->hlindexes() == (hli != NULL));
|
||||
if (hli && hli->table->in_use)
|
||||
if (hli && hli->update_needed)
|
||||
{
|
||||
int err;
|
||||
// mark deleted node invalid and insert node for new row
|
||||
|
||||
Reference in New Issue
Block a user