Alex King 過世...

Alex KingWordPress 非常早期的知名開發者,十多年前因為 MovableType 更改授權而跳到 WordPress 時就對這個名字非常有印象了,以前還用過他寫的 theme...

結果剛剛看到跟癌症纏鬥了兩年半之後過世的消息,讓人感傷不已:「Remembering Alex King」(Alex Tow)、「Remembering Alex King」(Matt Mullenweg)。

Reddit 放出完整的全站投稿資料

前幾天 Reddit 宣佈放出完整的全站投稿資料:「Full Reddit Submission Corpus now available (2006 thru August 2015)」,有些技術問題使得這次沒放出 2006 與 2007 的資料,之後會想辦法補上:

Data is complete from January 01, 2008 thru August 31, 2015. Partial data is available for years 2006 and 2007. The reason for this is that the id's used when Reddit was just a baby were scattered a bit -- but I am making an attempt to grab all data from 2006 and 2007 and will make a supplementary upload for that data once I'm satisfied that I've found all data that is available.

約 42GB 的資料,幾乎是公開的資料都包含進去了:

This dataset represents approximately 200 million submission objects with score data, author, title, self_text, media tags and all other attributes available via the Reddit API.

檔案放在 Amazon S3 上,不過有人貼出對應的 BitTorrent 連結了,最重要的 btih 值是 9941b4485203c7838c3e688189dc069b7af59f2e。

可以拿來做各種研究...

Amazon SES 可以收信了...

之前 Amazon SES 只能拿來發信,現在可以收信了:「New – Receive and Process Incoming Email with Amazon SES」。

收信下來後可以放到 S3,也可以用 SNS 接,或是用 Lambda 處理。除此之外還有 Spam & Virus 檢查的功能...

一時間想不到用途 :o

拿 Openvirtuals 的主機跑 Syncthing...

Low End Box 上逛到的主機商 Openvirtuals,在 LEB 上看到的優惠已經沒了,但點進去後看到 Buffalo 的主機年繳有 50% off,加上硬碟空間又大,就決定弄一台玩玩...

SSD-CACHED 的 Mini 是 256MB RAM + 512MB vSwap 以及 90GB 空間,要 USD$16/year,而 Standard 的都是兩倍,但只要 USD$20/year,就決定買 Standard 了...

後台的功能比想像中完整,這是系統資訊與狀態的畫面,功能其實不比 DigitalOcean 差 (不過畫面就普普通通了):

裝了 Ubuntu 14.04 64bits 跑,不過 Linux kernel 偏舊了點,是 2.6.32,查了一下維基百科上的資料,應該是 2009 年底的版本,是目前唯一一個 2.6 上有繼續維護的版本:

Linux two 2.6.32-042stab108.2 #1 SMP Tue May 12 18:07:50 MSK 2015 x86_64 x86_64 x86_64 GNU/Linux

網路的部份,實際測試時發現不是很穩定,HiNet 過去有時候會有不低的 packet loss,可能是中間有線路因為 DDoS 造成不穩定。

反正只是要跑 Synthing 也還好,就先這樣丟著... 上面順便跑個 rtorrent 幫忙 Ubuntu 分擔 ISO Image。

把 blog.gslin.org 加上 IPv6 位置

看到「North America is out of IPv4 addresses—for really real this time」這邊提到了北美 IPv4 位置的問題,檢查了一下發現我的 blog 還沒上 IPv6,先把 /etc/network/interfaces 設好,再把 DNS 與 nginx 改了一下就 okay 了。

這是 Google 所觀察到的 IPv6 使用率,可以在「IPv6 – Google」這邊看到:

如果時間軸拉的小一點,可以看出來週末會高一點,周間會低一點 XD

Cisco 釋出偵測是否有被植入後門的程式

前幾天在「在 Cisco Router 上被植入的後門」這邊提到了 Cisco 的 router 被植入後門,剛剛在 Zite 上看到 Cisco 放出檢查程式:「Cisco released a tool to scan for SYNful_Knock implants」。

程式是用 Python 寫的,可以在「Talos Intel - Synful Knock Scanner」這邊取得,但這個網站沒有用 HTTPS 保護,網站上提供的 Hash 簽名也沒有 PGP 簽名的資訊,從無信任起...

找了一下 Cisco 官方的資訊,在「SYNful Knock Scanner」這邊也有提供 Hash,請用這邊的值確認吧,這是目前能做到最好的確認了。

繼續學 Isolation...

在「測試 MariaDB 上 Galera Cluster 的 Isolation」這邊與「從頭學一次 Isolation level 的 REPEATABLE-READ 與 SERIALIZABLE」對應了 Stripe 的「Call me Maybe: MariaDB Galera Cluster」以及 Percona 的「Clarification on “Call me Maybe: MariaDB Galera Cluster”」這兩篇文章,兩邊在空中交火...

而「Call me Maybe: Percona XtraDB Cluster」這篇是目前最新的一篇 (文章日期有點怪怪的,不應該是 2015/09/04)。

畢竟 Galera Cluster 是目前現在在用的產品,雖然跑起來也沒什麼大問題,但預先多了解一點總是比較保險。而要參與這場 Isolation 戰爭,又花了不少時間看幾份資料。(包括重頭讀的)

第一個當然是 1992 年發表的 SQL-92:「ISO/IEC 9075:1992, Database Language SQL」,在 SQL-92 定義了四個 Isolation 的層級,分別是 SERIALIZABLEREPEATABLE READREAD COMMITTEDREAD UNCOMMITTED

另外一篇常被拿出來討論的是 1995 年由微軟帶頭發表的「A Critique of ANSI SQL Isolation Levels」,主要是提出 Snapshot Isolation 的定義。

後來讀到覺得真的很怪的時候到 Stack Exchange 上的 Database Administrators 問:「Does SQL92's REPEATABLE-READ preclude Write Skew (A5B)?」,確認了我的想法。

這篇算是讀書心得吧,留給自己用的 :p

首先是 REPEATABLE READ 的定義是透過「現象」定義,只要符合這些條件就可以被稱作 REPEATABLE READ,這包括了保證不會出現 P1 ("Dirty read"):

1) P1 ("Dirty read"): SQL-transaction T1 modifies a row. SQL-transaction T2 then reads that row before T1 performs a COMMIT. If T1 then performs a ROLLBACK, T2 will have read a row that was never committed and that may thus be considered to have never existed.

以及保證不會出現 P2 ("Non-repeatable read"):

2) P2 ("Non-repeatable read"): SQL-transaction T1 reads a row. SQL-transaction T2 then modifies or deletes that row and performs a COMMIT. If T1 then attempts to reread the row, it may receive the modified value or discover that the row has been deleted.

並且保證 Atomicity 以及 no updates will be lost:

The four isolation levels guarantee that each SQL-transaction will be executed completely or not at all, and that no updates will be lost.

只要做到這些條件,就可以說符合 SQL-92 的 REPEATABLE READ 要求。


另外一方面,在「A Critique of ANSI SQL Isolation Levels」定義的 SQL-92 認為 REPEATABLE READ 是透過 locking 機制實作的 (整篇的寫法的確是朝這個方向走),並且基於 locking mechanism 來推論後續的行為,所以這篇 paper 裡面很多說明是帶著這個大前提的。

而當時已經有資料庫是使用 MVCC 架構在實作,可以透過 read snapshot 的方式找出另外一條路。

舉例來說,InnoDB 對 REPEATABLE READ 實作的方式是透過 snapshot 實作:(出自「MySQL :: MySQL 5.6 Reference Manual :: 13.3.6 SET TRANSACTION Syntax」)

For consistent reads, there is an important difference from the READ COMMITTED isolation level: All consistent reads within the same transaction read the snapshot established by the first read. This convention means that if you issue several plain (nonlocking) SELECT statements within the same transaction, these SELECT statements are consistent also with respect to each other.

這樣避開了 P1、P2 (甚至多做避開到了 P3,不過這邊不重要),並且 Atomicity。而 Update Lost 問題則再透過 lock 機制避免。所以 InnoDB 的 REPEATABLE READ 其實比 SQL-92 的要求多做到了很多事情...


到這邊再回頭看原來的討論文章,才會發現 Isolation 裡有滿滿的地雷可以採 XD

nginx 1.9.5:支援 HTTP/2!

前幾天 nginx 釋出 1.9.5 版,支援 HTTP/2 (ngx_http_v2_module):「NGINX Open Source 1.9.5 Released with HTTP/2 Support」。

不過預設是沒有編進去的,需要用 --with-http_v2_module 開起來:

This module is not built by default, it should be enabled with the --with-http_v2_module configuration parameter.

要注意的是,由於是透過 ALPN 實作,需要 OpenSSL 1.0.2 之後的版本:

Note that accepting HTTP/2 connections over TLS requires the “Application-Layer Protocol Negotiation” (ALPN) TLS extension support, which is available only since OpenSSL version 1.0.2. Using the “Next Protocol Negotiation” (NPN) TLS extension for this purpose (available since OpenSSL version 1.0.1) is not guaranteed.

不過 PPANGINX Mainline 這邊還沒更新到 1.9.5,反正 SPDY 現在的佔有率還是比 HTTP/2 高,再等等吧...