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
Hide 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,
grn_id
old_record_id
;
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
,
"failed to get old record ID "
"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
)
{
DBUG_RETURN
(
0
);
}
...
...
@@ -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_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
);
uint
i
;
uint
n_keys
=
table
->
s
->
keys
;
...
...
@@ -6877,18 +6868,10 @@ int ha_mroonga::storage_update_row_index(const uchar *old_data,
GRN_BULK_REWIND
(
&
old_key
);
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
)),
(
uchar
*
)
old_data
,
key_info
,
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_reserve
(
ctx
,
&
old_encoded_key
,
MRN_MAX_KEY_SIZE
);
uint
old_encoded_key_length
;
...
...
@@ -14841,9 +14824,7 @@ bool ha_mroonga::wrapper_inplace_alter_table(
need_fill_index
=
true
;
}
if
(
!
error
&&
need_fill_index
)
{
my_ptrdiff_t
diff
=
PTR_BYTE_DIFF
(
table
->
record
[
0
],
altered_table
->
record
[
0
]);
mrn
::
TableFieldsOffsetMover
mover
(
altered_table
,
diff
);
mrn
::
FieldTableChanger
changer
(
altered_table
,
table
);
error
=
wrapper_fill_indexes
(
ha_thd
(),
altered_table
->
key_info
,
index_columns
,
ha_alter_info
->
key_count
);
}
...
...
@@ -14996,9 +14977,7 @@ bool ha_mroonga::storage_inplace_alter_table_add_index(
}
}
if
(
!
error
&&
have_multiple_column_index
)
{
my_ptrdiff_t
diff
=
PTR_BYTE_DIFF
(
table
->
record
[
0
],
altered_table
->
record
[
0
]);
mrn
::
TableFieldsOffsetMover
mover
(
altered_table
,
diff
);
mrn
::
FieldTableChanger
changer
(
altered_table
,
table
);
error
=
storage_add_index_multiple_columns
(
altered_table
->
key_info
,
ha_alter_info
->
key_count
,
index_tables
,
...
...
@@ -15181,9 +15160,7 @@ bool ha_mroonga::storage_inplace_alter_table_add_column(
bitmap_set_bit
(
&
generated_column_bitmap
,
field
->
field_index
);
# endif
my_ptrdiff_t
diff
=
PTR_BYTE_DIFF
(
table
->
record
[
0
],
altered_table
->
record
[
0
]);
mrn
::
TableFieldsOffsetMover
mover
(
altered_table
,
diff
);
mrn
::
FieldTableChanger
changer
(
altered_table
,
table
);
error
=
storage_rnd_init
(
true
);
if
(
error
)
{
...
...
storage/mroonga/lib/mrn_table_fields_offset_mover.cpp
View file @
045510cb
...
...
@@ -20,22 +20,28 @@
#include "mrn_table_fields_offset_mover.hpp"
namespace
mrn
{
TableFieldsOffsetMover
::
TableFieldsOffsetMover
(
TABLE
*
table
,
my_ptrdiff_t
diff
)
:
table_
(
table
),
diff_
(
diff
)
{
uint
n_columns
=
table_
->
s
->
fields
;
FieldTableChanger
::
FieldTableChanger
(
TABLE
*
table
,
TABLE
*
new_table
)
:
old_table_
(
table
),
new_table_
(
new_table
)
{
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
)
{
Field
*
field
=
table_
->
field
[
i
];
field
->
move_field_offset
(
diff_
);
Field
*
field
=
old_table_
->
field
[
i
];
field
->
move_field_offset
(
diff
);
field
->
table
=
new_table
;
}
}
TableFieldsOffsetMover
::~
TableFieldsOffsetMover
()
{
uint
n_columns
=
table_
->
s
->
fields
;
FieldTableChanger
::~
FieldTableChanger
()
{
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
)
{
Field
*
field
=
table_
->
field
[
i
];
field
->
move_field_offset
(
-
diff_
);
Field
*
field
=
old_table_
->
field
[
i
];
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 @@
#include <mrn_mysql.h>
namespace
mrn
{
class
TableFieldsOffsetMov
er
{
class
FieldTableChang
er
{
public:
TableFieldsOffsetMover
(
TABLE
*
table
,
my_ptrdiff_t
diff
);
~
TableFieldsOffsetMov
er
();
FieldTableChanger
(
TABLE
*
table
,
TABLE
*
new_table
);
~
FieldTableChang
er
();
private:
TABLE
*
table_
;
my_ptrdiff_t
diff
_
;
TABLE
*
old_
table_
;
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