81
81
/** Error condition reported by fts_utf8_decode() */
82
82
const ulint UTF8_ERROR = 0xFFFFFFFF;
84
#ifdef FTS_CACHE_SIZE_DEBUG
84
85
/** The cache size permissible lower limit (1K) */
85
86
static const ulint FTS_CACHE_SIZE_LOWER_LIMIT_IN_MB = 1;
87
88
/** The cache size permissible upper limit (1G) */
88
89
static const ulint FTS_CACHE_SIZE_UPPER_LIMIT_IN_MB = 1024;
90
#endif /* FTS_CACHE_SIZE_DEBUG */
90
92
/** Time to sleep after DEADLOCK error before retrying operation. */
91
93
static const ulint FTS_DEADLOCK_RETRY_WAIT = 100000;
329
331
doc_id_t doc_id, /*!< in: last document id */
330
332
trx_t* trx) /*!< in: update trx, or NULL */
331
333
__attribute__((nonnull(1)));
332
/********************************************************************
333
Check if we should stop. */
336
fts_is_stop_signalled(
337
/*==================*/
338
fts_t* fts) /*!< in: fts instance */
340
ibool stop_signalled = FALSE;
342
mutex_enter(&fts->bg_threads_mutex);
344
if (fts->fts_status & BG_THREAD_STOP) {
346
stop_signalled = TRUE;
349
mutex_exit(&fts->bg_threads_mutex);
351
return(stop_signalled);
354
335
/****************************************************************//**
355
336
This function loads the default InnoDB stopword list */
5553
5534
trx_t* trx, /*!< in: transaction */
5554
5535
const char* name) /*!< in: savepoint name */
5557
ib_vector_t* savepoints;
5558
ulint top_of_stack = 0;
5560
5537
ut_a(name != NULL);
5562
savepoints = trx->fts_trx->savepoints;
5539
ib_vector_t* savepoints = trx->fts_trx->savepoints;
5564
5541
ut_a(ib_vector_size(savepoints) > 0);
5566
/* Skip the implied savepoint (first element). */
5567
for (i = 1; i < ib_vector_size(savepoints); ++i) {
5568
fts_savepoint_t* savepoint;
5543
ulint i = fts_savepoint_lookup(savepoints, name);
5544
if (i != ULINT_UNDEFINED) {
5547
fts_savepoint_t* savepoint;
5570
5548
savepoint = static_cast<fts_savepoint_t*>(
5571
5549
ib_vector_get(savepoints, i));
5573
/* Even though we release the resources that are part
5574
of the savepoint, we don't (always) actually delete the
5575
entry. We simply set the savepoint name to NULL. Therefore
5576
we have to skip deleted/released entries. */
5577
if (savepoint->name != NULL
5578
&& strcmp(name, savepoint->name) == 0) {
5581
/* Track the previous savepoint instance that will
5582
be at the top of the stack after the release. */
5583
} else if (savepoint->name != NULL) {
5584
/* We need to delete all entries
5585
greater than this element. */
5590
/* Only if we found and element to release. */
5591
if (i < ib_vector_size(savepoints)) {
5592
fts_savepoint_t* last_savepoint;
5593
fts_savepoint_t* top_savepoint;
5596
ut_a(top_of_stack < ib_vector_size(savepoints));
5598
/* Exchange tables between last savepoint and top savepoint */
5599
last_savepoint = static_cast<fts_savepoint_t*>(
5600
ib_vector_last(trx->fts_trx->savepoints));
5601
top_savepoint = static_cast<fts_savepoint_t*>(
5602
ib_vector_get(savepoints, top_of_stack));
5603
tables = top_savepoint->tables;
5604
top_savepoint->tables = last_savepoint->tables;
5605
last_savepoint->tables = tables;
5607
/* Skip the implied savepoint. */
5608
for (i = ib_vector_size(savepoints) - 1;
5612
fts_savepoint_t* savepoint;
5614
savepoint = static_cast<fts_savepoint_t*>(
5615
ib_vector_get(savepoints, i));
5617
/* Skip savepoints that were released earlier. */
5618
if (savepoint->name != NULL) {
5619
savepoint->name = NULL;
5620
fts_savepoint_free(savepoint);
5623
ib_vector_pop(savepoints);
5551
if (i == ib_vector_size(savepoints) - 1) {
5552
/* If the savepoint is the last, we save its
5553
tables to the previous savepoint. */
5554
fts_savepoint_t* prev_savepoint;
5555
prev_savepoint = static_cast<fts_savepoint_t*>(
5556
ib_vector_get(savepoints, i - 1));
5558
ib_rbt_t* tables = savepoint->tables;
5559
savepoint->tables = prev_savepoint->tables;
5560
prev_savepoint->tables = tables;
5563
fts_savepoint_free(savepoint);
5564
ib_vector_remove(savepoints, *(void**)savepoint);
5626
5566
/* Make sure we don't delete the implied savepoint. */
5627
5567
ut_a(ib_vector_size(savepoints) > 0);
5629
/* This must hold. */
5630
ut_a(ib_vector_size(savepoints) == (top_of_stack + 1));