Merge lp:~sinha/drizzle/trunk-bug-621856 into lp:drizzle/7.0
- trunk-bug-621856
- Merge into 7.0
Status: | Superseded |
---|---|
Proposed branch: | lp:~sinha/drizzle/trunk-bug-621856 |
Merge into: | lp:drizzle/7.0 |
Diff against target: |
213 lines (+49/-50) 2 files modified
drizzled/cursor.h (+46/-47) drizzled/sql_parse.cc (+3/-3) |
To merge this branch: | bzr merge lp:~sinha/drizzle/trunk-bug-621856 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stewart Smith (community) | Disapprove | ||
Vijay Samuel | Needs Fixing | ||
David Shrewsbury | Pending | ||
Review via email: mp+52931@code.launchpad.net |
This proposal has been superseded by a proposal from 2011-03-15.
Commit message
Description of the change
Using regex ,found bunch of functions with unused params in sql_parse.cc file and cursor.h file .
If the changes are fine,then i will start doing the same for rest of the files in drizzled directory.
Stewart Smith (stewart) wrote : | # |
On Thu, 10 Mar 2011 21:57:07 -0000, Akash Sinha <email address hidden> wrote:
> --- drizzled/cursor.h 2011-03-07 12:31:41 +0000
> +++ drizzled/cursor.h 2011-03-10 21:44:21 +0000
> @@ -319,12 +319,12 @@
> virtual ha_rows estimate_
> { return stats.records+
>
> - virtual const char *index_
> + virtual const char *index_type()
> { assert(0); return "";}
It looks like index_type() is completely unused (apart from being implemented
in every storage engine) - so instead of just removing the parameter
(which shouldn't always be unused anyway) we should remove all the
implementations of it too.
> @@ -349,15 +349,15 @@
> const unsigned char * key,
> key_part_map keypart_map,
> enum ha_rkey_function find_flag);
> - virtual int index_next(unsigned char *) __attribute__ ((warn_
> - { return HA_ERR_
> - virtual int index_prev(unsigned char *)
> - { return HA_ERR_
> - virtual int index_first(
> - { return HA_ERR_
> - virtual int index_last(unsigned char *)
> - { return HA_ERR_
> - virtual int index_next_
> + virtual int index_next() __attribute__ ((warn_
> + { return HA_ERR_
> + virtual int index_prev()
> + { return HA_ERR_
> + virtual int index_first()
> + { return HA_ERR_
> + virtual int index_last()
> + { return HA_ERR_
> + virtual int index_next_same();
This is incorrect, the buffer being passed in is important and at least
*should* be used by classes implementing them.
> private:
> uint32_t calculate_
> @@ -379,20 +379,20 @@
> bool eq_range, bool sorted);
> virtual int read_range_next();
> int compare_
> - virtual int rnd_next(unsigned char *)=0;
> - virtual int rnd_pos(unsigned char *, unsigned char *)=0;
> + virtual int rnd_next()=0;
> + virtual int rnd_pos()=0;
the rnd_pos() method is used and does use the parameters (just not in
the default implementation that does nothing), same with rnd_next() -
that is used.
> virtual int read_first_
> - virtual int rnd_same(unsigned char *, uint32_t)
> + virtual int rnd_same()
> { return HA_ERR_
> - virtual ha_rows records_
> + virtual ha_rows records_in_range()
> { return (ha_rows) 10; }
also wrong, these parameters are used by all classes that implement it.
So most of this patch isn't quite right (especially around
Cursor). However, there are some unused bit sthat can work. I'd
recommend starting from scratch on a tree and doing these bits
I'd also be sure to when checking out any virtual function to check
everywhere that calls it as well as everywhere that implements it.
--
Stewart Smith
Stewart Smith (stewart) : | # |
Akash Sinha (sinha) wrote : | # |
How would i find out exactly from which functions i have to remove
unused params.And moreover i could i say which function is completely
unused.
And also after removing the unused params i ran the "python
tests/dbqp.py" and it didnt return anything wrong.So in case of
virtual functions should i have to go through the entire list of class
functions to check whether that param is being used or not.
Please suggest some better method of doing this.
Akash Sinha
On Fri, Mar 11, 2011 at 10:12 AM, Stewart Smith
<email address hidden> wrote:
> On Thu, 10 Mar 2011 21:57:07 -0000, Akash Sinha <email address hidden> wrote:
>> --- drizzled/cursor.h 2011-03-07 12:31:41 +0000
>> +++ drizzled/cursor.h 2011-03-10 21:44:21 +0000
>> @@ -319,12 +319,12 @@
>> virtual ha_rows estimate_
>> { return stats.records+
>>
>> - virtual const char *index_
>> + virtual const char *index_type()
>> { assert(0); return "";}
>
> It looks like index_type() is completely unused (apart from being implemented
> in every storage engine) - so instead of just removing the parameter
> (which shouldn't always be unused anyway) we should remove all the
> implementations of it too.
>
>> @@ -349,15 +349,15 @@
>> const unsigned char * key,
>> key_part_map keypart_map,
>> enum ha_rkey_function find_flag);
>> - virtual int index_next(unsigned char *) __attribute__ ((warn_
>> - { return HA_ERR_
>> - virtual int index_prev(unsigned char *)
>> - { return HA_ERR_
>> - virtual int index_first(
>> - { return HA_ERR_
>> - virtual int index_last(unsigned char *)
>> - { return HA_ERR_
>> - virtual int index_next_
>> + virtual int index_next() __attribute__ ((warn_
>> + { return HA_ERR_
>> + virtual int index_prev()
>> + { return HA_ERR_
>> + virtual int index_first()
>> + { return HA_ERR_
>> + virtual int index_last()
>> + { return HA_ERR_
>> + virtual int index_next_same();
>
> This is incorrect, the buffer being passed in is important and at least
> *should* be used by classes implementing them.
>
>> private:
>> uint32_t calculate_
>> @@ -379,20 +379,20 @@
>> bool eq_range, bool sorted);
>> virtual int read_range_next();
>> int compare_
>> - virtual int rnd_next(unsigned char *)=0;
>> - virtual int rnd_pos(unsigned char *, unsigned char *)=0;
>> + virtual int rnd_next()=0;
>> + virtual int rnd_pos()=0;
>
> the rnd_pos() method is used and does use the parameters (just not in
> the default implementation that does nothing), same with rnd_next() -
> that is used.
>
>> virtual int read_first_
>> - virtual int rnd_same(unsigned char *, uint32_t)
>> + virtual int rnd_same()
>> { return HA_ERR_WRONG...
Akash Sinha (sinha) wrote : | # |
I haven't touched any part of code rather than removing unused params
from the function definiton and testing it.This coding standard
violation the one with assignment thing might be present there in my
code trunk.
--Akash
On Fri, Mar 11, 2011 at 10:01 AM, Vijay Samuel <email address hidden> wrote:
> Review: Needs Fixing
> Hi Akash,
> Good to see you submitting your first branch. Great job. There are coding standard violations in your branch. Please make it a point to adhere to all the coding guidelines inn the wiki page that I gave you.
>
> I ll just point out some of the obvious one that I could see,
> 1) assignment operations should be as follows,
> a= b; one space after the = and nonee before.
>
> 2) use two space indentations for new blocks of code.
>
> 3) braces must be written in new lines.
>
> Please make it a point to fix all the above mentioned and re submit your merge proposal.
>
> Cheers,
> -Vijay
> --
> https:/
> You are the owner of lp:~sinha/drizzle/trunk-bug-621856.
>
Brian Aker (brianaker) wrote : | # |
Thanks!
I'll just verify that the "=0" issue was in the original code. In general if you can fix stuff like this when you pass through the code that is great (and I can see if you are new to the code this might be an issue).
Stewart is right about some of these calls, you should see what warnings the compiler issues when you try to recompile.
Akash Sinha (sinha) wrote : | # |
While working on this sometimes i get confused what to do.
Suppose there is function " int join_no_
*info); " in sql_select.h file
Now same function is implemented as " int
join_no_
is no params defined in this function in .cc file.
So what should be my action here ? Rremove that ReadRecord * from
sql_select.cc file as well as from sql_select.h file and check if that
function is implemented some other .cc file and rectify that also.
OR should i only check such kind of functions in .cc files as i found
one in sql_parese.cc file i.e function
TableList *Select_
in sql_parse.h file.
Please reply in what manner i should proceed to fix this bug.
Thank you
Akash Sinha
On Fri, Mar 11, 2011 at 10:13 AM, Stewart Smith
<email address hidden> wrote:
> Review: Disapprove
>
> --
> https:/
> You are the owner of lp:~sinha/drizzle/trunk-bug-621856.
>
Unmerged revisions
- 2228. By Akash Sinha<email address hidden>
-
Removed functions with unused params
Preview Diff
1 | === modified file 'drizzled/cursor.h' |
2 | --- drizzled/cursor.h 2011-03-07 12:31:41 +0000 |
3 | +++ drizzled/cursor.h 2011-03-10 21:44:21 +0000 |
4 | @@ -319,12 +319,12 @@ |
5 | virtual ha_rows estimate_rows_upper_bound() |
6 | { return stats.records+EXTRA_RECORDS; } |
7 | |
8 | - virtual const char *index_type(uint32_t) |
9 | + virtual const char *index_type() |
10 | { assert(0); return "";} |
11 | |
12 | |
13 | - uint32_t get_index(void) const { return active_index; } |
14 | - virtual int close(void)=0; |
15 | + uint32_t get_index() const { return active_index; } |
16 | + virtual int close()=0; |
17 | |
18 | /** |
19 | @brief |
20 | @@ -349,15 +349,15 @@ |
21 | const unsigned char * key, |
22 | key_part_map keypart_map, |
23 | enum ha_rkey_function find_flag); |
24 | - virtual int index_next(unsigned char *) __attribute__ ((warn_unused_result)) |
25 | - { return HA_ERR_WRONG_COMMAND; } |
26 | - virtual int index_prev(unsigned char *) |
27 | - { return HA_ERR_WRONG_COMMAND; } |
28 | - virtual int index_first(unsigned char *) |
29 | - { return HA_ERR_WRONG_COMMAND; } |
30 | - virtual int index_last(unsigned char *) |
31 | - { return HA_ERR_WRONG_COMMAND; } |
32 | - virtual int index_next_same(unsigned char *, const unsigned char *, uint32_t); |
33 | + virtual int index_next() __attribute__ ((warn_unused_result)) |
34 | + { return HA_ERR_WRONG_COMMAND; } |
35 | + virtual int index_prev() |
36 | + { return HA_ERR_WRONG_COMMAND; } |
37 | + virtual int index_first() |
38 | + { return HA_ERR_WRONG_COMMAND; } |
39 | + virtual int index_last() |
40 | + { return HA_ERR_WRONG_COMMAND; } |
41 | + virtual int index_next_same(); |
42 | |
43 | private: |
44 | uint32_t calculate_key_len(uint32_t key_position, key_part_map keypart_map_arg); |
45 | @@ -379,20 +379,20 @@ |
46 | bool eq_range, bool sorted); |
47 | virtual int read_range_next(); |
48 | int compare_key(key_range *range); |
49 | - virtual int rnd_next(unsigned char *)=0; |
50 | - virtual int rnd_pos(unsigned char *, unsigned char *)=0; |
51 | + virtual int rnd_next()=0; |
52 | + virtual int rnd_pos()=0; |
53 | virtual int read_first_row(unsigned char *buf, uint32_t primary_key); |
54 | - virtual int rnd_same(unsigned char *, uint32_t) |
55 | + virtual int rnd_same() |
56 | { return HA_ERR_WRONG_COMMAND; } |
57 | - virtual ha_rows records_in_range(uint32_t, key_range *, key_range *) |
58 | + virtual ha_rows records_in_range() |
59 | { return (ha_rows) 10; } |
60 | virtual void position(const unsigned char *record)=0; |
61 | - virtual int info(uint32_t)=0; // see my_base.h for full description |
62 | - virtual uint32_t calculate_key_hash_value(Field **) |
63 | + virtual int info()=0; // see my_base.h for full description |
64 | + virtual uint32_t calculate_key_hash_value() |
65 | { assert(0); return 0; } |
66 | virtual int extra(enum ha_extra_function) |
67 | { return 0; } |
68 | - virtual int extra_opt(enum ha_extra_function operation, uint32_t) |
69 | + virtual int extra_opt(enum ha_extra_function operation) |
70 | { return extra(operation); } |
71 | |
72 | /** |
73 | @@ -444,7 +444,7 @@ |
74 | /* end of the list of admin commands */ |
75 | |
76 | virtual int indexes_are_disabled(void) {return 0;} |
77 | - virtual void append_create_info(String *) |
78 | + virtual void append_create_info() |
79 | {} |
80 | /** |
81 | If index == MAX_KEY then a check for table is made and if index < |
82 | @@ -466,7 +466,7 @@ |
83 | virtual int get_foreign_key_list(Session *, List<ForeignKeyInfo> *) |
84 | { return 0; } |
85 | virtual uint32_t referenced_by_foreign_key() { return 0;} |
86 | - virtual void free_foreign_key_create_info(char *) {} |
87 | + virtual void free_foreign_key_create_info() {} |
88 | |
89 | /** |
90 | Is not invoked for non-transactional temporary tables. |
91 | @@ -522,9 +522,9 @@ |
92 | the corresponding 'ha_*' method above. |
93 | */ |
94 | |
95 | - virtual int open(const char *, int , uint32_t ) { assert(0); return -1; } |
96 | + virtual int open() { assert(0); return -1; } |
97 | virtual int doOpen(const identifier::Table &identifier, int mode, uint32_t test_if_locked); |
98 | - virtual int doStartIndexScan(uint32_t idx, bool) |
99 | + virtual int doStartIndexScan(uint32_t idx) |
100 | { active_index= idx; return 0; } |
101 | virtual int doEndIndexScan() { active_index= MAX_KEY; return 0; } |
102 | /** |
103 | @@ -536,17 +536,17 @@ |
104 | */ |
105 | virtual int doStartTableScan(bool scan) __attribute__ ((warn_unused_result)) = 0; |
106 | virtual int doEndTableScan() { return 0; } |
107 | - virtual int doInsertRecord(unsigned char *) |
108 | - { |
109 | - return HA_ERR_WRONG_COMMAND; |
110 | - } |
111 | - |
112 | - virtual int doUpdateRecord(const unsigned char *, unsigned char *) |
113 | - { |
114 | - return HA_ERR_WRONG_COMMAND; |
115 | - } |
116 | - |
117 | - virtual int doDeleteRecord(const unsigned char *) |
118 | + virtual int doInsertRecord() |
119 | + { |
120 | + return HA_ERR_WRONG_COMMAND; |
121 | + } |
122 | + |
123 | + virtual int doUpdateRecord() |
124 | + { |
125 | + return HA_ERR_WRONG_COMMAND; |
126 | + } |
127 | + |
128 | + virtual int doDeleteRecord() |
129 | { |
130 | return HA_ERR_WRONG_COMMAND; |
131 | } |
132 | @@ -579,7 +579,7 @@ |
133 | @return non-0 in case of failure, 0 in case of success. |
134 | When lock_type is F_UNLCK, the return value is ignored. |
135 | */ |
136 | - virtual int external_lock(Session *, int) |
137 | + virtual int external_lock() |
138 | { |
139 | return 0; |
140 | } |
141 | @@ -591,10 +591,9 @@ |
142 | virtual void start_bulk_insert(ha_rows) |
143 | {} |
144 | virtual int end_bulk_insert(void) { return 0; } |
145 | - virtual int index_read(unsigned char *, const unsigned char *, |
146 | - uint32_t, enum ha_rkey_function) |
147 | + virtual int index_read( enum ha_rkey_function) |
148 | { return HA_ERR_WRONG_COMMAND; } |
149 | - virtual int index_read_last(unsigned char *, const unsigned char *, uint32_t) |
150 | + virtual int index_read_last() |
151 | { return (errno= HA_ERR_WRONG_COMMAND); } |
152 | /** |
153 | This is called to delete all rows in a table |
154 | @@ -610,19 +609,19 @@ |
155 | is emulated by doing a 'DELETE FROM t'. HA_ERR_WRONG_COMMAND is |
156 | returned by storage engines that don't support this operation. |
157 | */ |
158 | - virtual int reset_auto_increment(uint64_t) |
159 | + virtual int reset_auto_increment() |
160 | { return HA_ERR_WRONG_COMMAND; } |
161 | |
162 | - virtual int analyze(Session *) |
163 | + virtual int analyze() |
164 | { return HA_ADMIN_NOT_IMPLEMENTED; } |
165 | |
166 | - virtual int disable_indexes(uint32_t) |
167 | - { return HA_ERR_WRONG_COMMAND; } |
168 | - |
169 | - virtual int enable_indexes(uint32_t) |
170 | - { return HA_ERR_WRONG_COMMAND; } |
171 | - |
172 | - virtual int discard_or_import_tablespace(bool) |
173 | + virtual int disable_indexes() |
174 | + { return HA_ERR_WRONG_COMMAND; } |
175 | + |
176 | + virtual int enable_indexes() |
177 | + { return HA_ERR_WRONG_COMMAND; } |
178 | + |
179 | + virtual int discard_or_import_tablespace() |
180 | { return (errno=HA_ERR_WRONG_COMMAND); } |
181 | |
182 | /* |
183 | |
184 | === modified file 'drizzled/sql_parse.cc' |
185 | --- drizzled/sql_parse.cc 2011-03-07 12:31:41 +0000 |
186 | +++ drizzled/sql_parse.cc 2011-03-10 21:44:21 +0000 |
187 | @@ -1127,7 +1127,7 @@ |
188 | - 0, otherwise |
189 | */ |
190 | |
191 | -TableList *Select_Lex::end_nested_join(Session *) |
192 | +TableList *Select_Lex::end_nested_join() |
193 | { |
194 | TableList *ptr; |
195 | NestedJoin *nested_join; |
196 | @@ -1536,7 +1536,7 @@ |
197 | true Error |
198 | */ |
199 | |
200 | -bool update_precheck(Session *session, TableList *) |
201 | +bool update_precheck(Session *session) |
202 | { |
203 | const char *msg= 0; |
204 | Select_Lex *select_lex= &session->getLex()->select_lex; |
205 | @@ -1575,7 +1575,7 @@ |
206 | true error |
207 | */ |
208 | |
209 | -bool insert_precheck(Session *session, TableList *) |
210 | +bool insert_precheck(Session *session) |
211 | { |
212 | /* |
213 | Check that we have modify privileges for the first table and |
Hi Akash,
Good to see you submitting your first branch. Great job. There are coding standard violations in your branch. Please make it a point to adhere to all the coding guidelines inn the wiki page that I gave you.
I ll just point out some of the obvious one that I could see,
1) assignment operations should be as follows,
a= b; one space after the = and nonee before.
2) use two space indentations for new blocks of code.
3) braces must be written in new lines.
Please make it a point to fix all the above mentioned and re submit your merge proposal.
Cheers,
-Vijay