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
72fb37ea
Commit
72fb37ea
authored
Aug 17, 2021
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: uuid
parent
bdaa7fac
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
47 deletions
+25
-47
include/my_sys.h
include/my_sys.h
+17
-4
mysys/my_uuid.c
mysys/my_uuid.c
+0
-31
sql/backup.cc
sql/backup.cc
+1
-1
sql/item_strfunc.cc
sql/item_strfunc.cc
+3
-7
sql/item_strfunc.h
sql/item_strfunc.h
+2
-2
storage/maria/aria_chk.c
storage/maria/aria_chk.c
+1
-1
storage/maria/ma_control_file.c
storage/maria/ma_control_file.c
+1
-1
No files found.
include/my_sys.h
View file @
72fb37ea
...
...
@@ -1022,15 +1022,28 @@ int my_getpagesize(void);
int
my_msync
(
int
,
void
*
,
size_t
,
int
);
#define MY_UUID_SIZE 16
#define MY_UUID_STRING_LENGTH (8+1+4+1+4+1+4+1+12)
#define MY_UUID_ORACLE_STRING_LENGTH (8+4+4+4+12)
#define MY_UUID_BARE_STRING_LENGTH (8+4+4+4+12)
#define MY_UUID_SEPARATORS 4
#define MY_UUID_STRING_LENGTH (MY_UUID_BARE_STRING_LENGTH + MY_UUID_SEPARATORS)
void
my_uuid_init
(
ulong
seed1
,
ulong
seed2
);
void
my_uuid
(
uchar
*
guid
);
void
my_uuid2str
(
const
uchar
*
guid
,
char
*
s
);
void
my_uuid2str_oracle
(
const
uchar
*
guid
,
char
*
s
);
void
my_uuid_end
(
void
);
static
inline
void
my_uuid2str
(
const
uchar
*
guid
,
char
*
s
,
int
with_separators
)
{
int
i
;
int
mask
=
with_separators
?
((
1
<<
3
)
|
(
1
<<
5
)
|
(
1
<<
7
)
|
(
1
<<
9
))
:
0
;
for
(
i
=
0
;
i
<
MY_UUID_SIZE
;
i
++
,
mask
>>=
1
)
{
*
s
++=
_dig_vec_lower
[
guid
[
i
]
>>
4
];
*
s
++=
_dig_vec_lower
[
guid
[
i
]
&
15
];
if
(
mask
&
1
)
*
s
++=
'-'
;
}
}
const
char
*
my_dlerror
(
const
char
*
dlpath
);
/* character sets */
...
...
mysys/my_uuid.c
View file @
72fb37ea
...
...
@@ -216,37 +216,6 @@ void my_uuid(uchar *to)
}
/**
Convert uuid to string representation
@func my_uuid2str()
@param guid uuid
@param s Output buffer.Must be at least MY_UUID_STRING_LENGTH+1 large.
*/
void
my_uuid2str
(
const
uchar
*
guid
,
char
*
s
)
{
int
i
;
for
(
i
=
0
;
i
<
MY_UUID_SIZE
;
i
++
)
{
*
s
++=
_dig_vec_lower
[
guid
[
i
]
>>
4
];
*
s
++=
_dig_vec_lower
[
guid
[
i
]
&
15
];
/* Set '-' at intervals 3, 5, 7 and 9 */
if
((
1
<<
i
)
&
((
1
<<
3
)
|
(
1
<<
5
)
|
(
1
<<
7
)
|
(
1
<<
9
)))
*
s
++=
'-'
;
}
}
void
my_uuid2str_oracle
(
const
uchar
*
guid
,
char
*
s
)
{
int
i
;
for
(
i
=
0
;
i
<
MY_UUID_SIZE
;
i
++
)
{
*
s
++=
_dig_vec_upper
[
guid
[
i
]
>>
4
];
*
s
++=
_dig_vec_upper
[
guid
[
i
]
&
15
];
}
}
void
my_uuid_end
()
{
if
(
my_uuid_inited
)
...
...
sql/backup.cc
View file @
72fb37ea
...
...
@@ -535,7 +535,7 @@ static char *add_id_to_buffer(char *ptr, const LEX_CUSTRING *from)
tmp
.
str
=
buff
;
tmp
.
length
=
MY_UUID_STRING_LENGTH
;
my_uuid2str
(
from
->
str
,
buff
);
my_uuid2str
(
from
->
str
,
buff
,
1
);
return
add_str_to_buffer
(
ptr
,
&
tmp
);
}
...
...
sql/item_strfunc.cc
View file @
72fb37ea
...
...
@@ -4518,18 +4518,14 @@ String *Item_func_uuid::val_str(String *str)
{
DBUG_ASSERT
(
fixed
());
uchar
guid
[
MY_UUID_SIZE
];
size_t
length
=
(
without_separators
?
MY_UUID_ORACLE_STRING_LENGTH
:
MY_UUID_STRING_LENGTH
);
size_t
length
=
without_separators
?
MY_UUID_BARE_STRING_LENGTH
:
MY_UUID_STRING_LENGTH
;
str
->
alloc
(
length
+
1
);
str
->
length
(
length
);
str
->
set_charset
(
system_charset_info
);
my_uuid
(
guid
);
if
(
without_separators
)
my_uuid2str_oracle
(
guid
,
(
char
*
)
str
->
ptr
());
else
my_uuid2str
(
guid
,
(
char
*
)
str
->
ptr
());
my_uuid2str
(
guid
,
(
char
*
)
str
->
ptr
(),
!
without_separators
);
return
str
;
}
...
...
sql/item_strfunc.h
View file @
72fb37ea
...
...
@@ -2043,8 +2043,8 @@ Item_func_uuid(THD *thd, bool without_separators_arg): Item_str_func(thd),
bool
fix_length_and_dec
()
override
{
collation
.
set
(
DTCollation_numeric
());
fix_char_length
(
without_separators
?
MY_UUID_
ORACLE_STRING_LENGTH
:
MY_UUID_STRING_LENGTH
);
fix_char_length
(
without_separators
?
MY_UUID_
BARE_STRING_LENGTH
:
MY_UUID_STRING_LENGTH
);
return
FALSE
;
}
bool
const_item
()
const
override
{
return
false
;
}
...
...
storage/maria/aria_chk.c
View file @
72fb37ea
...
...
@@ -1592,7 +1592,7 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name)
}
compile_time_assert
((
MY_UUID_STRING_LENGTH
+
1
)
<=
sizeof
(
buff
));
buff
[
MY_UUID_STRING_LENGTH
]
=
0
;
my_uuid2str
(
share
->
base
.
uuid
,
buff
);
my_uuid2str
(
share
->
base
.
uuid
,
buff
,
1
);
printf
(
"UUID: %s
\n
"
,
buff
);
if
(
ma_control_file_inited
()
&&
memcmp
(
share
->
base
.
uuid
,
maria_uuid
,
MY_UUID_SIZE
))
...
...
storage/maria/ma_control_file.c
View file @
72fb37ea
...
...
@@ -705,7 +705,7 @@ my_bool print_aria_log_control()
checkpoint_lsn
=
lsn_korr
(
buffer
+
new_cf_create_time_size
+
CF_LSN_OFFSET
);
logno
=
uint4korr
(
buffer
+
new_cf_create_time_size
+
CF_FILENO_OFFSET
);
my_uuid2str
(
buffer
+
CF_UUID_OFFSET
,
uuid_str
);
my_uuid2str
(
buffer
+
CF_UUID_OFFSET
,
uuid_str
,
1
);
uuid_str
[
MY_UUID_STRING_LENGTH
]
=
0
;
printf
(
"Block size: %u
\n
"
,
uint2korr
(
buffer
+
CF_BLOCKSIZE_OFFSET
));
...
...
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