Re: [Maria-developers] Debug interface

2013-06-25 Thread James Briggs
Roberto:

Also consider using DTrace on the Mac or Solaris, and the oprofile linux module.

Later, James.


On Tue, 6/25/13, Hartmut Holzgraefe hart...@skysql.com wrote:

 Subject: Re: [Maria-developers] Debug interface
 To: maria-developers@lists.launchpad.net
 Date: Tuesday, June 25, 2013, 12:17 AM
 
 On 06/25/2013 01:03 AM, Roberto
 Spadim wrote:
  hi guys, what ide could i use to debug easily in linux
 mariadb version?
  i'm using gdb via command line, but it's very
 complicate, i'm a visual
  studio user, but a console interface is nice, if i
 could put some break
  points and F5 (run),F8 (run one step)
 
 I'm using DDD for this, DDD (Data Display Debuger) is a GUI
 wrapper
 around GDB
 
 DDD - http://www.gnu.org/software/ddd/
 
 
 other options i know of but haven't tried myself would be
 Insight
 
 Insight - http://sourceware.org/insight/
 
 or using an IDE like Eclipse or KDevelop ...
 
 -- hartmut
 
 ___
 Mailing list: https://launchpad.net/~maria-developers
 Post to     : maria-developers@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~maria-developers
 More help   : https://help.launchpad.net/ListHelp
 

___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Maria-developers] Rev 3517: MySQL 5.6.10 performance schema: merge of host_cache table

2013-06-25 Thread Sergei Golubchik
Hi, Timour!

Just few comments

On Jun 25, tim...@askmonty.org wrote:
 
 revno: 3517
 revision-id: tim...@askmonty.org-20130621115451-tyxgeeroqyxwz7gn
 parent: mo...@askmonty.org-20130623091543-zqu5dvhry6okna6g
 committer: tim...@askmonty.org
 branch nick: 10.0-perf-schema-merge
 timestamp: Fri 2013-06-21 14:54:51 +0300
 message:
   MySQL 5.6.10 performance schema: merge of host_cache table

 === modified file 'sql/hostname.cc'
 --- a/sql/hostname.cc 2013-01-15 18:13:32 +
 +++ b/sql/hostname.cc 2013-06-21 11:54:51 +
 @@ -24,7 +24,7 @@
Hostnames are checked with reverse name lookup and checked that they
doesn't resemble an IP address.
  */
 -
 +#include my_global.h
  #include sql_priv.h
  #include hostname.h
  #include my_global.h

you don't need to include my_global.h twice here

 === modified file 'sql/sql_acl.cc'
 --- a/sql/sql_acl.cc  2013-06-17 23:01:34 +
 +++ b/sql/sql_acl.cc  2013-06-21 11:54:51 +
 @@ -8730,7 +8737,6 @@ static int server_mpvio_read_packet(MYSQ
  err:
if (mpvio-status == MPVIO_EXT::FAILURE)
{
 -inc_host_errors(mpvio-thd-security_ctx-ip);
  if (!mpvio-thd-is_error())
  {
if (mpvio-make_it_fail)
 @@ -8890,6 +8896,10 @@ static int do_auth_once(THD *thd, const
else
{
  /* Server cannot load the required plugin. */
 +Host_errors errors;
 +errors.m_no_auth_plugin= 1;
 +// merge-todo: struct MPVIO_EXT’ has no member named ‘ip’
 +// inc_host_errors(mpvio-ip, errors);

see above, the line you've removed in a previous chunk, used

  inc_host_errors(mpvio-thd-security_ctx-ip);

  my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), auth_plugin_name-str);
  res= CR_ERROR;
}
 @@ -8913,8 +8923,6 @@ static int do_auth_once(THD *thd, const
Perform the handshake, authorize the client and update thd sctx variables.
  
@param thd thread handle
 -  @param connect_errors  number of previous failed connect attemps
 - from this host

really? you've removed it from the comment, but not from the function,
so now acl_authenticate() has one undocumented argument.

@param com_change_user_pkt_len size of the COM_CHANGE_USER packet
   (without the first, command, byte) or 0
   if it's not a COM_CHANGE_USER (that is, if
 @@ -9017,8 +9025,27 @@ bool acl_authenticate(THD *thd, uint con
  
if (res  CR_OK  mpvio.status != MPVIO_EXT::SUCCESS)
{
 +Host_errors errors;
  DBUG_ASSERT(mpvio.status == MPVIO_EXT::FAILURE);
 -
 +switch (res)
 +{
 +case CR_AUTH_PLUGIN_ERROR:
 +  errors.m_auth_plugin= 1;
 +  break;
 +case CR_AUTH_HANDSHAKE:
 +  errors.m_handshake= 1;
 +  break;
 +case CR_AUTH_USER_CREDENTIALS:
 +  errors.m_authentication= 1;
 +  break;
 +case CR_ERROR:
 +default:
 +  /* Unknown of unspecified auth plugin error. */
 +  errors.m_auth_plugin= 1;
 +  break;
 +}
 +// merge-todo: struct MPVIO_EXT’ has no member named ‘ip’
 +// inc_host_errors(mpvio.ip, errors);

same as above.

And personally, I'd rather make a method errors.set_error(res); and move
the switch inside. But you may decide to stay closer to 5.6 code.

  if (!thd-is_error())
login_failed_error(thd);
  DBUG_RETURN(1);
 @@ -9256,23 +9283,20 @@ static int native_password_authenticate(
  #endif
  
if (pkt_len == 0) /* no password */
 -DBUG_RETURN(info-auth_string[0] ? CR_ERROR : CR_OK);
 +DBUG_RETURN(mpvio-acl_user-salt_len != 0 ? CR_AUTH_USER_CREDENTIALS : 
 CR_OK);

Why did you change the condition?
Our pluggable auth code is not identical to MySQL's, so not all
changes can be copied verbatim from there.

I think the old condition was ok.

info-password_used= PASSWORD_USED_YES;
if (pkt_len == SCRAMBLE_LENGTH)
{
  if (!mpvio-acl_user-salt_len)
 -  DBUG_RETURN(CR_ERROR);
 +  DBUG_RETURN(CR_AUTH_USER_CREDENTIALS);
  
 -if (check_scramble(pkt, thd-scramble, mpvio-acl_user-salt))
 -  DBUG_RETURN(CR_ERROR);
 -else
 -  DBUG_RETURN(CR_OK);
 +DBUG_RETURN(check_scramble(pkt, thd-scramble, mpvio-acl_user-salt) ?
 +CR_AUTH_USER_CREDENTIALS : CR_OK);

could you change it back please and only replace the error code?
if() is easier to debug, than a function call inside DBUG_RETURN().
I suppose that's why we have it that way.

}
  
 -  inc_host_errors(mpvio-thd-security_ctx-ip);
my_error(ER_HANDSHAKE_ERROR, MYF(0));
 -  DBUG_RETURN(CR_ERROR);
 +  DBUG_RETURN(CR_AUTH_HANDSHAKE);
  }

Regards,
Sergei

___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Maria-developers] MDEV-4472 (audit plugin)

2013-06-25 Thread Sergei Golubchik
Hi, Alexey!

On Jun 25, Alexey Botchkov wrote:
 Modified version of the file is in the same place:

Ok

  What's missing in it as i'm not sure how it can be done:
- No server host/ip in the log. How get that information?
 
  What server host/ip?
 
 I mean i don't know about the server's host/ip. The clien't one can be 
 found in the event as i understand.

Yes. But surely, you can find your own host/ip, cannot you?
See gethostname(), getaddrinfo(), etc.

 Works faster than the mysys/HASH invocation and not that much more lines 
 of code. But ok - redone with the server's HASH.

Thanks!

 line 248:
  static int write_log(const char *message, size_t len)
  {
if (output_type == OUTPUT_FILE)
  return logger_write(logfile, message, len);
return 0;
  }
  // better extend the logger service to support syslog
 
 I don't think so. The logger service is naturally oriented on files with 
 all these rotations and filesizes. And the SYSLOG interface is also 
 pretty simple and natural for it's purpose. So i really don't like 
 mixing these in one service.

My thought was that to log whatever is needed, a plugin opens and
configures a logger, and that's pretty much all it needs to do.

Having a purely file-oriented logger, every plugin that wants syslog,
would need to copy what you've done here, in this plugin.

While having one logger that understands many destinations, would
automatically make all plugins syslog-enabled.

On the other hand, logging to syslog often means using a different
logging format, which means plugins won't necessarily be automatically
syslog enabled.

Ok, let's keep syslog separate for now. When we'll have more logs
that go to syslog, we'll see if it makes sense to factor the common
code out.

fprintf(stderr, STARTED\n);
  // really? I thought you need to log it in the log
  // preferrably with the plugin version, and may be the server version
 too
 
 Spec states that we should report that events to the main server log.
 And it seems right to me. The logging in the plugin isn't necessarily 
 enabled here, and we know for sure that the plugin is enabled if
 we see records from it in it's log.

Fine.

Regards,
Sergei

___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Maria-developers] query cache issue

2013-06-25 Thread Roberto Spadim
it's a memory in client side with query_parameters (sql_mode, query text,
schema used, and others flags that change results) + query_results
example in php
$query_cache= array(
sql_mode=12341234124124;SELECT * from query_Table = array(
  tables_used=array(query_Table),
  0=array('a'=1,'b'=2,'c'=3),
  2=array('a'=1,'b'=2,'c'=3),
  3=array('a'=1,'b'=2,'c'=3),
  4=array('a'=1,'b'=2,'c'=3),
  )
);
$query_tables_checksum=array(query_Table='some_checksum');
the query_table_checksum is the part of query cache to invalidade a query
at client side, it must be checked at each query execution (this can be
done in less time or near time of a cached query)

before get from client side cache, query the server about table changes, if
the counter (or a checksum?)
if different, the query is invalid and must be removed from client side and
reexecuted, if not just get from query cache (in client side)
this add two news function at mysql protocol (one to get table
counters/checksums), and maybe must add a table counter that changes after
each update/delete/alter and save it (probably) at .FRM file, the other to
return the checksum at each query (with this we can see tables used in a
update for example and invalid the cache)
___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Maria-developers] Implementing implicit primary key in mysql server

2013-06-25 Thread Lixun Peng
Hi Jeremy,

Thank you for your suggestion.
I also want to just add the PK field for custom automatically, but some of
our customs can't accept it.
Because they are using SELECT * FROM table   or  INSERT INTO table
VALUES(...) , if I add a visible PK for them, SELECT * will show this
value, then their applications will report errors.
So I have to set this field as an implicit filed.

Thanks,
Lixun



On Sat, Jun 22, 2013 at 4:36 AM, Jeremy Cole jeremyc...@google.com wrote:

 Lixun,

 I've thought about this a bit and I'm not sure this will be very simple to
 do (or rather it's more complicated than it might seem). While I think it
 is not that hard to expose the __id field to replication internals, I think
 in order for this to really work it would need to be exposed to other
 tools, such as mysqldump. It is also unclear how to decide when it is safe
 to use this __id field (how to determine if it is in sync between master
 and slave).

 As an alternate suggestion, what about ignoring the current implicit PK
 behavior, and instead automatically adding a field using auto_increment
 when the user doesn't provide a PK:

 __id BIGINT UNSIGNED NOT NULL auto_increment,
 PRIMARY KEY(__id)

 Regards,

 Jeremy


 On Wed, Jun 19, 2013 at 2:40 AM, Lixun Peng pengli...@gmail.com wrote:

 Hi Sergei,

 You are right, let users add primary key is best.
 But I can't let users who don't want to create primary key can't use our
 MySQL service.
 Amazon RDS also allow users to create the tables without primary key,
 just change binlog_format to MIXED to solve replication problem.

 I think this feature is very useful for any MySQL cloud service
 providers, all of them will face this problem in one day.
 I will try to do some analysis/research in this feature implement first,
 I will need your help :-)

 I will notice any new updates in this email.


 Thanks,
 Lixun




 On Wed, Jun 19, 2013 at 5:14 PM, Sergei Golubchik s...@mariadb.orgwrote:

 Hi, Lixun!


 On Jun 18, Lixun Peng wrote:
  Hi,
 
  As we know, InnoDB has implicit primary key if a table hasn't defined
  a primary key.  However MySQL server doesn't know this primary key, so
  this primary key will not apear in binlog.
 
  When we are using ROW format binlog for replication, if a table has no
 any
  indexes, that's a disaster. If a table without indexes do a DML
  (UPDATE/DELETE), of course it will run a long time in master, but in
 slave,
  it still need a long time. It will cause serious slave replication
 delay.
 ...

  I think mysql server can do the same thing as InnoDB do, if user
 doesn't
  define the primary key, mysql can add the primary key automatically.
 
  How do you think?

 Well, that's doable. A much easier solution would be to require a user
 to create a primary key. It's a one-line change:

 -  Table_flags ha_table_flags() const { return cached_table_flags; }
 +  Table_flags ha_table_flags() const { return cached_table_flags |
 HA_REQUIRE_PRIMARY_KEY; }

 But what you suggest is possible too, I believe.

 Regards,
 Sergei




 --
 Senior Database Engineer @ Taobao.com

 Mobile Phone: +86 18658156856 (Hangzhou)
 Gtalk: penglixun(at)gmail.com
 Twitter: http://www.twitter.com/plinux
 Blog: http://www.penglixun.com

 ___
 Mailing list: https://launchpad.net/~maria-developers
 Post to : maria-developers@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~maria-developers
 More help   : https://help.launchpad.net/ListHelp





-- 
Senior Database Engineer @ Taobao.com

Mobile Phone: +86 18658156856 (Hangzhou)
Gtalk: penglixun(at)gmail.com
Twitter: http://www.twitter.com/plinux
Blog: http://www.penglixun.com
___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp