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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
ec0396fe
Commit
ec0396fe
authored
Apr 13, 2005
by
mskold@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge
parents
9c015f2a
f5855f2d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
31 deletions
+41
-31
ndb/src/ndbapi/Ndb.cpp
ndb/src/ndbapi/Ndb.cpp
+25
-17
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+15
-13
sql/mysqld.cc
sql/mysqld.cc
+1
-1
No files found.
ndb/src/ndbapi/Ndb.cpp
View file @
ec0396fe
...
@@ -756,26 +756,28 @@ Remark: Returns a new TupleId to the application.
...
@@ -756,26 +756,28 @@ Remark: Returns a new TupleId to the application.
Uint64
Uint64
Ndb
::
getAutoIncrementValue
(
const
char
*
aTableName
,
Uint32
cacheSize
)
Ndb
::
getAutoIncrementValue
(
const
char
*
aTableName
,
Uint32
cacheSize
)
{
{
D
EBUG_TRACE
(
"getAutoIncrementValue"
);
D
BUG_ENTER
(
"getAutoIncrementValue"
);
const
char
*
internalTableName
=
internalizeTableName
(
aTableName
);
const
char
*
internalTableName
=
internalizeTableName
(
aTableName
);
Ndb_local_table_info
*
info
=
Ndb_local_table_info
*
info
=
theDictionary
->
get_local_table_info
(
internalTableName
,
false
);
theDictionary
->
get_local_table_info
(
internalTableName
,
false
);
if
(
info
==
0
)
if
(
info
==
0
)
return
~
0
;
DBUG_RETURN
(
~
(
Uint64
)
0
)
;
const
NdbTableImpl
*
table
=
info
->
m_table_impl
;
const
NdbTableImpl
*
table
=
info
->
m_table_impl
;
Uint64
tupleId
=
getTupleIdFromNdb
(
table
->
m_tableId
,
cacheSize
);
Uint64
tupleId
=
getTupleIdFromNdb
(
table
->
m_tableId
,
cacheSize
);
return
tupleId
;
DBUG_PRINT
(
"info"
,
(
"value %u"
,
tupleId
));
DBUG_RETURN
(
tupleId
);
}
}
Uint64
Uint64
Ndb
::
getAutoIncrementValue
(
const
NdbDictionary
::
Table
*
aTable
,
Uint32
cacheSize
)
Ndb
::
getAutoIncrementValue
(
const
NdbDictionary
::
Table
*
aTable
,
Uint32
cacheSize
)
{
{
D
EBUG_TRACE
(
"getAutoIncrementValue"
);
D
BUG_ENTER
(
"getAutoIncrementValue"
);
if
(
aTable
==
0
)
if
(
aTable
==
0
)
return
~
0
;
DBUG_RETURN
(
~
(
Uint64
)
0
)
;
const
NdbTableImpl
*
table
=
&
NdbTableImpl
::
getImpl
(
*
aTable
);
const
NdbTableImpl
*
table
=
&
NdbTableImpl
::
getImpl
(
*
aTable
);
Uint64
tupleId
=
getTupleIdFromNdb
(
table
->
m_tableId
,
cacheSize
);
Uint64
tupleId
=
getTupleIdFromNdb
(
table
->
m_tableId
,
cacheSize
);
return
tupleId
;
DBUG_PRINT
(
"info"
,
(
"value %u"
,
tupleId
));
DBUG_RETURN
(
tupleId
);
}
}
Uint64
Uint64
...
@@ -783,46 +785,52 @@ Ndb::getTupleIdFromNdb(const char* aTableName, Uint32 cacheSize)
...
@@ -783,46 +785,52 @@ Ndb::getTupleIdFromNdb(const char* aTableName, Uint32 cacheSize)
{
{
const
NdbTableImpl
*
table
=
theDictionary
->
getTable
(
aTableName
);
const
NdbTableImpl
*
table
=
theDictionary
->
getTable
(
aTableName
);
if
(
table
==
0
)
if
(
table
==
0
)
return
~
0
;
return
~
(
Uint64
)
0
;
return
getTupleIdFromNdb
(
table
->
m_tableId
,
cacheSize
);
return
getTupleIdFromNdb
(
table
->
m_tableId
,
cacheSize
);
}
}
Uint64
Uint64
Ndb
::
getTupleIdFromNdb
(
Uint32
aTableId
,
Uint32
cacheSize
)
Ndb
::
getTupleIdFromNdb
(
Uint32
aTableId
,
Uint32
cacheSize
)
{
{
DBUG_ENTER
(
"getTupleIdFromNdb"
);
if
(
theFirstTupleId
[
aTableId
]
!=
theLastTupleId
[
aTableId
]
)
if
(
theFirstTupleId
[
aTableId
]
!=
theLastTupleId
[
aTableId
]
)
{
{
theFirstTupleId
[
aTableId
]
++
;
theFirstTupleId
[
aTableId
]
++
;
return
theFirstTupleId
[
aTableId
];
DBUG_PRINT
(
"info"
,
(
"next cached value %u"
,
theFirstTupleId
[
aTableId
]));
DBUG_RETURN
(
theFirstTupleId
[
aTableId
]);
}
}
else
// theFirstTupleId == theLastTupleId
else
// theFirstTupleId == theLastTupleId
{
{
return
opTupleIdOnNdb
(
aTableId
,
cacheSize
,
0
);
DBUG_PRINT
(
"info"
,(
"reading %u values from database"
,
(
cacheSize
==
0
)
?
1
:
cacheSize
));
DBUG_RETURN
(
opTupleIdOnNdb
(
aTableId
,
(
cacheSize
==
0
)
?
1
:
cacheSize
,
0
));
}
}
}
}
Uint64
Uint64
Ndb
::
readAutoIncrementValue
(
const
char
*
aTableName
)
Ndb
::
readAutoIncrementValue
(
const
char
*
aTableName
)
{
{
D
EBUG_TRACE
(
"readtAutoIncrementValue"
);
D
BUG_ENTER
(
"readtAutoIncrementValue"
);
const
NdbTableImpl
*
table
=
theDictionary
->
getTable
(
aTableName
);
const
NdbTableImpl
*
table
=
theDictionary
->
getTable
(
aTableName
);
if
(
table
==
0
)
{
if
(
table
==
0
)
{
theError
=
theDictionary
->
getNdbError
();
theError
=
theDictionary
->
getNdbError
();
return
~
0
;
DBUG_RETURN
(
~
(
Uint64
)
0
)
;
}
}
Uint64
tupleId
=
readTupleIdFromNdb
(
table
->
m_tableId
);
Uint64
tupleId
=
readTupleIdFromNdb
(
table
->
m_tableId
);
return
tupleId
;
DBUG_PRINT
(
"info"
,
(
"value %u"
,
tupleId
));
DBUG_RETURN
(
tupleId
);
}
}
Uint64
Uint64
Ndb
::
readAutoIncrementValue
(
const
NdbDictionary
::
Table
*
aTable
)
Ndb
::
readAutoIncrementValue
(
const
NdbDictionary
::
Table
*
aTable
)
{
{
D
EBUG_TRACE
(
"readtAutoIncrementValue"
);
D
BUG_ENTER
(
"readtAutoIncrementValue"
);
if
(
aTable
==
0
)
if
(
aTable
==
0
)
return
~
0
;
DBUG_RETURN
(
~
(
Uint64
)
0
)
;
const
NdbTableImpl
*
table
=
&
NdbTableImpl
::
getImpl
(
*
aTable
);
const
NdbTableImpl
*
table
=
&
NdbTableImpl
::
getImpl
(
*
aTable
);
Uint64
tupleId
=
readTupleIdFromNdb
(
table
->
m_tableId
);
Uint64
tupleId
=
readTupleIdFromNdb
(
table
->
m_tableId
);
return
tupleId
;
DBUG_PRINT
(
"info"
,
(
"value %u"
,
tupleId
));
DBUG_RETURN
(
tupleId
);
}
}
Uint64
Uint64
...
@@ -855,7 +863,7 @@ Ndb::setAutoIncrementValue(const NdbDictionary::Table * aTable, Uint64 val, bool
...
@@ -855,7 +863,7 @@ Ndb::setAutoIncrementValue(const NdbDictionary::Table * aTable, Uint64 val, bool
{
{
DEBUG_TRACE
(
"setAutoIncrementValue "
<<
val
);
DEBUG_TRACE
(
"setAutoIncrementValue "
<<
val
);
if
(
aTable
==
0
)
if
(
aTable
==
0
)
return
~
0
;
return
~
(
Uint64
)
0
;
const
NdbTableImpl
*
table
=
&
NdbTableImpl
::
getImpl
(
*
aTable
);
const
NdbTableImpl
*
table
=
&
NdbTableImpl
::
getImpl
(
*
aTable
);
return
setTupleIdInNdb
(
table
->
m_tableId
,
val
,
increase
);
return
setTupleIdInNdb
(
table
->
m_tableId
,
val
,
increase
);
}
}
...
@@ -1010,7 +1018,7 @@ Ndb::opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op)
...
@@ -1010,7 +1018,7 @@ Ndb::opTupleIdOnNdb(Uint32 aTableId, Uint64 opValue, Uint32 op)
theError
.
code
,
theError
.
code
,
tConnection
?
tConnection
->
theError
.
code
:
-
1
,
tConnection
?
tConnection
->
theError
.
code
:
-
1
,
tOperation
?
tOperation
->
theError
.
code
:
-
1
));
tOperation
?
tOperation
->
theError
.
code
:
-
1
));
DBUG_RETURN
(
~
0
);
DBUG_RETURN
(
~
(
Uint64
)
0
);
}
}
Uint32
Uint32
...
...
sql/ha_ndbcluster.cc
View file @
ec0396fe
...
@@ -1957,7 +1957,7 @@ int ha_ndbcluster::write_row(byte *record)
...
@@ -1957,7 +1957,7 @@ int ha_ndbcluster::write_row(byte *record)
m_rows_inserted
++
;
m_rows_inserted
++
;
no_uncommitted_rows_update
(
1
);
no_uncommitted_rows_update
(
1
);
m_bulk_insert_not_flushed
=
TRUE
;
m_bulk_insert_not_flushed
=
TRUE
;
if
((
m_rows_to_insert
==
1
)
||
if
((
m_rows_to_insert
==
(
ha_rows
)
1
)
||
((
m_rows_inserted
%
m_bulk_insert_rows
)
==
0
)
||
((
m_rows_inserted
%
m_bulk_insert_rows
)
==
0
)
||
set_blob_value
)
set_blob_value
)
{
{
...
@@ -2973,8 +2973,8 @@ void ha_ndbcluster::start_bulk_insert(ha_rows rows)
...
@@ -2973,8 +2973,8 @@ void ha_ndbcluster::start_bulk_insert(ha_rows rows)
DBUG_ENTER
(
"start_bulk_insert"
);
DBUG_ENTER
(
"start_bulk_insert"
);
DBUG_PRINT
(
"enter"
,
(
"rows: %d"
,
(
int
)
rows
));
DBUG_PRINT
(
"enter"
,
(
"rows: %d"
,
(
int
)
rows
));
m_rows_inserted
=
0
;
m_rows_inserted
=
(
ha_rows
)
0
;
if
(
rows
==
0
)
if
(
rows
==
(
ha_rows
)
0
)
/* We don't know how many will be inserted, guess */
/* We don't know how many will be inserted, guess */
m_rows_to_insert
=
m_autoincrement_prefetch
;
m_rows_to_insert
=
m_autoincrement_prefetch
;
else
else
...
@@ -3012,7 +3012,7 @@ int ha_ndbcluster::end_bulk_insert()
...
@@ -3012,7 +3012,7 @@ int ha_ndbcluster::end_bulk_insert()
// Send rows to NDB
// Send rows to NDB
DBUG_PRINT
(
"info"
,
(
"Sending inserts to NDB, "
\
DBUG_PRINT
(
"info"
,
(
"Sending inserts to NDB, "
\
"rows_inserted:%d, bulk_insert_rows: %d"
,
"rows_inserted:%d, bulk_insert_rows: %d"
,
m_rows_inserted
,
m_bulk_insert_rows
));
(
int
)
m_rows_inserted
,
(
int
)
m_bulk_insert_rows
));
m_bulk_insert_not_flushed
=
FALSE
;
m_bulk_insert_not_flushed
=
FALSE
;
if
(
execute_no_commit
(
this
,
trans
)
!=
0
)
{
if
(
execute_no_commit
(
this
,
trans
)
!=
0
)
{
no_uncommitted_rows_execute_failure
();
no_uncommitted_rows_execute_failure
();
...
@@ -3020,8 +3020,8 @@ int ha_ndbcluster::end_bulk_insert()
...
@@ -3020,8 +3020,8 @@ int ha_ndbcluster::end_bulk_insert()
}
}
}
}
m_rows_inserted
=
0
;
m_rows_inserted
=
(
ha_rows
)
0
;
m_rows_to_insert
=
1
;
m_rows_to_insert
=
(
ha_rows
)
1
;
DBUG_RETURN
(
error
);
DBUG_RETURN
(
error
);
}
}
...
@@ -3203,7 +3203,8 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
...
@@ -3203,7 +3203,8 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
// store thread specific data first to set the right context
// store thread specific data first to set the right context
m_force_send
=
thd
->
variables
.
ndb_force_send
;
m_force_send
=
thd
->
variables
.
ndb_force_send
;
m_ha_not_exact_count
=
!
thd
->
variables
.
ndb_use_exact_count
;
m_ha_not_exact_count
=
!
thd
->
variables
.
ndb_use_exact_count
;
m_autoincrement_prefetch
=
thd
->
variables
.
ndb_autoincrement_prefetch_sz
;
m_autoincrement_prefetch
=
(
ha_rows
)
thd
->
variables
.
ndb_autoincrement_prefetch_sz
;
if
(
!
thd
->
transaction
.
on
)
if
(
!
thd
->
transaction
.
on
)
m_transaction_on
=
FALSE
;
m_transaction_on
=
FALSE
;
else
else
...
@@ -3727,7 +3728,7 @@ static int create_ndb_column(NDBCOL &col,
...
@@ -3727,7 +3728,7 @@ static int create_ndb_column(NDBCOL &col,
static
void
ndb_set_fragmentation
(
NDBTAB
&
tab
,
TABLE
*
form
,
uint
pk_length
)
static
void
ndb_set_fragmentation
(
NDBTAB
&
tab
,
TABLE
*
form
,
uint
pk_length
)
{
{
if
(
form
->
s
->
max_rows
==
0
)
/* default setting, don't set fragmentation */
if
(
form
->
max_rows
==
(
ha_rows
)
0
)
/* default setting, don't set fragmentation */
return
;
return
;
/**
/**
* get the number of fragments right
* get the number of fragments right
...
@@ -4093,6 +4094,7 @@ ulonglong ha_ndbcluster::get_auto_increment()
...
@@ -4093,6 +4094,7 @@ ulonglong ha_ndbcluster::get_auto_increment()
/* We guessed too low */
/* We guessed too low */
m_rows_to_insert
+=
m_autoincrement_prefetch
;
m_rows_to_insert
+=
m_autoincrement_prefetch
;
cache_size
=
cache_size
=
(
int
)
(
m_rows_to_insert
-
m_rows_inserted
<
m_autoincrement_prefetch
)
?
(
m_rows_to_insert
-
m_rows_inserted
<
m_autoincrement_prefetch
)
?
m_rows_to_insert
-
m_rows_inserted
m_rows_to_insert
-
m_rows_inserted
:
(
m_rows_to_insert
>
m_autoincrement_prefetch
)
?
:
(
m_rows_to_insert
>
m_autoincrement_prefetch
)
?
...
@@ -4129,10 +4131,10 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
...
@@ -4129,10 +4131,10 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
m_primary_key_update
(
FALSE
),
m_primary_key_update
(
FALSE
),
m_retrieve_all_fields
(
FALSE
),
m_retrieve_all_fields
(
FALSE
),
m_retrieve_primary_key
(
FALSE
),
m_retrieve_primary_key
(
FALSE
),
m_rows_to_insert
(
1
),
m_rows_to_insert
(
(
ha_rows
)
1
),
m_rows_inserted
(
0
),
m_rows_inserted
(
(
ha_rows
)
0
),
m_bulk_insert_rows
(
1024
),
m_bulk_insert_rows
(
(
ha_rows
)
1024
),
m_rows_changed
(
0
),
m_rows_changed
(
(
ha_rows
)
0
),
m_bulk_insert_not_flushed
(
FALSE
),
m_bulk_insert_not_flushed
(
FALSE
),
m_ops_pending
(
0
),
m_ops_pending
(
0
),
m_skip_auto_increment
(
TRUE
),
m_skip_auto_increment
(
TRUE
),
...
@@ -4142,7 +4144,7 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
...
@@ -4142,7 +4144,7 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg):
m_dupkey
((
uint
)
-
1
),
m_dupkey
((
uint
)
-
1
),
m_ha_not_exact_count
(
FALSE
),
m_ha_not_exact_count
(
FALSE
),
m_force_send
(
TRUE
),
m_force_send
(
TRUE
),
m_autoincrement_prefetch
(
32
),
m_autoincrement_prefetch
(
(
ha_rows
)
32
),
m_transaction_on
(
TRUE
),
m_transaction_on
(
TRUE
),
m_cond_stack
(
NULL
),
m_cond_stack
(
NULL
),
m_multi_cursor
(
NULL
)
m_multi_cursor
(
NULL
)
...
...
sql/mysqld.cc
View file @
ec0396fe
...
@@ -4704,7 +4704,7 @@ Disable with --skip-ndbcluster (will save memory).",
...
@@ -4704,7 +4704,7 @@ Disable with --skip-ndbcluster (will save memory).",
"Specify number of autoincrement values that are prefetched."
,
"Specify number of autoincrement values that are prefetched."
,
(
gptr
*
)
&
global_system_variables
.
ndb_autoincrement_prefetch_sz
,
(
gptr
*
)
&
global_system_variables
.
ndb_autoincrement_prefetch_sz
,
(
gptr
*
)
&
global_system_variables
.
ndb_autoincrement_prefetch_sz
,
(
gptr
*
)
&
global_system_variables
.
ndb_autoincrement_prefetch_sz
,
0
,
GET_
INT
,
REQUIRED_ARG
,
32
,
1
,
256
,
0
,
0
,
0
},
0
,
GET_
ULONG
,
REQUIRED_ARG
,
32
,
1
,
256
,
0
,
0
,
0
},
{
"ndb-force-send"
,
OPT_NDB_FORCE_SEND
,
{
"ndb-force-send"
,
OPT_NDB_FORCE_SEND
,
"Force send of buffers to ndb immediately without waiting for "
"Force send of buffers to ndb immediately without waiting for "
"other threads."
,
"other threads."
,
...
...
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