List:Commits« Previous MessageNext Message »
From:vasil.dimov Date:October 5 2010 10:09am
Subject:bzr push into mysql-next-mr-persistent-stats branch (vasil.dimov:3291 to
3300)
View as plain text  
 3300 Vasil Dimov	2010-10-05
      Explain why we use 'read-uncommitted', there is a reason for it.

    modified:
      storage/innobase/dict/dict0stats.c
 3299 Vasil Dimov	2010-10-05
      Separate the typedef from the struct definition.
      
      Suggested by:	Jimmy (rb://373)

    modified:
      storage/innobase/include/dict0dict.h
 3298 Vasil Dimov	2010-10-05
      Remove unnecessary space.
      
      Spotted by:	Jimmy (rb://373)

    modified:
      storage/innobase/include/data0type.ic
 3297 Vasil Dimov	2010-10-05
      Add @return to the comment of dtype_sql_name()
      
      Spotted by:	Jimmy (rb://373)

    modified:
      storage/innobase/include/data0type.h
      storage/innobase/include/data0type.ic
 3296 Vasil Dimov	2010-10-05
      Remove outdated comment.
      
      Spotted by:	Jimmy (rb://373)

    modified:
      storage/innobase/dict/dict0stats.c
 3295 Vasil Dimov	2010-10-05
      Fix typo in comment.
      
      Spotted by:	Jimmy (rb://373)

    modified:
      storage/innobase/dict/dict0stats.c
 3294 Vasil Dimov	2010-10-05
      Explain better in the comment about boring records.
      
      Suggested by:	Jimmy (rb://373)

    modified:
      storage/innobase/dict/dict0stats.c
 3293 Vasil Dimov	2010-10-05
      Do not set the error message if DB_TABLE_NOT_FOUND
      
      Since we are not using the message in the case of DB_TABLE_NOT_FOUND
      we change the function not to print to the string then. This is an
      optimizatoin since it is called for each dict_table_get().
      
      Suggested by:	Jimmy (rb://373)

    modified:
      storage/innobase/dict/dict0dict.c
      storage/innobase/dict/dict0stats.c
      storage/innobase/include/dict0dict.h
 3292 Vasil Dimov	2010-10-05
      Fix a comment, now we return db_err instead of ibool.

    modified:
      storage/innobase/dict/dict0dict.c
      storage/innobase/include/dict0dict.h
 3291 Vasil Dimov	2010-09-27
      Do not change the copyright year as part of the PS patch.

    modified:
      storage/innobase/data/data0type.c
      storage/innobase/include/db0err.h
      storage/innobase/include/dict0dict.h
=== modified file 'storage/innobase/dict/dict0dict.c'
--- a/storage/innobase/dict/dict0dict.c	revid:vasil.dimov@stripped
+++ b/storage/innobase/dict/dict0dict.c	revid:vasil.dimov@stripped
@@ -4819,7 +4819,9 @@ dict_table_schema_check(
 	dict_table_schema_t*	req_schema,	/*!< in/out: required table
 						schema */
 	char*			errstr,		/*!< out: human readable error
-						text if FALSE is returned */
+						message if != DB_SUCCESS and
+						!= DB_TABLE_NOT_FOUND is
+						returned */
 	size_t			errstr_sz)	/*!< in: errstr size */
 {
 	dict_table_t*	table;
@@ -4832,10 +4834,6 @@ dict_table_schema_check(
 	if (table == NULL || table->ibd_file_missing) {
 		/* no such table or missing tablespace */
 
-		ut_snprintf(errstr, errstr_sz,
-			    "%s does not exist or its tablespace is missing.",
-			    req_schema->table_name);
-
 		return(DB_TABLE_NOT_FOUND);
 	}
 

=== modified file 'storage/innobase/dict/dict0stats.c'
--- a/storage/innobase/dict/dict0stats.c	revid:vasil.dimov@stripped
+++ b/storage/innobase/dict/dict0stats.c	revid:vasil.dimov@stripped
@@ -52,19 +52,20 @@ Created Jan 06, 2010 Vasil Dimov
 
 /* Sampling algorithm description @{
 
-The algorithm is controlled by one number - A, which is the number of leaf
-pages to analyze for a given index for each n-prefix (if the index is on 3
-columns, then 3*A pages will be analyzed).
+The algorithm is controlled by one number - srv_stats_persistent_sample_pages,
+let it be A, which is the number of leaf pages to analyze for a given index
+for each n-prefix (if the index is on 3 columns, then 3*A pages will be
+analyzed).
 
 Let the total number of leaf pages in the table be T.
 Level 0 - leaf pages, level H - root.
 
-Definition: Boring record is a record on a non-leaf page that equals the
-next (to the right, cross page boundaries, skipping the supremum and infimum)
-record on the same level. The last (user) record on a level is not boring (it
-does not match the non-existent user record to the right). We call the
-records boring because all the records on the page below a boring record
-are equal to that boring record.
+Definition: N-prefix-boring record is a record on a non-leaf page that equals
+the next (to the right, cross page boundaries, skipping the supremum and
+infimum) record on the same level when looking at the fist n-prefix columns.
+The last (user) record on a level is not boring (it does not match the
+non-existent user record to the right). We call the records boring because all
+the records on the page below a boring record are equal to that boring record.
 
 We avoid diving below boring records when searching for a leaf page to
 estimate the number of distinct records because we know that such a leaf
@@ -106,8 +107,6 @@ V * (P1 + P2 + ... PA) / A.
 The above describes how to calculate the cardinality of an index.
 This algorithm is executed for each n-prefix of a multi-column index
 where n=1..n_uniq.
-
-In the implementation below A is srv_stats_persistent_sample_pages.
 @} */
 
 /* names of the tables from the persistent statistics storage */
@@ -131,7 +130,7 @@ srv_stats_persistent_sample_pages record
 Calculates new estimates for table and index statistics. This function
 is relatively quick and is used to calculate transient statistics that
 are not saved on disk.
-This was the only wat to calculate statistics before the
+This was the only way to calculate statistics before the
 Persistent Statistics feature was introduced.
 dict_stats_update_transient() @{ */
 static
@@ -744,7 +743,7 @@ dict_stats_scan_page(
 /*********************************************************************//**
 Dive below the current position of a cursor and calculate the number of
 distinct records on the leaf page, when looking at the fist n_prefix
-columns. The result is returned in n_diff.
+columns.
 dict_stats_analyze_index_below_pcur() @{
 @return number of distinct records on the leaf page */
 static
@@ -2015,6 +2014,9 @@ dict_stats_fetch_from_ps(
 	mutex_exit(&kernel_mutex);
 
 	trx->op_info = "";
+	/* Use 'read-uncommitted' so that the SELECTs we execute
+	do not get blocked in case some user has locked the rows we
+	are SELECTing */
 	trx->isolation_level = TRX_ISO_READ_UNCOMMITTED;
 	trx_start(trx, ULINT_UNDEFINED);
 
@@ -2640,6 +2642,8 @@ test_dict_table_schema_check()
 	};
 	char	errstr[512];
 
+	ut_snprintf(errstr, sizeof(errstr), "Table not found");
+
 	/* prevent any data dictionary modifications while we are checking
 	the tables' structure */
 

=== modified file 'storage/innobase/include/data0type.h'
--- a/storage/innobase/include/data0type.h	revid:vasil.dimov@stripped
+++ b/storage/innobase/include/data0type.h	revid:vasil.dimov@stripped
@@ -449,7 +449,8 @@ dtype_new_read_for_order_and_null_size(
 	const byte*	buf);	/*!< in: buffer for stored type order info */
 
 /*********************************************************************//**
-Returns the type's SQL name (e.g. BIGINT UNSIGNED) from mtype,prtype,len */
+Returns the type's SQL name (e.g. BIGINT UNSIGNED) from mtype,prtype,len
+@return the SQL type name */
 UNIV_INTERN
 char*
 dtype_sql_name(

=== modified file 'storage/innobase/include/data0type.ic'
--- a/storage/innobase/include/data0type.ic	revid:vasil.dimov@stripped
+++ b/storage/innobase/include/data0type.ic	revid:vasil.dimov@stripped
@@ -416,14 +416,15 @@ dtype_new_read_for_order_and_null_size(
 }
 
 /*********************************************************************//**
-Returns the type's SQL name (e.g. BIGINT UNSIGNED) from mtype,prtype,len */
+Returns the type's SQL name (e.g. BIGINT UNSIGNED) from mtype,prtype,len
+@return the SQL type name */
 UNIV_INTERN
 char*
 dtype_sql_name(
 /*===========*/
 	unsigned	mtype,	/*!< in: mtype */
 	unsigned	prtype,	/*!< in: prtype */
-	unsigned	len, 	/*!< in: len */
+	unsigned	len,	/*!< in: len */
 	char*		name,	/*!< out: SQL name */
 	unsigned	name_sz)/*!< in: size of the name buffer */
 {

=== modified file 'storage/innobase/include/dict0dict.h'
--- a/storage/innobase/include/dict0dict.h	revid:vasil.dimov@stripped
+++ b/storage/innobase/include/dict0dict.h	revid:vasil.dimov@stripped
@@ -1183,7 +1183,7 @@ dict_ind_init(void);
 
 /* This struct is used to specify the name and type that a column must
 have when checking a table's schema. */
-typedef struct dict_col_meta_struct {
+struct dict_col_meta_struct {
 	const char*	name;		/* column name */
 	ulint		mtype;		/* required column main type */
 	ulint		prtype_mask;	/* required column precise type mask;
@@ -1191,12 +1191,13 @@ typedef struct dict_col_meta_struct {
 					bits it has set must also be set
 					in the column's prtype */
 	ulint		len;		/* required column length */
-} dict_col_meta_t;
+};
+typedef struct dict_col_meta_struct dict_col_meta_t;
 
 /* This struct is used for checking whether a given table exists and
 whether it has a predefined schema (number of columns and columns names
 and types) */
-typedef struct dict_table_schema_struct {
+struct dict_table_schema_struct {
 	const char*		table_name;	/* the name of the table whose
 						structure we are checking */
 	ulint			n_cols;		/* the number of columns the
@@ -1204,7 +1205,8 @@ typedef struct dict_table_schema_struct 
 	dict_col_meta_t*	columns;	/* metadata for the columns;
 						this array has n_cols
 						elements */
-} dict_table_schema_t;
+};
+typedef struct dict_table_schema_struct dict_table_schema_t;
 /* @} */
 
 /*********************************************************************//**
@@ -1221,7 +1223,9 @@ dict_table_schema_check(
 	dict_table_schema_t*	req_schema,	/*!< in/out: required table
 						schema */
 	char*			errstr,		/*!< out: human readable error
-						text if FALSE is returned */
+						message if != DB_SUCCESS and
+						!= DB_TABLE_NOT_FOUND is
+						returned */
 	size_t			errstr_sz);	/*!< in: errstr size */
 /* @} */
 


Attachment: [text/bzr-bundle] bzr/vasil.dimov@oracle.com-20101005100639-m1fiqtfaw8ll6exk.bundle
Thread
bzr push into mysql-next-mr-persistent-stats branch (vasil.dimov:3291 to3300) vasil.dimov5 Oct