Backlog of expense reports done
Backpack packed (including new Nokia N800 toy)
Off to Portland, where I will be at OSCON all week. I'm giving a talk on Thursday:
Extending MySQL, Swiss Army Knife Approach
I hereby declare what from now on shall be known as “Jan's Law”:
Whenever a discussion about storage systems arises, the proximity of discussing the amounts of adult content that fits onto such systems reaches one.
I bought a WD MyBook Pro II for my storage and backup needs. The 2x500GB RAID 1 setup provides enough space and safety for me. It is also faster than the internal 2.5" hard drive of my Intel Mac Mini and since Macs can be booted from Firewire drives I thought it'd be a good idea to do just that.
I went to install a fresh copy of MacOS X onto the new drive. The installer happily proceeded and upon reboot, well, the Mini didn't reboot into the new system. The old installation came up. Easy, I thought, just set the correct Startup Volume in the Preferences. No Go.
Luckily, when holding the alt-key while starting up, a Mac shows all available volumes to start OS X from. Relieved, I chose the MyBook volume. A couple of seconds into the startup sequence, the …
[Read more]Though this is an age old concept, but after seeing the ignorance factor of many regarding this, I thought of writing a bit about it. ROLLUP is a GROUP BY modifier that adds extra rows to the output which contain summary data. At each level of aggregation the aggregated column is filled with a NULL value.
Let's see a small example. I know the values are too small for the data presented, but just to keep it readable.
1: mysql> CREATE TABLE `rollup_1` (
2: `url` varchar(255) DEFAULT NULL,
3: `year` int(11) DEFAULT NULL,
4: `country` char(2) DEFAULT NULL,
5: `visit` int(11) DEFAULT NULL
6: ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
7: Query OK, 0 rows affected (0.01 sec)
8:
9: mysql> SELECT * FROM rollup_1;
10: +----------------------+------+---------+-------+
11: | url | year | …[Read more]
Mysql AB provides print_stacktrace function inside
stacktrace.c.
void print_stacktrace(gptr stack_bottom, ulong
thread_stack)
mysqld.cc calls it when segfault happens:
print_stacktrace(thd ? (gptr) thd->thread_stack : (gptr)
0,
thread_stack);
Its basic idea of print_stacktrace is
1. first get current frame pointer fp
take __i386__ for example, fp is
Extended Base Pointer (ebp)
#ifdef __i386__
__asm __volatile__ ("movl %%ebp,%0"
:"=r"(fp)
:"r"(fp));
#endif
+---------+------------------+
| EBP - 4 | local variables |
| EBP | callees EBP |
| EBP + 4 | ret-addr |
| EBP + 8 | parameters |
+---------+------------------+
2. transverse the stack to print the call stack info
/* We are 1 frame above signal frame with NPTL and 2 frames above …
We can use GNU C lib backtrace functions to get call stack on
Linux OS.
int backtrace (void **buffer, int size)
char
** backtrace_symbols (void *const *buffer, int
size)
header file: execinfo.h
in order to get the symbols, we need pass -rdynamic
to gcc. pass the flag -export-dynamic to the ELF
linker, on targets that support it. This instructs the linker to
add all symbols, not only used ones, to the dynamic symbol
table.
-rdynamic will
Limitation: it only works when backtrace is provided in GNU C. It
does not work on Mac.
Compile: gcc -o mytrace mytrace.c -rdynamic
Example Result:
Obtained 6 stack frames.
./mytrace(print_trace+0x14) [0x8048724]
./mytrace(dummy_function+0xb) [0x80487b7]
./mytrace(dummy_function_1+0xb) [0x80487a7]
./mytrace(main+0xb) [0x80487c7] …
A couple of weeks ago, a friend asked about replication on MySQL 4.1.7. I’ve worked with replication in the past, just a quick and dirty job on MySQL 5, and soon forgot about it. This time, I wanted to do it on MySQL 4, and make sure I take good notes for my own benefit. If it can help somebody else, all the better. The official documentation is here. It took a little time to wade through it.
The process below is used to replicate all databases on the master to the slave(s). I will talk about replicating only certain selected databases in a future post.
1. At the master server, check if binary logging is on. Use show variables like ‘%bin%’ to check if binary logging is on or not. If it is not on, turn it on by adding log-bin under [mysqld] section in …
[Read more]
I'll be heading to OSCON 2007 on Tuesday. Unfortunately, my stay
will be short as I already have to head back to California on
Wednesday evening but I am still looking forward to meeting as
many open-source enthusiasts as possible. Our partner MySQL and
us (Zend) are hosting a reception together for our friends and users which
I'm very much looking forward to. With an overwhelming overlap in
our communities I'm sure it'll make for many interesting
discussions.
On Wednesday I'll be giving two talks back to back. The first is
on Rich Internet Applications & PHP where I'll talk about the
state of Ajax + PHP, show a small demo with Zend Framework and
talk about some of the things we've got cooking.
After a short break, I'll be giving a talk on security. My goal
for that talk is to take a completely different angle on security
than what …
I'm moving my blog from http://gnu.inter.it/blogs/ilcorra/archives/cat_mysqlen.html to http://blog.pandiani.com
My new MySQL related XML feed is http://blog.pandiani.com/category/mysqlen/feed
Please update your links
Thanks
Scott Noyes wrote about a question frequently
asked in for instance the freenode #mysql channel: given a table
with students and answers, which students have answered all of a
certain set of questions.
While his solutions are interesting, they do indulge a bit. And
I'm not even referring to the fact that he uses obscure string
and bit functions... he can do that if he wants to ;-) But it's a
relatively simple problem that just does not need such
(potentially inefficient) constructs.
For starters, it'd be good to have a WHERE clause, because even
if there are many more questions in the table, you only need the
As and Bs. You never want to use the HAVING as a replacement for
WHERE, because having chucks away already retrieved rows from the
result set, while WHERE limits what is retrieved in the first
place.
Also, while it's very good to …