Skip to content

Instantly share code, notes, and snippets.

@vagetablechicken
vagetablechicken / dlopen_test.cc
Created June 14, 2023 04:12
test load udf so
View dlopen_test.cc
#include <dlfcn.h>
#include <stdio.h>
int main(void) {
void *handle;
char *error;
handle = dlopen("libtest_udf.so", RTLD_LAZY);
if (!handle) {
fprintf(stderr, "%s\n", dlerror());
@vagetablechicken
vagetablechicken / sdk.mri
Last active June 25, 2023 10:45
The right way to merge libs
View sdk.mri
create libopenmldbsdk.a
addlib /home/huangwei/OpenMLDB/build/src/sdk/libopenmldb_api.a
addlib /home/huangwei/OpenMLDB/build/src/libopenmldb_sdk.a
addlib /home/huangwei/OpenMLDB/build/src/libopenmldb_codec.a
addlib /home/huangwei/OpenMLDB/build/src/libopenmldb_catalog.a
addlib /home/huangwei/OpenMLDB/build/src/libschema.a
addlib /home/huangwei/OpenMLDB/build/src/libclient.a
addlib /home/huangwei/OpenMLDB/build/src/libzk_client.a
addlib /home/huangwei/OpenMLDB/build/src/libbase.a
addlib /home/huangwei/OpenMLDB/build/src/libopenmldb_flags.a
View data_dist_detect.py
import requests
import json
# detect table status about data
db = 'disk_test'
ns_leader = '172.24.4.27:7123'
url = f'http://{ns_leader}/NameServer/ShowTable'
res = requests.get(url, json={"show_all": True})
tables = json.loads(res.text)['table_info']
@vagetablechicken
vagetablechicken / diagnose.py
Last active March 28, 2023 08:36
template fix to inspect offline ls
View diagnose.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2021 4Paradigm
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@vagetablechicken
vagetablechicken / README.md
Created July 20, 2022 08:24
openmldb test sample
View README.md

openmldb/bin/openmldb --zk_cluster=127.0.0.1:2181 --zk_root_path=/openmldb --role=sql_client < test.sql 即可 注意test.sql内,c1.csv的路径,需要跟taskmanager(spark.home=local)在同一台机器上,并且写绝对路径。 输出结果里都是SUCCEED,没有ERROR就可以。

View gist:4424a72ab0c6fe765851e253dee13bed
higher gcc(>=7) don't have pthread,m,...
gcc 4.8.5/5.4.0 download and their prerequire dependencies:
https://gcc.gnu.org/pub/gcc/
depends: https://gcc.gnu.org/pub/gcc/infrastructure/
mkdir build & cd build
../configure --prefix=`pwd`/../output --enable-checking=release --enable-languages=c,c++ --disable-multilib # Multilib means support for multiple architectures
make
make install
View tournament_tree.py
import math
class WinnerTree:
def __init__(self, ext):
self.ext = ext
self.N = len(ext)
self.k = math.ceil(math.log(self.N, 2))
print(self.k, ", bottom layer node ", pow(2, self.k))
View a-useful scripts.md

scripts about cmd, github gh cli ...

@vagetablechicken
vagetablechicken / descprition.md
Last active November 2, 2021 02:34
OpenMLDB ttl setting
View descprition.md

逻辑梳理

  1. hybridse GetAbsTTL可能为-2,-1,[0, MAX]。其中,-2为默认值,应该理解为“不gc”;-1是无效设置时赋予的值,如果GetAbsTTL为-1,就应报错; [0, MAX]则是有效的ttl值 -> 推论:GetAbsTTL为0时,不应该理解为不gc,而应该是一个极短的ttl。<1min的值都可以提升为1min的ttl(结构common::TTLSt)

问题即(ttl_type=absolute,ttl=0m)是不gc还是1min?——结论:不gc

  1. 目前openmldb的create table/create index是没有特殊处理“小于1min的abs ttl”,导致如果GetAbsTTL大于等于0小于1min时,转换出来的abs ttl 就是0,即不gc
  2. 不仅是小于1min的,规则应该是换算为min时向上取整
@vagetablechicken
vagetablechicken / gist:c662057bc1020eb05f2e8ae3afbfe5ea
Last active July 20, 2020 03:05
simple_lb_cure_test core: got signal 11
View gist:c662057bc1020eb05f2e8ae3afbfe5ea
travis_fold:start:worker_info
Worker information
hostname: 97930632-cd86-4abc-b530-adb660c4d0ea@1.worker-org-977b464db-df92s.gce-production-2
version: v6.2.1 https://github.com/travis-ci/worker/tree/4e3246c044eb4915c2378ffacd0b3d3ed0136bba
instance: travis-job-e17d9b0f-9f40-41eb-b06a-6d3a60c7d4cb travis-ci-garnet-trusty-1512502259-986baf0 (via amqp)
startup: 6.517163387s
travis_fold:end:worker_info
travis_time:start:03488a9c
travis_time:end:03488a9c:start=1571800159023736470,finish=1571800159202572543,duration=178836073,event=no_world_writable_dirs
travis_time:start:114ab7a6