~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to sql/sql_plugin.cc

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
644
644
    *plugin= pi;
645
645
#endif
646
646
    pi->ref_count++;
647
 
    DBUG_PRINT("info",("thd: 0x%lx, plugin: \"%s\", ref_count: %d",
 
647
    DBUG_PRINT("info",("thd: 0x%lx  plugin: \"%s\"  ref_count: %d",
648
648
                       (long) current_thd, pi->name.str, pi->ref_count));
649
649
 
650
650
    if (lex)
1146
1146
  {
1147
1147
    for (plugin= *builtins; plugin->info; plugin++)
1148
1148
    {
1149
 
      /* by default, only ndbcluster is disabled */
 
1149
      /* by default, ndbcluster and federated are disabled */
1150
1150
      def_enabled=
1151
 
        my_strcasecmp(&my_charset_latin1, plugin->name, "NDBCLUSTER") != 0;
 
1151
        my_strcasecmp(&my_charset_latin1, plugin->name, "NDBCLUSTER") != 0 &&
 
1152
        my_strcasecmp(&my_charset_latin1, plugin->name, "FEDERATED") != 0;
1152
1153
      bzero(&tmp, sizeof(tmp));
1153
1154
      tmp.plugin= plugin;
1154
1155
      tmp.name.str= (char *)plugin->name;
1343
1344
  tables.alias= tables.table_name= (char*)"plugin";
1344
1345
  tables.lock_type= TL_READ;
1345
1346
  tables.db= new_thd->db;
 
1347
  alloc_mdl_locks(&tables, tmp_root);
1346
1348
 
1347
1349
#ifdef EMBEDDED_LIBRARY
1348
1350
  /*
1450
1452
 
1451
1453
            free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
1452
1454
            if (plugin_add(tmp_root, &name, &dl, argc, argv, REPORT_TO_LOG))
1453
 
            {
1454
 
              pthread_mutex_unlock(&LOCK_plugin);
1455
1455
              goto error;
1456
 
            }
1457
1456
          }
1458
1457
          plugin_dl_del(&dl); // reduce ref count
1459
1458
        }
1463
1462
        free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
1464
1463
        pthread_mutex_lock(&LOCK_plugin);
1465
1464
        if (plugin_add(tmp_root, &name, &dl, argc, argv, REPORT_TO_LOG))
1466
 
        {
1467
 
          pthread_mutex_unlock(&LOCK_plugin);
1468
1465
          goto error;
1469
 
        }
1470
1466
      }
1471
1467
      pthread_mutex_unlock(&LOCK_plugin);
1472
1468
      name.length= dl.length= 0;
1489
1485
  }
1490
1486
  DBUG_RETURN(FALSE);
1491
1487
error:
 
1488
  pthread_mutex_unlock(&LOCK_plugin);
1492
1489
  sql_print_error("Couldn't load plugin named '%s' with soname '%s'.",
1493
1490
                  name.str, dl.str);
1494
1491
  DBUG_RETURN(TRUE);
1647
1644
  if (check_table_access(thd, INSERT_ACL, &tables, FALSE, FALSE, 1))
1648
1645
    DBUG_RETURN(TRUE);
1649
1646
 
 
1647
  alloc_mdl_locks(&tables, thd->mem_root);
 
1648
 
1650
1649
  /* need to open before acquiring LOCK_plugin or it will deadlock */
1651
1650
  if (! (table = open_ltable(thd, &tables, TL_WRITE, 0)))
1652
1651
    DBUG_RETURN(TRUE);
1703
1702
  bzero(&tables, sizeof(tables));
1704
1703
  tables.db= (char *)"mysql";
1705
1704
  tables.table_name= tables.alias= (char *)"plugin";
 
1705
  alloc_mdl_locks(&tables, thd->mem_root);
1706
1706
 
1707
1707
  /* need to open before acquiring LOCK_plugin or it will deadlock */
1708
1708
  if (! (table= open_ltable(thd, &tables, TL_WRITE, 0)))
2520
2520
    {
2521
2521
      /* Free the string from global_system_variables. */
2522
2522
      char **valptr= (char**) piv->real_value_ptr(NULL, OPT_GLOBAL);
2523
 
      DBUG_PRINT("plugin", ("freeing value for: '%s'  addr: 0x%lx",
2524
 
                            var->name, (long) valptr));
 
2523
      DBUG_PRINT("plugin", ("freeing value for: '%s'  addr: %p",
 
2524
                            var->name, valptr));
2525
2525
      my_free(*valptr, MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR));
2526
2526
      *valptr= NULL;
2527
2527
    }
2598
2598
  default:
2599
2599
    return NULL;
2600
2600
  }
2601
 
  return NULL;
 
2601
  return NULL;  /* Keep compiler happy */
2602
2602
}
2603
2603
 
2604
2604