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
c05b1288
Commit
c05b1288
authored
Dec 04, 2020
by
Olivier Bertrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove a push warning causing failing assert. Modified storage/connect/filamap.cpp
parent
4b6d661c
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
400 additions
and
570 deletions
+400
-570
storage/connect/bson.cpp
storage/connect/bson.cpp
+154
-232
storage/connect/bson.h
storage/connect/bson.h
+33
-29
storage/connect/bsonudf.cpp
storage/connect/bsonudf.cpp
+48
-58
storage/connect/bsonudf.h
storage/connect/bsonudf.h
+2
-2
storage/connect/filamap.cpp
storage/connect/filamap.cpp
+2
-1
storage/connect/global.h
storage/connect/global.h
+2
-25
storage/connect/mysql-test/connect/disabled.def
storage/connect/mysql-test/connect/disabled.def
+1
-0
storage/connect/plugutil.cpp
storage/connect/plugutil.cpp
+24
-1
storage/connect/tabbson.cpp
storage/connect/tabbson.cpp
+132
-214
storage/connect/tabbson.h
storage/connect/tabbson.h
+2
-8
No files found.
storage/connect/bson.cpp
View file @
c05b1288
This diff is collapsed.
Click to expand it.
storage/connect/bson.h
View file @
c05b1288
...
...
@@ -17,13 +17,6 @@
#endif
#define ARGS MY_MIN(24,(int)len-i),s+MY_MAX(i-3,0)
#define MOF(X) MakeOff(Base, X)
#define MP(X) MakePtr(Base, X)
#define MPP(X) (PBPR)MakePtr(Base, X)
#define MVP(X) (PBVAL)MakePtr(Base, X)
#define MZP(X) (PSZ)MakePtr(Base, X)
#define LLN(X) *(longlong*)MakePtr(Base, X)
#define DBL(X) *(double*)MakePtr(Base, X)
class
BDOC
;
class
BOUT
;
...
...
@@ -71,6 +64,15 @@ class BJSON : public BLOCK {
// Constructor
BJSON
(
PGLOBAL
g
,
PBVAL
vp
=
NULL
)
{
G
=
g
,
Base
=
G
->
Sarea
;
Bvp
=
vp
;
}
// Utility functions
inline
OFFSET
MOF
(
void
*
p
)
{
return
MakeOff
(
Base
,
p
);}
inline
void
*
MP
(
OFFSET
o
)
{
return
MakePtr
(
Base
,
o
);}
inline
PBPR
MPP
(
OFFSET
o
)
{
return
(
PBPR
)
MakePtr
(
Base
,
o
);}
inline
PBVAL
MVP
(
OFFSET
o
)
{
return
(
PBVAL
)
MakePtr
(
Base
,
o
);}
inline
PSZ
MZP
(
OFFSET
o
)
{
return
(
PSZ
)
MakePtr
(
Base
,
o
);}
inline
longlong
LLN
(
OFFSET
o
)
{
return
*
(
longlong
*
)
MakePtr
(
Base
,
o
);}
inline
double
DBL
(
OFFSET
o
)
{
return
*
(
double
*
)
MakePtr
(
Base
,
o
);}
void
*
GetBase
(
void
)
{
return
Base
;
}
void
SubSet
(
bool
b
=
false
);
void
MemSave
(
void
)
{
G
->
Saved_Size
=
((
PPOOLHEADER
)
G
->
Sarea
)
->
To_Free
;}
...
...
@@ -82,47 +84,49 @@ class BJSON : public BLOCK {
PBPR
SubAllocPair
(
PSZ
key
,
OFFSET
val
=
0
)
{
return
SubAllocPair
(
MOF
(
key
),
val
);}
PBVAL
NewVal
(
int
type
=
TYPE_NULL
);
PBVAL
NewVal
(
PVAL
valp
);
PBVAL
SubAllocVal
(
OFFSET
toval
,
int
type
=
TYPE_NULL
,
short
nd
=
0
);
PBVAL
SubAllocVal
(
PBVAL
toval
,
int
type
=
TYPE_NULL
,
short
nd
=
0
)
{
return
SubAllocVal
(
MOF
(
toval
),
type
,
nd
);}
PBVAL
SubAllocStr
(
OFFSET
str
,
short
nd
=
0
);
PBVAL
SubAllocStr
(
PSZ
str
,
short
nd
=
0
)
{
return
SubAllocStr
(
MOF
(
str
),
nd
);}
PBVAL
SubAllocVal
(
PVAL
valp
);
PBVAL
DupVal
(
PBVAL
bvp
);
// Array functions
inline
PBVAL
GetArray
(
PBVAL
vlp
)
{
return
MVP
(
vlp
->
To_Val
);}
int
GetArraySize
(
PBVAL
bap
,
bool
b
=
false
);
PBVAL
GetArrayValue
(
PBVAL
bap
,
int
i
);
PSZ
GetArrayText
(
PGLOBAL
g
,
PBVAL
bap
,
PSTRG
text
);
PBVAL
MergeArray
(
PBVAL
bap1
,
PBVAL
bap2
);
PBVAL
DeleteValue
(
PBVAL
bap
,
int
n
);
PBVAL
AddArrayValue
(
PBVAL
bap
,
PBVAL
nvp
=
NULL
,
int
*
x
=
NULL
);
PBVAL
SetArrayValue
(
PBVAL
bap
,
PBVAL
nvp
,
int
n
);
void
MergeArray
(
PBVAL
bap1
,
PBVAL
bap2
);
void
DeleteValue
(
PBVAL
bap
,
int
n
);
void
AddArrayValue
(
PBVAL
bap
,
OFFSET
nvp
=
NULL
,
int
*
x
=
NULL
);
inline
void
AddArrayValue
(
PBVAL
bap
,
PBVAL
nvp
=
NULL
,
int
*
x
=
NULL
)
{
AddArrayValue
(
bap
,
MOF
(
nvp
),
x
);}
void
SetArrayValue
(
PBVAL
bap
,
PBVAL
nvp
,
int
n
);
bool
IsArrayNull
(
PBVAL
bap
);
// Object functions
int
GetObjectSize
(
PBPR
bop
,
bool
b
=
false
);
PBPR
GetNext
(
PBPR
prp
)
{
return
MPP
(
prp
->
Next
);}
PSZ
GetObjectText
(
PGLOBAL
g
,
PBPR
bop
,
PSTRG
text
);
PBPR
MergeObject
(
PBPR
bop1
,
PBPR
bop2
);
PBPR
AddPair
(
PBPR
bop
,
PSZ
key
,
OFFSET
val
=
0
);
inline
PBPR
GetObject
(
PBVAL
bop
)
{
return
MPP
(
bop
->
To_Val
);}
inline
PBPR
GetNext
(
PBPR
brp
)
{
return
MPP
(
brp
->
Next
);
}
int
GetObjectSize
(
PBVAL
bop
,
bool
b
=
false
);
PSZ
GetObjectText
(
PGLOBAL
g
,
PBVAL
bop
,
PSTRG
text
);
PBVAL
MergeObject
(
PBVAL
bop1
,
PBVAL
bop2
);
void
AddPair
(
PBVAL
bop
,
PSZ
key
,
OFFSET
val
=
0
);
PSZ
GetKey
(
PBPR
prp
)
{
return
MZP
(
prp
->
Key
);}
PBVAL
GetVal
(
PBPR
prp
)
{
return
MVP
(
prp
->
Vlp
);}
PBVAL
GetKeyValue
(
PB
PR
bop
,
PSZ
key
);
PBVAL
GetKeyList
(
PB
PR
bop
);
PBVAL
GetObjectValList
(
PB
PR
bop
);
PBPR
SetKeyValue
(
PBPR
bop
,
OFFSET
bvp
,
PSZ
key
);
inline
PBPR
SetKeyValue
(
PBPR
bop
,
PBVAL
vlp
,
PSZ
key
)
{
return
SetKeyValue
(
bop
,
MOF
(
vlp
),
key
);}
PBPR
DeleteKey
(
PBPR
bop
,
PCSZ
k
);
bool
IsObjectNull
(
PB
PR
bop
);
PBVAL
GetKeyValue
(
PB
VAL
bop
,
PSZ
key
);
PBVAL
GetKeyList
(
PB
VAL
bop
);
PBVAL
GetObjectValList
(
PB
VAL
bop
);
void
SetKeyValue
(
PBVAL
bop
,
OFFSET
bvp
,
PSZ
key
);
inline
void
SetKeyValue
(
PBVAL
bop
,
PBVAL
vlp
,
PSZ
key
)
{
SetKeyValue
(
bop
,
MOF
(
vlp
),
key
);}
void
DeleteKey
(
PBVAL
bop
,
PCSZ
k
);
bool
IsObjectNull
(
PB
VAL
bop
);
// Value functions
int
GetSize
(
PBVAL
vlp
,
bool
b
=
false
);
PBVAL
GetNext
(
PBVAL
vlp
)
{
return
MVP
(
vlp
->
Next
);}
PBPR
GetObject
(
PBVAL
vlp
);
PBVAL
GetArray
(
PBVAL
vlp
);
//PJSON GetJsp(void) { return (DataType == TYPE_JSON ? Jsp : NULL); }
PSZ
GetValueText
(
PGLOBAL
g
,
PBVAL
vlp
,
PSTRG
text
);
inline
PBVAL
GetBson
(
PBVAL
bvp
)
{
return
IsJson
(
bvp
)
?
MVP
(
bvp
->
To_Val
)
:
bvp
;
}
...
...
@@ -131,10 +135,10 @@ class BJSON : public BLOCK {
long
long
GetBigint
(
PBVAL
vp
);
double
GetDouble
(
PBVAL
vp
);
PVAL
GetValue
(
PGLOBAL
g
,
PBVAL
vp
);
void
SetValueObj
(
PBVAL
vlp
,
PB
PR
bop
);
void
SetValueObj
(
PBVAL
vlp
,
PB
VAL
bop
);
void
SetValueArr
(
PBVAL
vlp
,
PBVAL
bap
);
void
SetValueVal
(
PBVAL
vlp
,
PBVAL
vp
);
void
SetValue
(
PBVAL
vlp
,
PVAL
valp
);
PBVAL
SetValue
(
PBVAL
vlp
,
PVAL
valp
);
void
SetString
(
PBVAL
vlp
,
PSZ
s
,
int
ci
=
0
);
void
SetInteger
(
PBVAL
vlp
,
int
n
);
void
SetBigint
(
PBVAL
vlp
,
longlong
ll
);
...
...
storage/connect/bsonudf.cpp
View file @
c05b1288
This diff is collapsed.
Click to expand it.
storage/connect/bsonudf.h
View file @
c05b1288
...
...
@@ -46,10 +46,10 @@ class BJNX : public BDOC {
PBVAL
GetRow
(
PGLOBAL
g
);
my_bool
CompareValues
(
PGLOBAL
g
,
PBVAL
v1
,
PBVAL
v2
);
my_bool
LocateArray
(
PGLOBAL
g
,
PBVAL
jarp
);
my_bool
LocateObject
(
PGLOBAL
g
,
PB
PR
jobp
);
my_bool
LocateObject
(
PGLOBAL
g
,
PB
VAL
jobp
);
my_bool
LocateValue
(
PGLOBAL
g
,
PBVAL
jvp
);
my_bool
LocateArrayAll
(
PGLOBAL
g
,
PBVAL
jarp
);
my_bool
LocateObjectAll
(
PGLOBAL
g
,
PB
PR
jobp
);
my_bool
LocateObjectAll
(
PGLOBAL
g
,
PB
VAL
jobp
);
my_bool
LocateValueAll
(
PGLOBAL
g
,
PBVAL
jvp
);
my_bool
CompareTree
(
PGLOBAL
g
,
PBVAL
jp1
,
PBVAL
jp2
);
my_bool
AddPath
(
void
);
...
...
storage/connect/filamap.cpp
View file @
c05b1288
...
...
@@ -170,7 +170,8 @@ bool MAPFAM::OpenTableFile(PGLOBAL g)
htrc
(
"CreateFileMap: %s
\n
"
,
g
->
Message
);
return
(
mode
==
MODE_READ
&&
rc
==
ENOENT
)
?
PushWarning
(
g
,
Tdbp
)
:
true
;
?
false
:
true
;
// ? PushWarning(g, Tdbp) : true; --> assert fails into MariaDB
}
// endif hFile
/*******************************************************************/
...
...
storage/connect/global.h
View file @
c05b1288
...
...
@@ -220,34 +220,11 @@ DllExport char *PlugDup(PGLOBAL g, const char *str);
DllExport
void
htrc
(
char
const
*
fmt
,
...);
DllExport
void
xtrc
(
uint
,
char
const
*
fmt
,
...);
DllExport
uint
GetTraceValue
(
void
);
DllExport
void
*
MakePtr
(
void
*
memp
,
size_t
offset
);
DllExport
size_t
MakeOff
(
void
*
memp
,
void
*
ptr
);
#if defined(__cplusplus)
}
// extern "C"
#endif
/***********************************************************************/
/* Inline routine definitions. */
/***********************************************************************/
/***********************************************************************/
/* This routine makes a pointer from an offset to a memory pointer. */
/***********************************************************************/
inline
void
*
MakePtr
(
void
*
memp
,
size_t
offset
)
{
// return ((offset == 0) ? NULL : &((char*)memp)[offset]);
return
(
!
offset
)
?
NULL
:
(
char
*
)
memp
+
offset
;
}
/* end of MakePtr */
/***********************************************************************/
/* This routine makes an offset from a pointer new format. */
/***********************************************************************/
inline
size_t
MakeOff
(
void
*
memp
,
void
*
ptr
)
{
if
(
ptr
)
{
#if defined(_DEBUG)
assert
(
ptr
>
memp
);
#endif // _DEBUG
return
(
size_t
)((
char
*
)
ptr
-
(
size_t
)
memp
);
}
else
return
0
;
}
/* end of MakeOff */
/*-------------------------- End of Global.H --------------------------*/
storage/connect/mysql-test/connect/disabled.def
View file @
c05b1288
...
...
@@ -20,4 +20,5 @@ mongo_c : Need MongoDB running and its C Driver installed
mongo_java_2 : Need MongoDB running and its Java Driver installed
mongo_java_3 : Need MongoDB running and its Java Driver installed
tbl_thread : Bug MDEV-9844,10179,14214 03/01/2018 OB Option THREAD removed
bson : Development
#vcol : Different error code on different versions
storage/connect/plugutil.cpp
View file @
c05b1288
...
...
@@ -607,4 +607,27 @@ char *PlugDup(PGLOBAL g, const char *str)
}
// end of PlugDup
/*--------------------- End of PLUGUTIL program -----------------------*/
/*************************************************************************/
/* This routine makes a pointer from an offset to a memory pointer. */
/*************************************************************************/
void
*
MakePtr
(
void
*
memp
,
size_t
offset
)
{
// return ((offset == 0) ? NULL : &((char*)memp)[offset]);
return
(
!
offset
)
?
NULL
:
(
char
*
)
memp
+
offset
;
}
/* end of MakePtr */
/*************************************************************************/
/* This routine makes an offset from a pointer new format. */
/*************************************************************************/
size_t
MakeOff
(
void
*
memp
,
void
*
ptr
)
{
if
(
ptr
)
{
#if defined(_DEBUG) || defined(DEVELOPMENT)
if
(
ptr
<=
memp
)
fprintf
(
stderr
,
"ptr %p <= memp %p"
,
ptr
,
memp
);
#endif // _DEBUG || DEVELOPMENT
return
(
size_t
)((
char
*
)
ptr
-
(
size_t
)
memp
);
}
else
return
0
;
}
/* end of MakeOff */
/*--------------------- End of PLUGUTIL program -----------------------*/
storage/connect/tabbson.cpp
View file @
c05b1288
This diff is collapsed.
Click to expand it.
storage/connect/tabbson.h
View file @
c05b1288
...
...
@@ -134,7 +134,7 @@ class BCUTIL : public BTUTIL {
PVAL
MakeBson
(
PGLOBAL
g
,
PBVAL
jsp
);
PVAL
GetColumnValue
(
PGLOBAL
g
,
PBVAL
row
,
int
i
);
PVAL
ExpandArray
(
PGLOBAL
g
,
PBVAL
arp
,
int
n
);
PVAL
CalculateArray
(
PBVAL
arp
,
int
n
);
PVAL
CalculateArray
(
P
GLOBAL
g
,
P
BVAL
arp
,
int
n
);
PBVAL
GetRow
(
PGLOBAL
g
);
protected:
...
...
@@ -243,7 +243,7 @@ class DllExport BSONCOL : public DOSCOL {
// Methods
virtual
bool
SetBuffer
(
PGLOBAL
g
,
PVAL
value
,
bool
ok
,
bool
check
);
bool
ParseJpath
(
PGLOBAL
g
);
bool
ParseJpath
(
PGLOBAL
g
);
virtual
PSZ
GetJpath
(
PGLOBAL
g
,
bool
proj
);
virtual
void
ReadColumn
(
PGLOBAL
g
);
virtual
void
WriteColumn
(
PGLOBAL
g
);
...
...
@@ -251,12 +251,6 @@ class DllExport BSONCOL : public DOSCOL {
protected:
bool
CheckExpand
(
PGLOBAL
g
,
int
i
,
PSZ
nm
,
bool
b
);
bool
SetArrayOptions
(
PGLOBAL
g
,
char
*
p
,
int
i
,
PSZ
nm
);
//PVAL GetColumnValue(PGLOBAL g, PBVAL row, int i);
//PVAL ExpandArray(PGLOBAL g, PBVAL arp, int n);
//PVAL CalculateArray(PGLOBAL g, PBVAL arp, int n);
PVAL
MakeBson
(
PGLOBAL
g
,
PBVAL
jsp
);
//void SetJsonValue(PGLOBAL g, PVAL vp, PBVAL val);
//PBVAL GetRow(PGLOBAL g);
// Default constructor not to be used
BSONCOL
(
void
)
{}
...
...
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