View dmesg.txt
usb 4-2: new full-speed USB device number 3 using ohci-pci
usb 4-2: New USB device found, idVendor=1209, idProduct=2301
usb 4-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 4-2: Product: Model 01
usb 4-2: Manufacturer: Keyboardio
usb 4-2: SerialNumber: ********
input: Keyboardio Model 01 as /devices/pci0000:00/0000:00:12.1/usb4/4-2/4-2:1.2/0003:1209:2301.0005/input/input16
hid-generic 0003:1209:2301.0005: input,hidraw4: USB HID v1.01 Mouse [Keyboardio Model 01] on usb-0000:00:12.1-2/input2
input: Keyboardio Model 01 as /devices/pci0000:00/0000:00:12.1/usb4/4-2/4-2:1.3/0003:1209:2301.0006/input/input17
hid-generic 0003:1209:2301.0006: input,hidraw5: USB HID v1.01 Mouse [Keyboardio Model 01] on usb-0000:00:12.1-2/input3
View index.md

マスター勢いろいろ教えていただいたので、やってみました。

元のクエリ

> EXPLAIN ANALYZE
SELECT "statuses"."id", "statuses"."updated_at" FROM "statuses"
LEFT OUTER JOIN "accounts" ON "accounts"."id" = "statuses"."account_id"
WHERE ("statuses"."local" = TRUE OR "statuses"."uri" IS NULL)
AND "statuses"."visibility" = 0
View 01.sh
$ git clone https://github.com/tootsuite/mastodon.git mastodon-pr515
$ cd mastodon-pr5158
$ git remote add Kjwon15 https://github.com/Kjwon15/mastodon.git
$ git fetch Kjwon15
$ git merge Kjwon15/streaming
$ heroku create
Creating app... done, ⬢ stark-sands-75673
https://stark-sands-75673.herokuapp.com/ | https://git.heroku.com/stark-sands-75673.git
$ heroku buildpacks:add https://github.com/heroku/heroku-buildpack-apt
$ heroku buildpacks:add heroku/nodejs
View ltl.sql
> EXPLAIN ANALYSE SELECT statuses.id, statuses.updated_at FROM statuses LEFT OUTER JOIN accounts a ON a.id = account_id WHERE (local = true OR statuses.uri IS NULL) AND visibility = 0 AND (reblog_of_id IS NULL) AND (not reply OR in_reply_to_account_id = account_id) AND not silenced ORDER BY statuses.id DESC LIMIT 40;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.14..323.77 rows=40 width=16) (actual time=4862.449..8725.201 rows=40 loops=1)
-> Nested Loop (cost=0.14..20947.19 rows=2589 width=16) (actual time=4862.448..8725.184 rows=40 loops=1)
-> Index Scan Backward using statuses_pkey on statuses (cost=0.08..17682.20 rows=2589 width=24) (actual time=4862.429..8724.707 rows=40 loops=1)
Filter: ((local OR (uri IS NULL)) AND (reblog_of_id IS NULL) AND ((NOT reply) OR (in_rep
View with_reblog_is_null.sql
> EXPLAIN ANALYZE SELECT "reblog_of_id" FROM "statuses" WHERE ("reblog_of_id" = 11 OR "reblog_of_id" IS NULL) AND "account_id" = 1 ORDER BY "id" DESC;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Sort (cost=5391.51..5393.22 rows=3402 width=16) (actual time=49741.632..49741.844 rows=2716 loops=1)
Sort Key: id DESC
Sort Method: quicksort Memory: 224kB
-> Bitmap Heap Scan on statuses (cost=38.43..5351.60 rows=3402 width=16) (actual time=3130.508..49736.730 rows=2716 loops=1)
Recheck Cond: (account_id = 1)
Filter: ((reblog_of_id = 11) OR (reblog_of_id IS NULL))
Rows Removed by Filter: 1167
View 00-faillog.txt
remote: Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:
remote: current directory:
remote: /tmp/build_0a3b28f1eec68065064b0713c9d97b3a/vendor/bundle/ruby/2.4.0/gems/charlock_holmes-0.7.5/ext/charlock_holmes
remote: /tmp/build_0a3b28f1eec68065064b0713c9d97b3a/vendor/ruby-2.4.1/bin/ruby -r
remote: ./siteconf20170913-2062-1bdbmp7.rb extconf.rb
remote: checking for -licui18n... yes
remote: checking for -licui18n... yes
remote: checking for unicode/ucnv.h... yes
remote: checking for -lz... yes
View redis-offline.md

Mastodonの稼働中にRedisが落ちるとどうなるか、今朝のログを眺めてみました。

まず気づいたのはSidekiqのコネクションプールだった様子:

Aug 20 17:56:49 ERROR: heartbeat: Error connecting to Redis (Redis::TimeoutError) 
  :
Aug 20 17:56:49 ERROR: /app/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq/fetch.rb:36:in `block in retrieve_work' 
Aug 20 17:56:49 ERROR: /app/vendor/bundle/ruby/2.4.0/gems/sidekiq-5.0.4/lib/sidekiq.rb:95:in `block in redis' 
Aug 20 17:56:49 ERROR: /app/vendor/bundle/ruby/2.4.0/gems/connection_pool-2.2.1/lib/connection_pool.rb:64:in `block (2 levels) in with' 
View trial-on-freebsd.sh
$ uname -srm
FreeBSD 11.0-RELEASE-p9 amd64
$ su
# pkg install ruby-2.3.4_1,1
# pkg install git-2.13.2
# exit
$ git clone https://github.com/tootsuite/mastodon.git
$ cd mastodon
$ ruby -v -rpsych -e 'p Psych.load(IO.read("config/sidekiq.yml"))'
ruby 2.3.4p301 (2017-03-30 revision 58214) [amd64-freebsd11]
View deploy.md

rake mastodon:maintenance:prepare_for_foreign_keys needs to run.

Merge

$ git checkout master
$ git fetch upstream
$ git rev-parse upstream/master
75c6513c678148e9a6adfcda57cfd5c8a16c804a
$ git rebase upstream/master
View gist:1945febe43bd51e04d22e465377d82d6
StandardError: An error has occurred, this and all later migrations canceled:
PG::ForeignKeyViolation: ERROR: insert or update on table "statuses" violates foreign key constraint "fk_rails_94a6f70399"
DETAIL: Key (in_reply_to_id)=(14576) is not present in table "statuses".
: ALTER TABLE "statuses" ADD CONSTRAINT "fk_rails_94a6f70399"
FOREIGN KEY ("in_reply_to_id")
REFERENCES "statuses" ("id")
ON DELETE SET NULL
Tasks: TOP => db:migrate
(See full trace by running task with --trace)