• Coc Snippets

    今天又折腾了一下 vim 里面的snippets,了解了几个概念。

    原来 snippets 现在有两种格式,一种是 UltiSnips,一种是snipmate。 像 honza/vim-snippets 里面就包含两种格式的(但内容有所不同)

    coc-snippets 好像对 UltiSnips 的支持更好,配置更丰富,相比之下,snipmate 的配置就比较少。

    coc-snippets 加载 snipmate 格式的文件时,好像不能多目录加载,这个后面需要翻代码确认一下。我更新 runtimepath 也没能成。最后还是把自己 custom 的内容添加到 honza/vim-snippets/snippets/python.snippets 后面了。

  • kafka 压缩对比

    原始数据26MB

    gzip: 6.2M, 3.00s user 0.67s system 65% cpu 5.597 total

    lz4: 11M 2.9s user 0.70s system 66% cpu 5.712 total

    snappy: 13M 2.81s user 0.69s system 59% cpu 5.874 total

    但是 gzip 的解压速度应该比较慢,未测试。

    综合来看,lz4 不错。

  • Jq Raw String

    使用 linux 的命令 jq 输出json 对象中的一个字段 name,name是一个字符串。 我使用 jq ‘.name’ 输出的结果带有双引号,有什么办法可以不要双引号吗?最好是 jq 命令自己的参数,而不是使用管道交给另外一个命令处理。

    要使用 jq 命令输出 JSON 对象中的一个字段(例如 name),并去除结果中的双引号,你可以使用 -r--raw-output 选项。这将输出原始字符串,而不是 JSON 字符串。例如:

    jq -r '.name'
    
  • 流水账

    2号加班到比较晚,3号是周三,过了10点半才起来,看到前老板半小时前的消息,尴尬。

    专门开车去black sheep 喝了杯手冲,68,还不错。但周边停车太贵了。

    然后找管吃了饭,接着去滑板,然后又夜宵。

  • Lvm Dm Io Utils

    磁盘做 LVM,12块盘做一个LVM ,Strip12。 压测(fio 随机读写)的时候,LVM(dm-2) utils 打到100%,但磁盘的才50%不到。 导致吞吐量不能更高。

    怎么可以突破这个瓶颈呢?

  • 处女座

    我在咖啡店,听到一个顾客的店员的对话。

    店里是没有卫生间吗?

    对,在旁边,暖光商场里面。

    多远?

    看你走多快。

    NONONO,多远并不取决于走多快~

  • 流水账

    前天看 B 站的跨年演唱会,觉得还不错,今天买入一些 B 站。

    今天一上班就搞了两个故障,一个把 FWS SIN 的机器重启后起不来了,可能是 FSTAB 配置有问题,另外一个是更新 Hickwall Kafka 集群配置后,operator 直接重启了 POD,导致一天都在做数据复制。

  • Disk Automatically Unmounts Immediately After Mounting

    https://www.bentasker.co.uk/posts/documentation/linux/480-disk-automatically-unmounts-immediately-after-mounting.html

    When it happens, it’s incredibly frustrating - you’ve had a disk replaced on a linux box, the disk has shown up with a different name in /dev, so you edit /etc/fstab and then try to mount the disk.

    The command runs, without error, but the disk isn’t mounted, and doesn’t appear in df

    This documentation details the likely cause, and how to resolve it

    If you look in dmesg, you might see something like the following

    [  462.754500] XFS (sdc): Mounting V5 Filesystem
    [  462.857216] XFS (sdc): Ending clean mount
    [  462.871119] XFS (sdc): Unmounting Filesystem
    

    Which, whilst it shows the disk is getting unmounted almost immediately, isn’t otherwise very helpful. It doesn’t tell us why.

    However, if you look in syslog (e.g. /var/log/messages, journalctl or /var/log/syslog) you may well see this logged again with a couple of additional relevant lines

    kernel: XFS (sde): Mounting V5 Filesystem
    kernel: XFS (sde): Ending clean mount
    systemd: Unit cache2.mount is bound to inactive unit dev-sdc.device. Stopping, too.
    systemd: Unmounting /cache2...
    kernel: XFS (sde): Unmounting Filesystem
    systemd: Unmounted /cache2.
    

    We can now see that the erstwhile init system - systemd - decided to unmount the filesystem

    systemd: Unit cache2.mount is bound to inactive unit dev-sdc.device. Stopping, too. The reason for this is that at boot time systemd-fstab-generator generates, in effect, a bunch of dynamic unit files for each mount. From the output above we can tell the disk used to be sdc but is now sde. Despite fstab saying

    /dev/sde      /mnt/cache2   xfs   defaults,nofail  0 0
    

    When we issue the command

    mount /cache2
    

    SystemD picks up on the fact that it has an inactive unit file (inactive because the block device has gone away) which should be mounted to that path, decides there’s a conflict, and that it knows better, and unmounts your mount again If you’re in this position, then, you should be able to briefly resolve with a single command

    systemctl daemon-reload
    

    Keep in mind that if your disk moves back following a reboot, you’ll be back to this point where SystemD decides you can’t have wanted to mount your disk after all.

    SystemD have a bug for this, raised in 2015 and seemingly still unresolved (it’s certainly still attracting complaints at time of writing). Rather worryingly, it suggests that the above will not always resolve the issue, and instead suggests the following “workaround”

  • Linux Shell Variable Render

    a='a' echo "$a"` 和 `a='a' ; echo "$a"` 有什么区别?
    

    我现在的理解是,shell 渲染这个 $a 的时机(顺序)问题,如果没有分号,$a 先渲染,然后才执行命令,foo=bar 是命令的一部分。

    shell 会在执行当前命令 之前把 $XX 这种先渲染掉(如果是单引号里面就不渲染了)

    加了分号或者是使用 && ,就是两个使用,后面命令执行的时候,变量已经被赋值了。如果没有分号或者没有&&,a=’a’ 是命令的一部分,bash 渲染变量在执行命令之前,所以渲染的时候还没有值。

    另外多说一下,在 echo 命令执行的时候,$a 其实是有值的,只不过 echo 跟的参数是 ““,而不是 env(a)。

  • Org.xerial.snappy.snappy

    java.lang.NoClassDefFoundError: Could not initialize class org.xerial.snappy.Snappy

    可能是因为 /tmp 挂载点掉了?