Sunday, August 10, 2025

MySQL architecture

There are 3 layers. 

The layer handles connection, authentication and security 

The second layer is the optimizer, execution engine and cache. 

The bottom layer is the storage engines. The storage engine API make it transparent to the query. Transaction is implemented in this layer. 

Friday, August 8, 2025

Database logging

Logging allows the changed data to be updated to the table at a later time. Although logging is achieved by writing the data out to log, it has better performance than writing the data out to table  the reason is logging is always appending at the end of the log file as compare to randomly seek to the spot when writing to the table. The io is also less 

Isolation mode

Read uncommitted aka dirty read allows reading data that have not been committed by transaction. 

Read committed allows only retrieving rows that has been committed. But a repeating read may return different result as there are committed changes in between successive read

Repeatable read allows the same result to return in successive read but it still allows phantom read. Rows that inserted between successive read. T only protected the rows read from changing. 

Serializaruon is to do one query at a time thus preventing all changes until the current transaction commits. 

Sunday, August 3, 2025

Linux Link

ln command by default creates a hard link which is a file that share the same inode as the original file it links to.

Soft link (symbolic link) is a newer link type that addresses some disadvantage of hard link.  It can link to a directory.  It can like to entry in another file system.  It can link to an entry that does not exist currently (e.g. a file that is created from time to time).

When cd to a directory using symlink, the shell builtin pwd will display the name of the symlink that link to but /bin/pwd (utility) will display the destingation directory.  When you cd to .. it will return to the directory that holding the symlink.

Linux file and directory permissions

 To execute shell script, you mean r+x to the script file.  To execute a binary, you just need x.

The "+" after the permission indicated if the file has an ACL

Numbers to represent rwx is 1/2/4.  Or (add) the number to create composite permissions.  For example, 700 means 1+2+4 for owner and 0 for group/other.

Setuid/setgid change the permission x to s in the listing.  Set these permissions by specifying a 4th digit.  For example. 2700 or 4700 sets the setgid or setuid respectively.  "1" is to set the sticky bit to the program.

Kernel will not execute a script with setuid/setgid on.

Execute permission in directory indicated if the user can cd into the directory and access file that he has been permitted to.  If user has x but no r for a directory, he cannot display the directory file content (i.e. list of files in directory) using ls command.

Using ACL has overhead and should not enable ACL on system directory and files.  Not all file utility preserve ACL by default.  Destination filesystem may or may not support ACL.  In addition, the filesystem must be mounted with ACL enabled (default no ACL). 

ACL grant access to other user or group beside the owner's.  Beside ugo. ACL has a role called "mask" which specified the effective (maximum) permission ACL permitted for the directory or file.  Any ACL specified more than mask's will not be effective (i.e. denied).  Mask is usually set to the max permission allowed and individual ACL rule is more restrictive than mask's.

Registry tools

REGEDIT is a GUI tool to see and manipulate registry entries. 

REG.EXE is a CLI tool

REGINI is a CLI that can use a text file containing REG commands as input 

POWERSHELL has command to manipulate registry


.reg file

This is an exported registry file in text format. It is not the registry file itself. Content can be import into the registry.