Merge lp:~brianaker/drizzle/error-cleanup into lp:drizzle/7.0

Proposed by Brian Aker
Status: Merged
Approved by: Brian Aker
Approved revision: no longer in the source branch.
Merged at revision: 2148
Proposed branch: lp:~brianaker/drizzle/error-cleanup
Merge into: lp:drizzle/7.0
Diff against target: 304 lines (+35/-63)
5 files modified
drizzled/sql_base.cc (+7/-9)
drizzled/table.cc (+8/-20)
drizzled/table.h (+4/-0)
drizzled/table/instance/base.cc (+12/-29)
drizzled/table/instance/base.h (+4/-5)
To merge this branch: bzr merge lp:~brianaker/drizzle/error-cleanup
Reviewer Review Type Date Requested Status
Drizzle Developers Pending
Review via email: mp+48712@code.launchpad.net
To post a comment you must log in.
lp:~brianaker/drizzle/error-cleanup updated
2148. By Lee Bieber

Merge Brian - table error updates
Merge Brian - parser updates
Merge Brian - more catalog work

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'drizzled/sql_base.cc'
--- drizzled/sql_base.cc 2011-02-04 08:47:29 +0000
+++ drizzled/sql_base.cc 2011-02-05 21:31:52 +0000
@@ -1001,7 +1001,7 @@
1001 */1001 */
10021002
1003 {1003 {
1004 table::Cache::singleton().mutex().lock(); /* Lock for FLUSH TABLES for open table */1004 boost::mutex::scoped_lock scopedLock(table::Cache::singleton().mutex());
10051005
1006 /*1006 /*
1007 Actually try to find the table in the open_cache.1007 Actually try to find the table in the open_cache.
@@ -1053,7 +1053,6 @@
1053 /* Avoid self-deadlocks by detecting self-dependencies. */1053 /* Avoid self-deadlocks by detecting self-dependencies. */
1054 if (table->open_placeholder && table->in_use == this)1054 if (table->open_placeholder && table->in_use == this)
1055 {1055 {
1056 table::Cache::singleton().mutex().unlock();
1057 my_error(ER_UPDATE_TABLE_USED, MYF(0), table->getShare()->getTableName());1056 my_error(ER_UPDATE_TABLE_USED, MYF(0), table->getShare()->getTableName());
1058 return NULL;1057 return NULL;
1059 }1058 }
@@ -1088,20 +1087,24 @@
1088 {1087 {
1089 /* wait_for_conditionwill unlock table::Cache::singleton().mutex() for us */1088 /* wait_for_conditionwill unlock table::Cache::singleton().mutex() for us */
1090 wait_for_condition(table::Cache::singleton().mutex(), COND_refresh);1089 wait_for_condition(table::Cache::singleton().mutex(), COND_refresh);
1090 scopedLock.release();
1091 }1091 }
1092 else1092 else
1093 {1093 {
1094 table::Cache::singleton().mutex().unlock();1094 scopedLock.unlock();
1095 }1095 }
1096
1096 /*1097 /*
1097 There is a refresh in progress for this table.1098 There is a refresh in progress for this table.
1098 Signal the caller that it has to try again.1099 Signal the caller that it has to try again.
1099 */1100 */
1100 if (refresh)1101 if (refresh)
1101 *refresh= true;1102 *refresh= true;
1103
1102 return NULL;1104 return NULL;
1103 }1105 }
1104 }1106 }
1107
1105 if (table)1108 if (table)
1106 {1109 {
1107 table::getUnused().unlink(static_cast<table::Concurrent *>(table));1110 table::getUnused().unlink(static_cast<table::Concurrent *>(table));
@@ -1125,7 +1128,6 @@
1125 */1128 */
1126 if (!(table= table_cache_insert_placeholder(lock_table_identifier)))1129 if (!(table= table_cache_insert_placeholder(lock_table_identifier)))
1127 {1130 {
1128 table::Cache::singleton().mutex().unlock();
1129 return NULL;1131 return NULL;
1130 }1132 }
1131 /*1133 /*
@@ -1136,7 +1138,6 @@
1136 table->open_placeholder= true;1138 table->open_placeholder= true;
1137 table->setNext(open_tables);1139 table->setNext(open_tables);
1138 open_tables= table;1140 open_tables= table;
1139 table::Cache::singleton().mutex().unlock();
11401141
1141 return table ;1142 return table ;
1142 }1143 }
@@ -1149,7 +1150,6 @@
1149 table= new_table;1150 table= new_table;
1150 if (new_table == NULL)1151 if (new_table == NULL)
1151 {1152 {
1152 table::Cache::singleton().mutex().unlock();
1153 return NULL;1153 return NULL;
1154 }1154 }
11551155
@@ -1157,15 +1157,13 @@
1157 if (error != 0)1157 if (error != 0)
1158 {1158 {
1159 delete new_table;1159 delete new_table;
1160 table::Cache::singleton().mutex().unlock();
1161 return NULL;1160 return NULL;
1162 }1161 }
1163 (void)table::Cache::singleton().insert(new_table);1162 (void)table::Cache::singleton().insert(new_table);
1164 }1163 }
1165 }1164 }
1165 }
11661166
1167 table::Cache::singleton().mutex().unlock();
1168 }
1169 if (refresh)1167 if (refresh)
1170 {1168 {
1171 table->setNext(open_tables); /* Link into simple list */1169 table->setNext(open_tables); /* Link into simple list */
11721170
=== modified file 'drizzled/table.cc'
--- drizzled/table.cc 2011-02-02 17:37:40 +0000
+++ drizzled/table.cc 2011-02-05 21:31:52 +0000
@@ -69,9 +69,6 @@
6969
70/* Functions defined in this cursor */70/* Functions defined in this cursor */
7171
72void open_table_error(TableShare *share, int error, int db_errno,
73 myf errortype, int errarg);
74
75/*************************************************************************/72/*************************************************************************/
7673
77// @note this should all be the destructor74// @note this should all be the destructor
@@ -82,6 +79,7 @@
82 if (db_stat)79 if (db_stat)
83 error= cursor->close();80 error= cursor->close();
84 _alias.clear();81 _alias.clear();
82
85 if (field)83 if (field)
86 {84 {
87 for (Field **ptr=field ; *ptr ; ptr++)85 for (Field **ptr=field ; *ptr ; ptr++)
@@ -112,6 +110,8 @@
112 uint32_t db_stat_arg)110 uint32_t db_stat_arg)
113{111{
114 setShare(share);112 setShare(share);
113 in_use= session;
114
115 field= NULL;115 field= NULL;
116116
117 cursor= NULL;117 cursor= NULL;
@@ -124,7 +124,6 @@
124 tablenr= 0;124 tablenr= 0;
125 db_stat= db_stat_arg;125 db_stat= db_stat_arg;
126126
127 in_use= session;
128 record[0]= (unsigned char *) NULL;127 record[0]= (unsigned char *) NULL;
129 record[1]= (unsigned char *) NULL;128 record[1]= (unsigned char *) NULL;
130129
@@ -1646,25 +1645,14 @@
1646 query_id(0),1645 query_id(0),
1647 quick_condition_rows(0),1646 quick_condition_rows(0),
1648 timestamp_field_type(TIMESTAMP_NO_AUTO_SET),1647 timestamp_field_type(TIMESTAMP_NO_AUTO_SET),
1649 map(0)1648 map(0),
1649 quick_rows(),
1650 const_key_parts(),
1651 quick_key_parts(),
1652 quick_n_ranges()
1650{1653{
1651 record[0]= (unsigned char *) 0;1654 record[0]= (unsigned char *) 0;
1652 record[1]= (unsigned char *) 0;1655 record[1]= (unsigned char *) 0;
1653
1654 reginfo.reset();
1655 covering_keys.reset();
1656 quick_keys.reset();
1657 merge_keys.reset();
1658
1659 keys_in_use_for_query.reset();
1660 keys_in_use_for_group_by.reset();
1661 keys_in_use_for_order_by.reset();
1662
1663 memset(quick_rows, 0, sizeof(ha_rows) * MAX_KEY);
1664 memset(const_key_parts, 0, sizeof(ha_rows) * MAX_KEY);
1665
1666 memset(quick_key_parts, 0, sizeof(unsigned int) * MAX_KEY);
1667 memset(quick_n_ranges, 0, sizeof(unsigned int) * MAX_KEY);
1668}1656}
16691657
1670/*****************************************************************************1658/*****************************************************************************
16711659
=== modified file 'drizzled/table.h'
--- drizzled/table.h 2011-02-02 17:37:40 +0000
+++ drizzled/table.h 2011-02-05 21:31:52 +0000
@@ -91,8 +91,10 @@
91 }91 }
9292
93 Cursor *cursor; /**< Pointer to the storage engine's Cursor managing this table */93 Cursor *cursor; /**< Pointer to the storage engine's Cursor managing this table */
94
94private:95private:
95 Table *next;96 Table *next;
97
96public:98public:
97 Table *getNext() const99 Table *getNext() const
98 {100 {
@@ -314,8 +316,10 @@
314 The set is implemented as a bitmap.316 The set is implemented as a bitmap.
315 */317 */
316 key_map keys_in_use_for_query;318 key_map keys_in_use_for_query;
319
317 /* Map of keys that can be used to calculate GROUP BY without sorting */320 /* Map of keys that can be used to calculate GROUP BY without sorting */
318 key_map keys_in_use_for_group_by;321 key_map keys_in_use_for_group_by;
322
319 /* Map of keys that can be used to calculate ORDER BY without sorting */323 /* Map of keys that can be used to calculate ORDER BY without sorting */
320 key_map keys_in_use_for_order_by;324 key_map keys_in_use_for_order_by;
321325
322326
=== modified file 'drizzled/table/instance/base.cc'
--- drizzled/table/instance/base.cc 2011-02-04 09:30:58 +0000
+++ drizzled/table/instance/base.cc 2011-02-05 21:31:52 +0000
@@ -576,9 +576,9 @@
576 getTableMessage()->set_schema(identifier_arg.getSchemaName());576 getTableMessage()->set_schema(identifier_arg.getSchemaName());
577}577}
578578
579int TableShare::inner_parse_table_proto(Session& session, message::Table &table)579bool TableShare::parse_table_proto(Session& session, message::Table &table)
580{580{
581 int local_error= 0;581 drizzled::error_t local_error= EE_OK;
582582
583 if (! table.IsInitialized())583 if (! table.IsInitialized())
584 {584 {
@@ -1057,9 +1057,9 @@
1057 {1057 {
1058 if (fo.scale() > DECIMAL_MAX_SCALE)1058 if (fo.scale() > DECIMAL_MAX_SCALE)
1059 {1059 {
1060 local_error= 4;1060 local_error= ER_NOT_FORM_FILE;
10611061
1062 return local_error;1062 return true;
1063 }1063 }
1064 decimals= static_cast<uint8_t>(fo.scale());1064 decimals= static_cast<uint8_t>(fo.scale());
1065 }1065 }
@@ -1113,9 +1113,8 @@
1113 decimals != NOT_FIXED_DEC)1113 decimals != NOT_FIXED_DEC)
1114 {1114 {
1115 my_error(ER_M_BIGGER_THAN_D, MYF(0), pfield.name().c_str());1115 my_error(ER_M_BIGGER_THAN_D, MYF(0), pfield.name().c_str());
1116 local_error= 1;1116 local_error= ER_M_BIGGER_THAN_D;
11171117 return true;
1118 return local_error;
1119 }1118 }
1120 break;1119 break;
1121 }1120 }
@@ -1254,9 +1253,9 @@
1254 if (res != 0 && res != 3) /* @TODO Huh? */1253 if (res != 0 && res != 3) /* @TODO Huh? */
1255 {1254 {
1256 my_error(ER_INVALID_DEFAULT, MYF(0), f->field_name);1255 my_error(ER_INVALID_DEFAULT, MYF(0), f->field_name);
1257 local_error= 1;1256 local_error= ER_INVALID_DEFAULT;
12581257
1259 return local_error;1258 return true;
1260 }1259 }
1261 }1260 }
1262 else if (f->real_type() == DRIZZLE_TYPE_ENUM && (f->flags & NOT_NULL_FLAG))1261 else if (f->real_type() == DRIZZLE_TYPE_ENUM && (f->flags & NOT_NULL_FLAG))
@@ -1468,9 +1467,9 @@
1468 &next_number_keypart)) < 0)1467 &next_number_keypart)) < 0)
1469 {1468 {
1470 /* Wrong field definition */1469 /* Wrong field definition */
1471 local_error= 4;1470 local_error= ER_NOT_FORM_FILE;
14721471
1473 return local_error;1472 return true;
1474 }1473 }
1475 else1474 else
1476 {1475 {
@@ -1495,24 +1494,8 @@
1495 all_set.resize(_field_size);1494 all_set.resize(_field_size);
1496 all_set.set();1495 all_set.set();
14971496
1498 return local_error;1497 return local_error != EE_OK;
1499}1498}
1500
1501int TableShare::parse_table_proto(Session& session, message::Table &table)
1502{
1503 int local_error= inner_parse_table_proto(session, table);
1504
1505 if (not local_error)
1506 return 0;
1507
1508 error= local_error;
1509 open_errno= errno;
1510 errarg= 0;
1511 open_table_error(local_error, open_errno, 0);
1512
1513 return local_error;
1514}
1515
15161499
1517/*1500/*
1518 Read table definition from a binary / text based .frm cursor1501 Read table definition from a binary / text based .frm cursor
15191502
=== modified file 'drizzled/table/instance/base.h'
--- drizzled/table/instance/base.h 2011-02-03 23:29:20 +0000
+++ drizzled/table/instance/base.h 2011-02-05 21:31:52 +0000
@@ -652,10 +652,12 @@
652private:652private:
653 void init(const char *new_table_name,653 void init(const char *new_table_name,
654 const char *new_path);654 const char *new_path);
655public:
656655
656protected:
657 void open_table_error(int pass_error, int db_errno, int pass_errarg);657 void open_table_error(int pass_error, int db_errno, int pass_errarg);
658658
659public:
660
659 static TableShare::shared_ptr getShareCreate(Session *session, 661 static TableShare::shared_ptr getShareCreate(Session *session,
660 const identifier::Table &identifier,662 const identifier::Table &identifier,
661 int &error);663 int &error);
@@ -723,10 +725,7 @@
723 Table &outparam,725 Table &outparam,
724 bool &error_reported);726 bool &error_reported);
725public:727public:
726 int parse_table_proto(Session& session, message::Table &table);728 bool parse_table_proto(Session& session, message::Table &table);
727
728private:
729 int inner_parse_table_proto(Session& session, message::Table &table);
730};729};
731730
732} /* namespace drizzled */731} /* namespace drizzled */

Subscribers

People subscribed via source and target branches