T60 Configuration

This is a long story, of the absolute nightmare I have had with this lemon. I wish I could send it back!

I got my new Lenovo T60 from MySQL.

My goal of course is to put Linux on this and I’ve chosen the latest Ubuntu 6.10 switching from Fedora Core 5 on my present personal laptop.

Some initial investigation from the supplied media provided some surprises. Of a 80GB Drive only 69GB available. There is second partition of 5+GB which I later find out to be the IBM Recovery Area as they don’t provided and CD’s of sofware. So the specs say an 80GB drive, but it’s actually only 74.53GB via gpartd. In addition the installation of Windows XP Pro has so much other crap it takes a few mins to fully boot up.

So here is what I did to make this mahine usable.

Backup

As I haven’t installed anything, the only think to backup is the Recovery Media so I can restore to defaults if necessary. You can do this with:

  • Start | Programs | ThinkVantage | Create Recovery Media
  • Select Recovery Discs
  • You will need 1 CD + 1 DVD

NOTE: Don’t loose these, you can’t select these options again to make another copy. This should be done regardless as soon as you get the machine, because if your hard drive crashes you loose it all.

My next step was to install Ubuntu. I plan to reinstall Windows.
Resize via Ubuntu to 20GB

Reconfigure SATA Drive

When I ran the XP Pro Installation CD I received the following error.

Setup did not find any hard drives installed in your computer.
Make sure any hard disk drives are powered on and properly connected to your computer, and that any disk-related hardware configuration is correct.
This may involve running a manufacturer-supplied diagnostic or setup program.

In order to reinstall XP via CD you need to reconfigure the Bios to detect your hard drive appropiately. These can be achieved by:

  • Power on
  • ThinkVantage Button
  • F1 for Bios setup
  • Select Config
  • Select Serial ATA (SATA)
  • Change value (F5) to Compatibility
  • F10 – Save and Exit
  • Yes – Save Configuration and Exit

Windows Installation

The following software then had to be installed.

  • Windows XP Pro
  • Windows XP Pro Service Pack 2
  • Office 2003
  • Office 2003 Service Pack 2

Following default Windows XP Installation most devices were not found. The Lenovo website lists 100s of software updates for the T60 so I decided the simpliest solution was to use the provided ThinkAdvantage System Update, but that also took a number of steps.

This will then enable wired Internet Access (for some reason, the download of the Wireless didn’t help as there was no Other Device that match the wireless device.

ThinkVantage System Update. Follow instructions, I had to install Microsoft .NET Framework as stated. In true and typical form, I had to restart my machine two times (when will Windoze actually get this right).

Disk Crash

Install that hung

two times, I booted both the keyboard and mouse would not work.

Called Lenovo Technical Support
“The protocols are not the same. I need to call Microsoft Support”.

Top 10 Things for IT Professionals

These IT related lists are really quite accurate. I sound like a broken record sometimes when I repeat these things. The articles provides very good detailed descriptions, I’ve included the bullet points just to temp you to read more.

Top ten things ten years of professional software development has taught me.

  1. Object orientation is much harder than you think
  2. The difficult part of software development is communication
  3. Learn to say no
  4. If everything is equally important, then nothing is important
  5. Don’t over-think a problem
  6. Dive really deep into something, but don’t get hung up
  7. Learn about the other parts of the software development machine
  8. Your colleagues are your best teachers
  9. It all comes down to working software
  10. Some people are assholes

The Top 10 Things They Never Taught Me in Design School.

  1. Talent is one-third of the success equation.
  2. 95 percent of any creative profession is shit work
  3. If everything is equally important, then nothing is very important.
  4. Don’t over-think a problem.
  5. Start with what you know; then remove the unknowns.
  6. Don’t forget your goal.
  7. When you throw your weight around, you usually fall off balance.
  8. The road to hell is paved with good intentions; or, no good deed goes unpunished.
  9. It all comes down to output.
  10. The rest of the world counts.

That missing INNODB STATUS

On Thursday I saw something I’d not seen before. An Empty Innodb Status. Now given the amount of output normally shown it was certainly a first. And it looked like:

mysql> SHOW ENGINE INNODB STATUS;
+--------+------+--------+
| Type   | Name | Status |
+--------+------+--------+
| InnoDB |      |        |
+--------+------+--------+
1 row in set (0.03 sec)

To answer some of the most obvious questions.

  • Yes it was a working existing MySQL instance, with InnoDB correctly configured. Indeed we had been benchmarking for several hours.
  • MySQL Server was running, indeed a command selecting data from the mysql schema worked just fine after seeing this (All other tables were Innodb).
  • Absolutely nothing in the host MySQL error log. (This was the second most disappointing aspect)
  • The Process List showed two queries that had been running for some time, everything was taking  ; 1 second. (This was the most disappointing)

So the problem is, MySQL seems to effectively hung when dealing with queries solely in InnoDB tables. Closer investigation found that another application process had filled the /tmp file system. Reclaiming space didn’t cause MySQL and InnoDB to start operating. Even a shutdown of MySQL failed, with mysqld having to be killed manually

For those super inquisitive the version was 5.1.16-ndb-6.2.0-log, and yes it is a Cluster release. I’ve yet to test the problem on a normal 5.1 version and log a bug appropriately if it exists.

I suspect in our benchmark we definitely need to include some timeout handling, so the queries would fail (they were both UPDATES), but it did have the customer asking why, do which there was no answer.

Watching Replication in action

For all those instant GUI people out there, there is an easy way to watch the present status of your MySQL Slaves using the watch command.

$ watch -n 1 -d "mysql -uroot -pxxxx mysql -e 'SHOW SLAVE STATUS\G'"

The watch provides a view of a file or command, and shows interval updates to this output (-n  seconds> option). You can also specific a granularity better then one second for example 0.5. -d also highlights the differences for you. So while you see the following output with your SHOW SLAVE STATUS, on a loaded system you will also see bin-log and relay-log changes, and perhaps Seconds_Behind_Master.

The question is, Why is Seconds_Behind_Master the last column in this display?


*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: localhost
Master_User: repl
Master_Port: 10002
Connect_Retry: 60
Master_Log_File: master-bin.000006
Read_Master_Log_Pos: 102
Relay_Log_File: newyork-relay-bin.000055
Relay_Log_Pos: 244
Relay_Master_Log_File: master-bin.000006
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 102
Relay_Log_Space: 539
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0

Smarter indexing for column LIKE '%string%'

With my very heavy travel load and skilling load I’ve not had time to scratch myself. It hasn’t stopped the brain working overtime on various issues including the classic find a pattern in a string starting with a wildcard character. On a recent gig I saw the true classic.


SELECT columns
FROM users
WHERE username LIKE '%str%'
OR firstname LIKE '%str%'
OR lastname LIKE '%str%'

I went through the various options and comments on leading ‘%’, OR’s, combined columns, FULLTEXT (which doesn’t work in this case), merge indexing etc, however it perplexed me that nobody has really solved this problem, or at least shared their solutions.

I have an idea, a theory and while I’d love to prove/disprove it, I simply just don’t have the time. So here are my notes, hopefully somebody can comment positively/negatively, do some research, or encourage me to pursue it more.

The Problem

The problem is quite simply the leading wildcard, Der!. So how do you eliminate the wildcard from the search?

My Idea

Working with the earlier example, and having a concatenated field of the three components (username,firstname,lastname), my idea is to encode into 27 bits, a bit for each alphabetic character (A-Z) found, and any non-alphabetic character except whitespace in bit 27.

This column is then indexed and searched for bitwise matches. Here is a pictorial description.

String a b c d e f g h i j k l m n o p q r s t u v w x y z
Ronald Bradford 1 1   1   1           1   1 1     1                
Search: ‘brad’ 1 1   1                           1                 *** MATCH ***
Search: ‘fred’       1 1 1                       1                 NO MATCH

My idea is very simple, the question is, will it actually work.

The Questions

The goal is quite obviously to get an Index utilization, to a maximum say of 10%-25% of matching rows. Factors that would affect this include:

  • If search string is one character, like a vowel I could this not useful, so an implied criteria for optimal work is at least 2 or 3 characters.
  • I see the effectiveness lost on large column values, it could be that only up to say 30 characters is optimal, I see strings of 100+ characters would be ineffective.
  • It doesn’t support case-sensitive searching or non ASCII searching

The Tests

  • Create good sized table and distribution of first/last names (A IMDB Actors table would work)
  • Create a concatenated column of searchable fields (e.g. details = CONCAT_WS(‘ ‘,firstname,lastname)
  • Create function to return bitwised search string (e.g. bitize(str))
  • Create Indexed bitwise column and pre-populate accordingly (e.g. bitfulldetails)
  • Create BEFORE INSERT|BEFORE UPDATE Triggers to populate Indexed bitwised column
  • Test the sucker (of course you will need to include the actual LIKE command as well in the WHERE clause)

A sample query would then be:


SELECT columns
FROM users
WHERE bitize('str') & bitfulldetails
AND fulldetails like '%str%'

So the challenge to all those budding MySQL Gurus, does it seem plausible?

What is the maximum number of colons ':' that may appear in a valid URL?

In idle conversation I was asked by MM.

Question: What is the maximum number of colons ‘:’ that may appear in a valid URL?

* If you said zero to one, then you are victim of browsers, and you have never used anything but a browser.

* If you said one, then your a novice.

* If you said two, then you have probably seen http://host:port at some time.

* If you said three, then you would be correct, the elite.

http://user:pass@host:port/location

For the record my initial answer was 2.