~ubuntu-branches/ubuntu/wily/mysql-5.6/wily

« back to all changes in this revision

Viewing changes to storage/innobase/fts/fts0fts.cc

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2015-04-16 20:07:10 UTC
  • mto: (1.3.9 vivid-proposed)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: package-import@ubuntu.com-20150416200710-pcrsa022082zj46k
Tags: upstream-5.6.24
ImportĀ upstreamĀ versionĀ 5.6.24

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 2011, 2014, Oracle and/or its affiliates. All Rights Reserved.
 
3
Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
81
81
/** Error condition reported by fts_utf8_decode() */
82
82
const ulint UTF8_ERROR = 0xFFFFFFFF;
83
83
 
 
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;
86
87
 
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 */
89
91
 
90
92
/** Time to sleep after DEADLOCK error before retrying operation. */
91
93
static const ulint FTS_DEADLOCK_RETRY_WAIT = 100000;
191
193
        ""
192
194
        "CREATE TABLE \"%s_CONFIG\" (\n"
193
195
        "  key CHAR(50),\n"
194
 
        "  value CHAR(50) NOT NULL\n"
 
196
        "  value CHAR(200) NOT NULL\n"
195
197
        ") COMPACT;\n"
196
198
        "CREATE UNIQUE CLUSTERED INDEX IND ON \"%s_CONFIG\"(key);\n"
197
199
};
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. */
334
 
UNIV_INLINE
335
 
ibool
336
 
fts_is_stop_signalled(
337
 
/*==================*/
338
 
        fts_t*          fts)                    /*!< in: fts instance */
339
 
{
340
 
        ibool           stop_signalled = FALSE;
341
 
 
342
 
        mutex_enter(&fts->bg_threads_mutex);
343
 
 
344
 
        if (fts->fts_status & BG_THREAD_STOP) {
345
 
 
346
 
                stop_signalled = TRUE;
347
 
        }
348
 
 
349
 
        mutex_exit(&fts->bg_threads_mutex);
350
 
 
351
 
        return(stop_signalled);
352
 
}
353
334
 
354
335
/****************************************************************//**
355
336
This function loads the default InnoDB stopword list */
3408
3389
                doc->charset = get_doc->index_cache->charset;
3409
3390
 
3410
3391
                /* Null Field */
3411
 
                if (doc->text.f_len == UNIV_SQL_NULL) {
 
3392
                if (doc->text.f_len == UNIV_SQL_NULL || doc->text.f_len == 0) {
3412
3393
                        continue;
3413
3394
                }
3414
3395
 
5544
5525
 
5545
5526
/*********************************************************************//**
5546
5527
Release the savepoint data identified by  name. All savepoints created
5547
 
after the named savepoint are also released.
 
5528
after the named savepoint are kept.
5548
5529
@return DB_SUCCESS or error code */
5549
5530
UNIV_INTERN
5550
5531
void
5553
5534
        trx_t*          trx,            /*!< in: transaction */
5554
5535
        const char*     name)           /*!< in: savepoint name */
5555
5536
{
5556
 
        ulint                   i;
5557
 
        ib_vector_t*            savepoints;
5558
 
        ulint                   top_of_stack = 0;
5559
 
 
5560
5537
        ut_a(name != NULL);
5561
5538
 
5562
 
        savepoints = trx->fts_trx->savepoints;
 
5539
        ib_vector_t*    savepoints = trx->fts_trx->savepoints;
5563
5540
 
5564
5541
        ut_a(ib_vector_size(savepoints) > 0);
5565
5542
 
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) {
 
5545
                ut_a(i >= 1);
5569
5546
 
 
5547
                fts_savepoint_t*        savepoint;
5570
5548
                savepoint = static_cast<fts_savepoint_t*>(
5571
5549
                        ib_vector_get(savepoints, i));
5572
5550
 
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) {
5579
 
                        break;
5580
 
 
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. */
5586
 
                        top_of_stack = i;
5587
 
                }
5588
 
        }
5589
 
 
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;
5594
 
                ib_rbt_t*               tables;
5595
 
 
5596
 
                ut_a(top_of_stack < ib_vector_size(savepoints));
5597
 
 
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;
5606
 
 
5607
 
                /* Skip the implied savepoint. */
5608
 
                for (i = ib_vector_size(savepoints) - 1;
5609
 
                     i > top_of_stack;
5610
 
                     --i) {
5611
 
 
5612
 
                        fts_savepoint_t*        savepoint;
5613
 
 
5614
 
                        savepoint = static_cast<fts_savepoint_t*>(
5615
 
                                ib_vector_get(savepoints, i));
5616
 
 
5617
 
                        /* Skip savepoints that were released earlier. */
5618
 
                        if (savepoint->name != NULL) {
5619
 
                                savepoint->name = NULL;
5620
 
                                fts_savepoint_free(savepoint);
5621
 
                        }
5622
 
 
5623
 
                        ib_vector_pop(savepoints);
5624
 
                }
 
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));
 
5557
 
 
5558
                        ib_rbt_t*       tables = savepoint->tables;
 
5559
                        savepoint->tables = prev_savepoint->tables;
 
5560
                        prev_savepoint->tables = tables;
 
5561
                }
 
5562
 
 
5563
                fts_savepoint_free(savepoint);
 
5564
                ib_vector_remove(savepoints, *(void**)savepoint);
5625
5565
 
5626
5566
                /* Make sure we don't delete the implied savepoint. */
5627
5567
                ut_a(ib_vector_size(savepoints) > 0);
5628
 
 
5629
 
                /* This must hold. */
5630
 
                ut_a(ib_vector_size(savepoints) == (top_of_stack + 1));
5631
5568
        }
5632
5569
}
5633
5570
 
6329
6266
{
6330
6267
        ib_id_t         dec_id = 0;
6331
6268
        char            tmp_id[FTS_AUX_MIN_TABLE_ID_LENGTH];
6332
 
        int             ret;
 
6269
        int             ret __attribute__((unused));
6333
6270
 
6334
6271
        ret = sprintf(tmp_id, UINT64PFx, id);
6335
6272
        ut_ad(ret == 16);