Monday, November 07, 2011

Cassandra: Recover SSTable Due To Version Mismatch

Cassandra 0.7 version shipped with a bug that caused incorrect row-level bloom filters to be generated when compacting sstables generated with earlier versions. This would manifest in IOExceptions during column name-based queries. Cassandra provides "nodetool scrub" to rebuild sstables with correct bloom filters, with no data lost. (If your cluster was never on 0.7.0 or earlier, you don't have to worry about this.) Note that nodetool scrub will snapshot your data files before rebuilding, just in case.

When adding a node to the cluster, the boostrapping process get's stuck when it receives a file which is apparently from an older version. This is the Exception:

java.lang.RuntimeException: Cannot recover SSTable /var/lib/cassandra/data/MYKEYSPACE/UserUpdateStatusWallTimeline-tmp-f-1 due to version mismatch. (current version is g).
at org.apache.cassandra.io.sstable.SSTableWriter.createBuilder(SSTableWriter.java:240)
at org.apache.cassandra.db.compaction.CompactionManager.submitSSTableBuild(CompactionManager.java:1090)
at org.apache.cassandra.streaming.StreamInSession.finished(StreamInSession.java:110)
at org.apache.cassandra.streaming.IncomingStreamReader.readFile(IncomingStreamReader.java:104)
at org.apache.cassandra.streaming.IncomingStreamReader.read(IncomingStreamReader.java:61)
at org.apache.cassandra.net.IncomingTcpConnection.stream(IncomingTcpConnection.java:177)
at org.apache.cassandra.net.IncomingTcpConnection.run(IncomingTcpConnection.java:114)


This is a bash script that will simplify scrubbing your Cassandra data.

#!/bin/sh
# Cassandra: Recover SSTable Due To Version Mismatch
# (by) Asep Andria

# http://www.linkedin.com/in/asepandria

NODETOOL="/usr/local/cassandra/bin/nodetool"
CASSANDRA_HOST="192.168.0.1"
EXEC="$NODETOOL -h$CASSANDRA_HOST scrub "
CASSANDRA_DATA="/data/cassandra/data/
MYKEYSPACE"
$EXEC | ls "$CASSANDRA_DATA"/*-f-* | sed 's#^.*/##' | cut -f1 -d'-' | uniq -i -d

Tuesday, December 15, 2009

How To Recursively Delete .svn Folders

Today, using versioning system on a software development is a must. This is to avoid the replacement of a file that can occur while the development process.

When using versioning system such as Subversion, the system will automatically create a .svn folder on each folder we have. The bad things come whenever we have to send a project folder to other people. It's not convenient if we send them a project folder with .svn folder in it. Yes, we need to clean the .svn folder.

On a Linux environment, go to your project folder and type the syntax below :

rm -rf `find . -type d -name .svn`

On a Windows environment, please create one batch file for example cleansvn.bat and put the code below to that batch file :

FOR /F "tokens=*" %%G IN ('DIR /B /AD /S *.svn*') DO RMDIR /S /Q "%%G"

Execute your batch file on a Windows command line and give your project folder as a parameter (in this example: d:\master\htdocs\vivanews.com is a project folder which we want to clean from .svn)

D:\>cleansvn.bat d:\master\htdocs\vivanews.com

And voila ... your project folder is clean from .svn files. Hope this help.

Wednesday, December 02, 2009

Editing HOSTS File on Windows 7

HOSTS file is a file that contains the mappings of IP addresses to host names. It's used by Microsoft TCP/IP for Windows or TCP/IP for Linux.

If you're a developer or programmer or even an administrator, i'm sure you will often edit this file. You can found this HOSTS file on C:\Windows\System32\drivers\etc\hosts (for Windows XP, Windows 2003 Server, Windows Vista, Windows 7) or on /etc/hosts (for Linux family).

In previous Windows version (Windows XP or 2003 Server), you can change the content of this HOSTS file and simply save your changes without problem. But, if you try to edit this HOSTS file on Windows 7 you will face an error something like this "This is a read-only document".

The solution is simple. If you are using Notepad or EditPlus or another editor application to edit this HOSTS file, make sure that you run the Notepad or EditPlus as an Administrator.

The question now is how to make sure that my editor application is run as administrator?

Ok. This is a sample if you're using Notepad as an editor.

Go to Start -> All Programs -> Accessories. You will see the Notepad icons there. Right-click on Notepad and choose "Run as administrator". Then open the HOSTS file using that Notepad.

And now you can edit your HOSTS file without problem.

Thursday, May 07, 2009

How To Permanently Delete Your Facebook Account

This is the article i've found from Facebook when going to delete my Facebook account.

Ever tried to leave Facebook and found out they only allow you to "deactivate" your account? All your personal data, including photos, interests, friends etc will still be saved indefinitely! You don’t have to be a conspiracist to find this quite fishy (or simply annoying)!

Look further down for instructions on how to get your account permanently deleted.

Maybe you see no reason to leave Facebook yet?
In any case, information about how to close an account should be easily available to all members. Join this group to keep the information handy the day you appreciate your privacy more than invitations to vampire applications and updating long lost “friends” of your life.


- - - - - - - - - - - - - - HOW TO ACHIEVE PERMANENT DELETION - - - - - - - - - - - - - -

Go to this page:
http://www.facebook.com/help/contact.php?show_form=delete_account

Click "Submit" and follow the instructions.

Your account will be deactivated for two weeks, and if you don't log in during that period, your account is permanently deleted.

This method is official and should be complete, i.e. no need to delete individual photos, comments, messages or items from your profile or anywhere else on Facebook!

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Please note that I'm not a part of the Facebook team, and consequently cannot fix anything that's broken. If you are experiencing problems with the link above (or anything else concerning your account) your best bet is to contact facebook directly using this form: http://www.facebook.com/help/contact_generic.php

If someone has stolen your identity or if you are subject to any other form of "account abuse", try this form: http://www.facebook.com/help/contact.php?show_form=fake_profile

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Outdated instructions were put in
"Archive: Obsolete ways of account deletion" in the discussion board.)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Friday, May 02, 2008

Strange Behaviour on D-Link DSL-302T ADSL Modem

In my home (actually my parent in law home) i have two computers connected on LAN using switch. I have an ADSL modem (D-Link DSL-302T) and want to make my two computers connected on the internet. So, i plug a modem RJ 45 to the switch and also each computers.

I configure the IP address like this :

192.168.1.1 (ADSL Modem)
192.168.1.2 (Computer 1)
192.168.1.3 (Computer 2)

and pointing the gateway on each computer to the ADSL modem IP (192.168.1.1)

Logically, this setting have to work. But, in fact i can't browsing to the internet on each computers. I saw the log on the modem that my modem already connected and got WAN IP address.



So, what's wrong here? Ok, i try to solve this problem by changing the TCP/IP address to obtain an IP address automatically.



Check the connection using ping command and restore the TCP/IP address to the default IP address which is 192.168.1.2 and 192.168.1.3.



And, magically now all computers connected to the internet.

How To Change Boot Sequence on Windows XP

I have to face a situation that needed to have two operating systems installed on my single computer. In my case, i already have installed Windows XP Pro Service Pack 2 English version for a long time ago. And now, the condition force me to have Windows XP Korean version installed.

The new operating system installed successfully. When booting the computer, there are two option of which operating system will be used. The default operating system is a newer operating system installed. But, i need my English version of Windows XP as a default entry for operating system. How to do this?

You can do this by right click My Computer and choose Properties as the image below:



Then go to Advanced tab and on the Startup and Recovery section click Settings button



In here you will face the section called System startup and the list of available Default operating system.



Choose your preferred operating system and then click OK. The previous XP and newer XP operating system will have a same name. This thing can make us confuse. To edit the operating system boot name, click on the Edit button and you will be prompted with the notepad contain the boot information like this



Just change the operating system name with the name preferred, for example like the image below



Save your changes and try to reboot your computer and see the result.

Friday, April 25, 2008

JavaScript Suicide

Getting busy with a day by day working hours makes me for a long time not involved on writing this blog anymore. I do apologize for this.

In some situation, we might want to run a script (asp, php, c#, jsp, cfm) using browser and then after execute the script the browser closed automatically.

You can simply do this using the JavaScript code below. Put this code at the beginning of your script :

<script>
function doSuicide()
{
opener = self;
top.window.close();
}
</script>

And then put this code at the end of your script :

<script>doSuicide();</script>

How this JavaScript code works?

First, the browser will load all the script till the end of the script. After the browser parsing the code and found the JavaScript function that call doSuicide() function then this will make the browser forced to closed by himself.

This JavaScript code known works on Internet Explorer and Firefox 2+

Monday, December 10, 2007

The field is too small to accept the amount of data you attempted to add

Like the other developers, the error code print out would make easier to find out the way where we must to debug and fix the problem.

Like the error code below
System.Data.OleDb.OleDbException: The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at Register.ExecuteCommand(String MyCmd) in d:\Project\fake\UserManagement\Register.aspx.cs:line 60
The error code above represent that our Table Field Size didn't have sufficient Field Size to handle the data longer than the available Field Size.

On Ms. Access database the default length for Text Data Type is 50. The maximum length of a Text Data Type is 255. So, please provide the sufficient Field Size for the data you want to be saved on an Access database.



If the data is longer than 255 it might you need consider to use a Memo field, then you can get a whole lot more characters, but this may be overkill.

Operation must use an updateable query

It might be sometime you will got this error when working with ASP.NET and Ms. Access database.
System.Data.OleDb.OleDbException: Operation must use an updateable query. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteNonQuery() at Register.ExecuteCommand(String MyCmd) in d:\Project\fake\UserManagement\Register.aspx.cs:line 60
The error would be different depending on your ASP.NET code. But the main error will looks similar.
This is very well known problem and may occur under the following circumstances
  • An ASP.NET worker process (Aspnet_wp.exe) runs under the default ASPNET account.
  • You do not enable impersonation on that application.
  • You try to connect to or write to an Access database.
To solve the problem you need to give the permission to ASPNET account. The exact permissions are Modify. Although on Windows Server 2003, it is probably the NETWORK SERVICE account.
  1. Right click on the folder containing the Access database, then choose Properties | Security.
  2. Click "Add".
  3. Click "Advanced" and make sure the "From this location..." entry matches the current box.
  4. Click "Find Now" and you will be presented with a list of user accounts.
  5. Double click the NETWORK SERVICE entry, then click OK.
  6. Select the "Modify" option, then click "Apply".
The image shown below illustrated the process.




Hope this helps.

Reference :
(1) http://support.microsoft.com/default.aspx?scid=kb;en-us;316675