Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
045510cb
Commit
045510cb
authored
Mar 23, 2020
by
Nikita Malyavin
Committed by
Sergei Golubchik
Mar 31, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix mroonga: change field's table as well as ptr for ad-hoc // fixes ptr_in_record usage
parent
db6f02bb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
43 deletions
+26
-43
storage/mroonga/ha_mroonga.cpp
storage/mroonga/ha_mroonga.cpp
+4
-27
storage/mroonga/lib/mrn_table_fields_offset_mover.cpp
storage/mroonga/lib/mrn_table_fields_offset_mover.cpp
+17
-11
storage/mroonga/lib/mrn_table_fields_offset_mover.hpp
storage/mroonga/lib/mrn_table_fields_offset_mover.hpp
+5
-5
No files found.
storage/mroonga/ha_mroonga.cpp
View file @
045510cb
...
@@ -6530,17 +6530,10 @@ int ha_mroonga::wrapper_update_row_index(const uchar *old_data,
...
@@ -6530,17 +6530,10 @@ int ha_mroonga::wrapper_update_row_index(const uchar *old_data,
grn_id
old_record_id
;
grn_id
old_record_id
;
my_ptrdiff_t
ptr_diff
=
PTR_BYTE_DIFF
(
old_data
,
table
->
record
[
0
]);
my_ptrdiff_t
ptr_diff
=
PTR_BYTE_DIFF
(
old_data
,
table
->
record
[
0
]);
for
(
uint
j
=
0
;
j
<
KEY_N_KEY_PARTS
(
key_info
);
j
++
)
{
Field
*
field
=
key_info
->
key_part
[
j
].
field
;
field
->
move_field_offset
(
ptr_diff
);
}
error
=
wrapper_get_record_id
((
uchar
*
)
old_data
,
&
old_record_id
,
error
=
wrapper_get_record_id
((
uchar
*
)
old_data
,
&
old_record_id
,
"failed to get old record ID "
"failed to get old record ID "
"for updating from groonga"
);
"for updating from groonga"
);
for
(
uint
j
=
0
;
j
<
KEY_N_KEY_PARTS
(
key_info
);
j
++
)
{
Field
*
field
=
key_info
->
key_part
[
j
].
field
;
field
->
move_field_offset
(
-
ptr_diff
);
}
if
(
error
)
{
if
(
error
)
{
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
...
@@ -6852,8 +6845,6 @@ int ha_mroonga::storage_update_row_index(const uchar *old_data,
...
@@ -6852,8 +6845,6 @@ int ha_mroonga::storage_update_row_index(const uchar *old_data,
GRN_TEXT_INIT
(
&
new_key
,
0
);
GRN_TEXT_INIT
(
&
new_key
,
0
);
GRN_TEXT_INIT
(
&
new_encoded_key
,
0
);
GRN_TEXT_INIT
(
&
new_encoded_key
,
0
);
my_ptrdiff_t
ptr_diff
=
PTR_BYTE_DIFF
(
old_data
,
table
->
record
[
0
]);
mrn
::
DebugColumnAccess
debug_column_access
(
table
,
table
->
read_set
);
mrn
::
DebugColumnAccess
debug_column_access
(
table
,
table
->
read_set
);
uint
i
;
uint
i
;
uint
n_keys
=
table
->
s
->
keys
;
uint
n_keys
=
table
->
s
->
keys
;
...
@@ -6877,18 +6868,10 @@ int ha_mroonga::storage_update_row_index(const uchar *old_data,
...
@@ -6877,18 +6868,10 @@ int ha_mroonga::storage_update_row_index(const uchar *old_data,
GRN_BULK_REWIND
(
&
old_key
);
GRN_BULK_REWIND
(
&
old_key
);
grn_bulk_space
(
ctx
,
&
old_key
,
key_info
->
key_length
);
grn_bulk_space
(
ctx
,
&
old_key
,
key_info
->
key_length
);
for
(
uint
j
=
0
;
j
<
KEY_N_KEY_PARTS
(
key_info
);
j
++
)
{
Field
*
field
=
key_info
->
key_part
[
j
].
field
;
field
->
move_field_offset
(
ptr_diff
);
}
key_copy
((
uchar
*
)(
GRN_TEXT_VALUE
(
&
old_key
)),
key_copy
((
uchar
*
)(
GRN_TEXT_VALUE
(
&
old_key
)),
(
uchar
*
)
old_data
,
(
uchar
*
)
old_data
,
key_info
,
key_info
,
key_info
->
key_length
);
key_info
->
key_length
);
for
(
uint
j
=
0
;
j
<
KEY_N_KEY_PARTS
(
key_info
);
j
++
)
{
Field
*
field
=
key_info
->
key_part
[
j
].
field
;
field
->
move_field_offset
(
-
ptr_diff
);
}
GRN_BULK_REWIND
(
&
old_encoded_key
);
GRN_BULK_REWIND
(
&
old_encoded_key
);
grn_bulk_reserve
(
ctx
,
&
old_encoded_key
,
MRN_MAX_KEY_SIZE
);
grn_bulk_reserve
(
ctx
,
&
old_encoded_key
,
MRN_MAX_KEY_SIZE
);
uint
old_encoded_key_length
;
uint
old_encoded_key_length
;
...
@@ -14841,9 +14824,7 @@ bool ha_mroonga::wrapper_inplace_alter_table(
...
@@ -14841,9 +14824,7 @@ bool ha_mroonga::wrapper_inplace_alter_table(
need_fill_index
=
true
;
need_fill_index
=
true
;
}
}
if
(
!
error
&&
need_fill_index
)
{
if
(
!
error
&&
need_fill_index
)
{
my_ptrdiff_t
diff
=
mrn
::
FieldTableChanger
changer
(
altered_table
,
table
);
PTR_BYTE_DIFF
(
table
->
record
[
0
],
altered_table
->
record
[
0
]);
mrn
::
TableFieldsOffsetMover
mover
(
altered_table
,
diff
);
error
=
wrapper_fill_indexes
(
ha_thd
(),
altered_table
->
key_info
,
error
=
wrapper_fill_indexes
(
ha_thd
(),
altered_table
->
key_info
,
index_columns
,
ha_alter_info
->
key_count
);
index_columns
,
ha_alter_info
->
key_count
);
}
}
...
@@ -14996,9 +14977,7 @@ bool ha_mroonga::storage_inplace_alter_table_add_index(
...
@@ -14996,9 +14977,7 @@ bool ha_mroonga::storage_inplace_alter_table_add_index(
}
}
}
}
if
(
!
error
&&
have_multiple_column_index
)
{
if
(
!
error
&&
have_multiple_column_index
)
{
my_ptrdiff_t
diff
=
mrn
::
FieldTableChanger
changer
(
altered_table
,
table
);
PTR_BYTE_DIFF
(
table
->
record
[
0
],
altered_table
->
record
[
0
]);
mrn
::
TableFieldsOffsetMover
mover
(
altered_table
,
diff
);
error
=
storage_add_index_multiple_columns
(
altered_table
->
key_info
,
error
=
storage_add_index_multiple_columns
(
altered_table
->
key_info
,
ha_alter_info
->
key_count
,
ha_alter_info
->
key_count
,
index_tables
,
index_tables
,
...
@@ -15181,9 +15160,7 @@ bool ha_mroonga::storage_inplace_alter_table_add_column(
...
@@ -15181,9 +15160,7 @@ bool ha_mroonga::storage_inplace_alter_table_add_column(
bitmap_set_bit
(
&
generated_column_bitmap
,
field
->
field_index
);
bitmap_set_bit
(
&
generated_column_bitmap
,
field
->
field_index
);
# endif
# endif
my_ptrdiff_t
diff
=
mrn
::
FieldTableChanger
changer
(
altered_table
,
table
);
PTR_BYTE_DIFF
(
table
->
record
[
0
],
altered_table
->
record
[
0
]);
mrn
::
TableFieldsOffsetMover
mover
(
altered_table
,
diff
);
error
=
storage_rnd_init
(
true
);
error
=
storage_rnd_init
(
true
);
if
(
error
)
{
if
(
error
)
{
...
...
storage/mroonga/lib/mrn_table_fields_offset_mover.cpp
View file @
045510cb
...
@@ -20,22 +20,28 @@
...
@@ -20,22 +20,28 @@
#include "mrn_table_fields_offset_mover.hpp"
#include "mrn_table_fields_offset_mover.hpp"
namespace
mrn
{
namespace
mrn
{
TableFieldsOffsetMover
::
TableFieldsOffsetMover
(
TABLE
*
table
,
FieldTableChanger
::
FieldTableChanger
(
TABLE
*
table
,
my_ptrdiff_t
diff
)
TABLE
*
new_table
)
:
table_
(
table
),
:
old_table_
(
table
),
diff_
(
diff
)
{
new_table_
(
new_table
)
{
uint
n_columns
=
table_
->
s
->
fields
;
my_ptrdiff_t
diff
=
PTR_BYTE_DIFF
(
new_table_
->
record
[
0
],
old_table_
->
record
[
0
]);
uint
n_columns
=
old_table_
->
s
->
fields
;
for
(
uint
i
=
0
;
i
<
n_columns
;
++
i
)
{
for
(
uint
i
=
0
;
i
<
n_columns
;
++
i
)
{
Field
*
field
=
table_
->
field
[
i
];
Field
*
field
=
old_table_
->
field
[
i
];
field
->
move_field_offset
(
diff_
);
field
->
move_field_offset
(
diff
);
field
->
table
=
new_table
;
}
}
}
}
TableFieldsOffsetMover
::~
TableFieldsOffsetMover
()
{
FieldTableChanger
::~
FieldTableChanger
()
{
uint
n_columns
=
table_
->
s
->
fields
;
my_ptrdiff_t
diff
=
PTR_BYTE_DIFF
(
new_table_
->
record
[
0
],
old_table_
->
record
[
0
]);
uint
n_columns
=
old_table_
->
s
->
fields
;
for
(
uint
i
=
0
;
i
<
n_columns
;
++
i
)
{
for
(
uint
i
=
0
;
i
<
n_columns
;
++
i
)
{
Field
*
field
=
table_
->
field
[
i
];
Field
*
field
=
old_table_
->
field
[
i
];
field
->
move_field_offset
(
-
diff_
);
field
->
move_field_offset
(
-
diff
);
field
->
table
=
old_table_
;
}
}
}
}
}
}
storage/mroonga/lib/mrn_table_fields_offset_mover.hpp
View file @
045510cb
...
@@ -22,12 +22,12 @@
...
@@ -22,12 +22,12 @@
#include <mrn_mysql.h>
#include <mrn_mysql.h>
namespace
mrn
{
namespace
mrn
{
class
TableFieldsOffsetMov
er
{
class
FieldTableChang
er
{
public:
public:
TableFieldsOffsetMover
(
TABLE
*
table
,
my_ptrdiff_t
diff
);
FieldTableChanger
(
TABLE
*
table
,
TABLE
*
new_table
);
~
TableFieldsOffsetMov
er
();
~
FieldTableChang
er
();
private:
private:
TABLE
*
table_
;
TABLE
*
old_
table_
;
my_ptrdiff_t
diff
_
;
TABLE
*
new_table
_
;
};
};
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment