Merge remote-tracking branch 'origin/3.0' into feature/shm
This commit is contained in:
commit
b5ec7d28d9
|
@ -42,103 +42,103 @@ typedef pthread_barrierattr_t TdThreadBarrierAttr;
|
||||||
// If the error is in a third-party library, place this header file under the third-party library header file.
|
// If the error is in a third-party library, place this header file under the third-party library header file.
|
||||||
// When you want to use this feature, you should find or add the same function in the following section.
|
// When you want to use this feature, you should find or add the same function in the following section.
|
||||||
#ifndef ALLOW_FORBID_FUNC
|
#ifndef ALLOW_FORBID_FUNC
|
||||||
// #define pthread_t PTHREAD_T_TYPE_TAOS_FORBID
|
#define pthread_t PTHREAD_T_TYPE_TAOS_FORBID
|
||||||
// #define pthread_spinlock_t PTHREAD_SPINLOCK_T_TYPE_TAOS_FORBID
|
#define pthread_spinlock_t PTHREAD_SPINLOCK_T_TYPE_TAOS_FORBID
|
||||||
// #define pthread_mutex_t PTHREAD_MUTEX_T_TYPE_TAOS_FORBID
|
#define pthread_mutex_t PTHREAD_MUTEX_T_TYPE_TAOS_FORBID
|
||||||
// #define pthread_mutexattr_t PTHREAD_MUTEXATTR_T_TYPE_TAOS_FORBID
|
#define pthread_mutexattr_t PTHREAD_MUTEXATTR_T_TYPE_TAOS_FORBID
|
||||||
// #define pthread_rwlock_t PTHREAD_RWLOCK_T_TYPE_TAOS_FORBID
|
#define pthread_rwlock_t PTHREAD_RWLOCK_T_TYPE_TAOS_FORBID
|
||||||
// #define pthread_attr_t PTHREAD_ATTR_T_TYPE_TAOS_FORBID
|
#define pthread_attr_t PTHREAD_ATTR_T_TYPE_TAOS_FORBID
|
||||||
// #define pthread_once_t PTHREAD_ONCE_T_TYPE_TAOS_FORBID
|
#define pthread_once_t PTHREAD_ONCE_T_TYPE_TAOS_FORBID
|
||||||
// #define pthread_rwlockattr_t PTHREAD_RWLOCKATTR_T_TYPE_TAOS_FORBID
|
#define pthread_rwlockattr_t PTHREAD_RWLOCKATTR_T_TYPE_TAOS_FORBID
|
||||||
// #define pthread_cond_t PTHREAD_COND_T_TYPE_TAOS_FORBID
|
#define pthread_cond_t PTHREAD_COND_T_TYPE_TAOS_FORBID
|
||||||
// #define pthread_condattr_t PTHREAD_CONDATTR_T_TYPE_TAOS_FORBID
|
#define pthread_condattr_t PTHREAD_CONDATTR_T_TYPE_TAOS_FORBID
|
||||||
// #define pthread_key_t PTHREAD_KEY_T_TYPE_TAOS_FORBID
|
#define pthread_key_t PTHREAD_KEY_T_TYPE_TAOS_FORBID
|
||||||
// #define pthread_barrier_t PTHREAD_BARRIER_T_TYPE_TAOS_FORBID
|
#define pthread_barrier_t PTHREAD_BARRIER_T_TYPE_TAOS_FORBID
|
||||||
// #define pthread_barrierattr_t PTHREAD_BARRIERATTR_T_TYPE_TAOS_FORBID
|
#define pthread_barrierattr_t PTHREAD_BARRIERATTR_T_TYPE_TAOS_FORBID
|
||||||
// #define pthread_create PTHREAD_CREATE_FUNC_TAOS_FORBID
|
#define pthread_create PTHREAD_CREATE_FUNC_TAOS_FORBID
|
||||||
// #define pthread_attr_destroy PTHREAD_ATTR_DESTROY_FUNC_TAOS_FORBID
|
#define pthread_attr_destroy PTHREAD_ATTR_DESTROY_FUNC_TAOS_FORBID
|
||||||
// #define pthread_attr_getdetachstate PTHREAD_ATTR_GETDETACHSTATE_FUNC_TAOS_FORBID
|
#define pthread_attr_getdetachstate PTHREAD_ATTR_GETDETACHSTATE_FUNC_TAOS_FORBID
|
||||||
// #define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED_FUNC_TAOS_FORBID
|
#define pthread_attr_getinheritsched PTHREAD_ATTR_GETINHERITSCHED_FUNC_TAOS_FORBID
|
||||||
// #define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM_FUNC_TAOS_FORBID
|
#define pthread_attr_getschedparam PTHREAD_ATTR_GETSCHEDPARAM_FUNC_TAOS_FORBID
|
||||||
// #define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY_FUNC_TAOS_FORBID
|
#define pthread_attr_getschedpolicy PTHREAD_ATTR_GETSCHEDPOLICY_FUNC_TAOS_FORBID
|
||||||
// #define pthread_attr_getscope PTHREAD_ATTR_GETSCOPE_FUNC_TAOS_FORBID
|
#define pthread_attr_getscope PTHREAD_ATTR_GETSCOPE_FUNC_TAOS_FORBID
|
||||||
// #define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE_FUNC_TAOS_FORBID
|
#define pthread_attr_getstacksize PTHREAD_ATTR_GETSTACKSIZE_FUNC_TAOS_FORBID
|
||||||
// #define pthread_attr_init PTHREAD_ATTR_INIT_FUNC_TAOS_FORBID
|
#define pthread_attr_init PTHREAD_ATTR_INIT_FUNC_TAOS_FORBID
|
||||||
// #define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE_FUNC_TAOS_FORBID
|
#define pthread_attr_setdetachstate PTHREAD_ATTR_SETDETACHSTATE_FUNC_TAOS_FORBID
|
||||||
// #define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED_FUNC_TAOS_FORBID
|
#define pthread_attr_setinheritsched PTHREAD_ATTR_SETINHERITSCHED_FUNC_TAOS_FORBID
|
||||||
// #define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM_FUNC_TAOS_FORBID
|
#define pthread_attr_setschedparam PTHREAD_ATTR_SETSCHEDPARAM_FUNC_TAOS_FORBID
|
||||||
// #define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY_FUNC_TAOS_FORBID
|
#define pthread_attr_setschedpolicy PTHREAD_ATTR_SETSCHEDPOLICY_FUNC_TAOS_FORBID
|
||||||
// #define pthread_attr_setscope PTHREAD_ATTR_SETSCOPE_FUNC_TAOS_FORBID
|
#define pthread_attr_setscope PTHREAD_ATTR_SETSCOPE_FUNC_TAOS_FORBID
|
||||||
// #define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE_FUNC_TAOS_FORBID
|
#define pthread_attr_setstacksize PTHREAD_ATTR_SETSTACKSIZE_FUNC_TAOS_FORBID
|
||||||
// #define pthread_barrier_destroy PTHREAD_BARRIER_DESTROY_FUNC_TAOS_FORBID
|
#define pthread_barrier_destroy PTHREAD_BARRIER_DESTROY_FUNC_TAOS_FORBID
|
||||||
// #define pthread_barrier_init PTHREAD_BARRIER_INIT_FUNC_TAOS_FORBID
|
#define pthread_barrier_init PTHREAD_BARRIER_INIT_FUNC_TAOS_FORBID
|
||||||
// #define pthread_barrier_wait PTHREAD_BARRIER_WAIT_FUNC_TAOS_FORBID
|
#define pthread_barrier_wait PTHREAD_BARRIER_WAIT_FUNC_TAOS_FORBID
|
||||||
// #define pthread_barrierattr_destroy PTHREAD_BARRIERATTR_DESTROY_FUNC_TAOS_FORBID
|
#define pthread_barrierattr_destroy PTHREAD_BARRIERATTR_DESTROY_FUNC_TAOS_FORBID
|
||||||
// #define pthread_barrierattr_getpshared PTHREAD_BARRIERATTR_GETPSHARED_FUNC_TAOS_FORBID
|
#define pthread_barrierattr_getpshared PTHREAD_BARRIERATTR_GETPSHARED_FUNC_TAOS_FORBID
|
||||||
// #define pthread_barrierattr_init PTHREAD_BARRIERATTR_INIT_FUNC_TAOS_FORBID
|
#define pthread_barrierattr_init PTHREAD_BARRIERATTR_INIT_FUNC_TAOS_FORBID
|
||||||
// #define pthread_barrierattr_setpshared PTHREAD_BARRIERATTR_SETPSHARED_FUNC_TAOS_FORBID
|
#define pthread_barrierattr_setpshared PTHREAD_BARRIERATTR_SETPSHARED_FUNC_TAOS_FORBID
|
||||||
// #define pthread_cancel PTHREAD_CANCEL_FUNC_TAOS_FORBID
|
#define pthread_cancel PTHREAD_CANCEL_FUNC_TAOS_FORBID
|
||||||
// #define pthread_cond_destroy PTHREAD_COND_DESTROY_FUNC_TAOS_FORBID
|
#define pthread_cond_destroy PTHREAD_COND_DESTROY_FUNC_TAOS_FORBID
|
||||||
// #define pthread_cond_init PTHREAD_COND_INIT_FUNC_TAOS_FORBID
|
#define pthread_cond_init PTHREAD_COND_INIT_FUNC_TAOS_FORBID
|
||||||
// #define pthread_cond_signal PTHREAD_COND_SIGNAL_FUNC_TAOS_FORBID
|
#define pthread_cond_signal PTHREAD_COND_SIGNAL_FUNC_TAOS_FORBID
|
||||||
// #define pthread_cond_broadcast PTHREAD_COND_BROADCAST_FUNC_TAOS_FORBID
|
#define pthread_cond_broadcast PTHREAD_COND_BROADCAST_FUNC_TAOS_FORBID
|
||||||
// #define pthread_cond_wait PTHREAD_COND_WAIT_FUNC_TAOS_FORBID
|
#define pthread_cond_wait PTHREAD_COND_WAIT_FUNC_TAOS_FORBID
|
||||||
// #define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT_FUNC_TAOS_FORBID
|
#define pthread_cond_timedwait PTHREAD_COND_TIMEDWAIT_FUNC_TAOS_FORBID
|
||||||
// #define pthread_condattr_destroy PTHREAD_CONDATTR_DESTROY_FUNC_TAOS_FORBID
|
#define pthread_condattr_destroy PTHREAD_CONDATTR_DESTROY_FUNC_TAOS_FORBID
|
||||||
// #define pthread_condattr_getpshared PTHREAD_CONDATTR_GETPSHARED_FUNC_TAOS_FORBID
|
#define pthread_condattr_getpshared PTHREAD_CONDATTR_GETPSHARED_FUNC_TAOS_FORBID
|
||||||
// #define pthread_condattr_init PTHREAD_CONDATTR_INIT_FUNC_TAOS_FORBID
|
#define pthread_condattr_init PTHREAD_CONDATTR_INIT_FUNC_TAOS_FORBID
|
||||||
// #define pthread_condattr_setpshared PTHREAD_CONDATTR_SETPSHARED_FUNC_TAOS_FORBID
|
#define pthread_condattr_setpshared PTHREAD_CONDATTR_SETPSHARED_FUNC_TAOS_FORBID
|
||||||
// #define pthread_detach PTHREAD_DETACH_FUNC_TAOS_FORBID
|
#define pthread_detach PTHREAD_DETACH_FUNC_TAOS_FORBID
|
||||||
// #define pthread_equal PTHREAD_EQUAL_FUNC_TAOS_FORBID
|
#define pthread_equal PTHREAD_EQUAL_FUNC_TAOS_FORBID
|
||||||
// #define pthread_exit PTHREAD_EXIT_FUNC_TAOS_FORBID
|
#define pthread_exit PTHREAD_EXIT_FUNC_TAOS_FORBID
|
||||||
// #define pthread_getschedparam PTHREAD_GETSCHEDPARAM_FUNC_TAOS_FORBID
|
#define pthread_getschedparam PTHREAD_GETSCHEDPARAM_FUNC_TAOS_FORBID
|
||||||
// #define pthread_getspecific PTHREAD_GETSPECIFIC_FUNC_TAOS_FORBID
|
#define pthread_getspecific PTHREAD_GETSPECIFIC_FUNC_TAOS_FORBID
|
||||||
// #define pthread_join PTHREAD_JOIN_FUNC_TAOS_FORBID
|
#define pthread_join PTHREAD_JOIN_FUNC_TAOS_FORBID
|
||||||
// #define pthread_key_create PTHREAD_KEY_CREATE_FUNC_TAOS_FORBID
|
#define pthread_key_create PTHREAD_KEY_CREATE_FUNC_TAOS_FORBID
|
||||||
// #define pthread_key_delete PTHREAD_KEY_DELETE_FUNC_TAOS_FORBID
|
#define pthread_key_delete PTHREAD_KEY_DELETE_FUNC_TAOS_FORBID
|
||||||
// #define pthread_kill PTHREAD_KILL_FUNC_TAOS_FORBID
|
#define pthread_kill PTHREAD_KILL_FUNC_TAOS_FORBID
|
||||||
// #define pthread_mutex_consistent PTHREAD_MUTEX_CONSISTENT_FUNC_TAOS_FORBID
|
#define pthread_mutex_consistent PTHREAD_MUTEX_CONSISTENT_FUNC_TAOS_FORBID
|
||||||
// #define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY_FUNC_TAOS_FORBID
|
#define pthread_mutex_destroy PTHREAD_MUTEX_DESTROY_FUNC_TAOS_FORBID
|
||||||
// #define pthread_mutex_init PTHREAD_MUTEX_INIT_FUNC_TAOS_FORBID
|
#define pthread_mutex_init PTHREAD_MUTEX_INIT_FUNC_TAOS_FORBID
|
||||||
// #define pthread_mutex_lock PTHREAD_MUTEX_LOCK_FUNC_TAOS_FORBID
|
#define pthread_mutex_lock PTHREAD_MUTEX_LOCK_FUNC_TAOS_FORBID
|
||||||
// #define pthread_mutex_timedlock PTHREAD_MUTEX_TIMEDLOCK_FUNC_TAOS_FORBID
|
#define pthread_mutex_timedlock PTHREAD_MUTEX_TIMEDLOCK_FUNC_TAOS_FORBID
|
||||||
// #define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK_FUNC_TAOS_FORBID
|
#define pthread_mutex_trylock PTHREAD_MUTEX_TRYLOCK_FUNC_TAOS_FORBID
|
||||||
// #define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK_FUNC_TAOS_FORBID
|
#define pthread_mutex_unlock PTHREAD_MUTEX_UNLOCK_FUNC_TAOS_FORBID
|
||||||
// #define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY_FUNC_TAOS_FORBID
|
#define pthread_mutexattr_destroy PTHREAD_MUTEXATTR_DESTROY_FUNC_TAOS_FORBID
|
||||||
// #define pthread_mutexattr_getpshared PTHREAD_MUTEXATTR_GETPSHARED_FUNC_TAOS_FORBID
|
#define pthread_mutexattr_getpshared PTHREAD_MUTEXATTR_GETPSHARED_FUNC_TAOS_FORBID
|
||||||
// #define pthread_mutexattr_getrobust PTHREAD_MUTEXATTR_GETROBUST_FUNC_TAOS_FORBID
|
#define pthread_mutexattr_getrobust PTHREAD_MUTEXATTR_GETROBUST_FUNC_TAOS_FORBID
|
||||||
// #define pthread_mutexattr_gettype PTHREAD_MUTEXATTR_GETTYPE_FUNC_TAOS_FORBID
|
#define pthread_mutexattr_gettype PTHREAD_MUTEXATTR_GETTYPE_FUNC_TAOS_FORBID
|
||||||
// #define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT_FUNC_TAOS_FORBID
|
#define pthread_mutexattr_init PTHREAD_MUTEXATTR_INIT_FUNC_TAOS_FORBID
|
||||||
// #define pthread_mutexattr_setpshared PTHREAD_MUTEXATTR_SETPSHARED_FUNC_TAOS_FORBID
|
#define pthread_mutexattr_setpshared PTHREAD_MUTEXATTR_SETPSHARED_FUNC_TAOS_FORBID
|
||||||
// #define pthread_mutexattr_setrobust PTHREAD_MUTEXATTR_SETROBUST_FUNC_TAOS_FORBID
|
#define pthread_mutexattr_setrobust PTHREAD_MUTEXATTR_SETROBUST_FUNC_TAOS_FORBID
|
||||||
// #define pthread_mutexattr_settype PTHREAD_MUTEXATTR_SETTYPE_FUNC_TAOS_FORBID
|
#define pthread_mutexattr_settype PTHREAD_MUTEXATTR_SETTYPE_FUNC_TAOS_FORBID
|
||||||
// #define pthread_once PTHREAD_ONCE_FUNC_TAOS_FORBID
|
#define pthread_once PTHREAD_ONCE_FUNC_TAOS_FORBID
|
||||||
// #define pthread_rwlock_destroy PTHREAD_RWLOCK_DESTROY_FUNC_TAOS_FORBID
|
#define pthread_rwlock_destroy PTHREAD_RWLOCK_DESTROY_FUNC_TAOS_FORBID
|
||||||
// #define pthread_rwlock_init PTHREAD_RWLOCK_INIT_FUNC_TAOS_FORBID
|
#define pthread_rwlock_init PTHREAD_RWLOCK_INIT_FUNC_TAOS_FORBID
|
||||||
// #define pthread_rwlock_rdlock PTHREAD_RWLOCK_RDLOCK_FUNC_TAOS_FORBID
|
#define pthread_rwlock_rdlock PTHREAD_RWLOCK_RDLOCK_FUNC_TAOS_FORBID
|
||||||
// #define pthread_rwlock_timedrdlock PTHREAD_RWLOCK_TIMEDRDLOCK_FUNC_TAOS_FORBID
|
#define pthread_rwlock_timedrdlock PTHREAD_RWLOCK_TIMEDRDLOCK_FUNC_TAOS_FORBID
|
||||||
// #define pthread_rwlock_timedwrlock PTHREAD_RWLOCK_TIMEDWRLOCK_FUNC_TAOS_FORBID
|
#define pthread_rwlock_timedwrlock PTHREAD_RWLOCK_TIMEDWRLOCK_FUNC_TAOS_FORBID
|
||||||
// #define pthread_rwlock_tryrdlock PTHREAD_RWLOCK_TRYRDLOCK_FUNC_TAOS_FORBID
|
#define pthread_rwlock_tryrdlock PTHREAD_RWLOCK_TRYRDLOCK_FUNC_TAOS_FORBID
|
||||||
// #define pthread_rwlock_trywrlock PTHREAD_RWLOCK_TRYWRLOCK_FUNC_TAOS_FORBID
|
#define pthread_rwlock_trywrlock PTHREAD_RWLOCK_TRYWRLOCK_FUNC_TAOS_FORBID
|
||||||
// #define pthread_rwlock_unlock PTHREAD_RWLOCK_UNLOCK_FUNC_TAOS_FORBID
|
#define pthread_rwlock_unlock PTHREAD_RWLOCK_UNLOCK_FUNC_TAOS_FORBID
|
||||||
// #define pthread_rwlock_wrlock PTHREAD_RWLOCK_WRLOCK_FUNC_TAOS_FORBID
|
#define pthread_rwlock_wrlock PTHREAD_RWLOCK_WRLOCK_FUNC_TAOS_FORBID
|
||||||
// #define pthread_rwlockattr_destroy PTHREAD_RWLOCKATTR_DESTROY_FUNC_TAOS_FORBID
|
#define pthread_rwlockattr_destroy PTHREAD_RWLOCKATTR_DESTROY_FUNC_TAOS_FORBID
|
||||||
// #define pthread_rwlockattr_getpshared PTHREAD_RWLOCKATTR_GETPSHARED_FUNC_TAOS_FORBID
|
#define pthread_rwlockattr_getpshared PTHREAD_RWLOCKATTR_GETPSHARED_FUNC_TAOS_FORBID
|
||||||
// #define pthread_rwlockattr_init PTHREAD_RWLOCKATTR_INIT_FUNC_TAOS_FORBID
|
#define pthread_rwlockattr_init PTHREAD_RWLOCKATTR_INIT_FUNC_TAOS_FORBID
|
||||||
// #define pthread_rwlockattr_setpshared PTHREAD_RWLOCKATTR_SETPSHARED_FUNC_TAOS_FORBID
|
#define pthread_rwlockattr_setpshared PTHREAD_RWLOCKATTR_SETPSHARED_FUNC_TAOS_FORBID
|
||||||
// #define pthread_self PTHREAD_SELF_FUNC_TAOS_FORBID
|
#define pthread_self PTHREAD_SELF_FUNC_TAOS_FORBID
|
||||||
// #define pthread_setcancelstate PTHREAD_SETCANCELSTATE_FUNC_TAOS_FORBID
|
#define pthread_setcancelstate PTHREAD_SETCANCELSTATE_FUNC_TAOS_FORBID
|
||||||
// #define pthread_setcanceltype PTHREAD_SETCANCELTYPE_FUNC_TAOS_FORBID
|
#define pthread_setcanceltype PTHREAD_SETCANCELTYPE_FUNC_TAOS_FORBID
|
||||||
// #define pthread_setschedparam PTHREAD_SETSCHEDPARAM_FUNC_TAOS_FORBID
|
#define pthread_setschedparam PTHREAD_SETSCHEDPARAM_FUNC_TAOS_FORBID
|
||||||
// #define pthread_setspecific PTHREAD_SETSPECIFIC_FUNC_TAOS_FORBID
|
#define pthread_setspecific PTHREAD_SETSPECIFIC_FUNC_TAOS_FORBID
|
||||||
// #define pthread_spin_destroy PTHREAD_SPIN_DESTROY_FUNC_TAOS_FORBID
|
#define pthread_spin_destroy PTHREAD_SPIN_DESTROY_FUNC_TAOS_FORBID
|
||||||
// #define pthread_spin_init PTHREAD_SPIN_INIT_FUNC_TAOS_FORBID
|
#define pthread_spin_init PTHREAD_SPIN_INIT_FUNC_TAOS_FORBID
|
||||||
// #define pthread_spin_lock PTHREAD_SPIN_LOCK_FUNC_TAOS_FORBID
|
#define pthread_spin_lock PTHREAD_SPIN_LOCK_FUNC_TAOS_FORBID
|
||||||
// #define pthread_spin_trylock PTHREAD_SPIN_TRYLOCK_FUNC_TAOS_FORBID
|
#define pthread_spin_trylock PTHREAD_SPIN_TRYLOCK_FUNC_TAOS_FORBID
|
||||||
// #define pthread_spin_unlock PTHREAD_SPIN_UNLOCK_FUNC_TAOS_FORBID
|
#define pthread_spin_unlock PTHREAD_SPIN_UNLOCK_FUNC_TAOS_FORBID
|
||||||
// #define pthread_testcancel PTHREAD_TESTCANCEL_FUNC_TAOS_FORBID
|
#define pthread_testcancel PTHREAD_TESTCANCEL_FUNC_TAOS_FORBID
|
||||||
// #define pthread_sigmask PTHREAD_SIGMASK_FUNC_TAOS_FORBID
|
#define pthread_sigmask PTHREAD_SIGMASK_FUNC_TAOS_FORBID
|
||||||
// #define sigwait SIGWAIT_FUNC_TAOS_FORBID
|
#define sigwait SIGWAIT_FUNC_TAOS_FORBID
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int32_t taosThreadCreate(TdThread * tid, const TdThreadAttr * attr, void *(*start)(void *), void *arg);
|
int32_t taosThreadCreate(TdThread * tid, const TdThreadAttr * attr, void *(*start)(void *), void *arg);
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can use, redistribute, and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License, version 3
|
||||||
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __INDEX_FST_DFA_H__
|
||||||
|
#define __INDEX_FST_DFA_H__
|
||||||
|
|
||||||
|
#include "indexFstRegex.h"
|
||||||
|
#include "indexFstSparse.h"
|
||||||
|
#include "tarray.h"
|
||||||
|
#include "thash.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct FstDfa FstDfa;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
SArray * insts;
|
||||||
|
uint32_t next[256];
|
||||||
|
bool isMatch;
|
||||||
|
} State;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* dfa builder related func
|
||||||
|
**/
|
||||||
|
typedef struct FstDfaBuilder {
|
||||||
|
FstDfa * dfa;
|
||||||
|
SHashObj *cache;
|
||||||
|
} FstDfaBuilder;
|
||||||
|
|
||||||
|
FstDfaBuilder *dfaBuilderCreate(SArray *insts);
|
||||||
|
|
||||||
|
void dfaBuilderDestroy(FstDfaBuilder *builder);
|
||||||
|
|
||||||
|
FstDfa *dfaBuilderBuild(FstDfaBuilder *builder);
|
||||||
|
|
||||||
|
bool dfaBuilderRunState(FstDfaBuilder *builder, FstSparseSet *cur, FstSparseSet *next, uint32_t state, uint8_t bytes,
|
||||||
|
uint32_t *result);
|
||||||
|
|
||||||
|
bool dfaBuilderCachedState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *result);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* dfa related func
|
||||||
|
**/
|
||||||
|
typedef struct FstDfa {
|
||||||
|
SArray *insts;
|
||||||
|
SArray *states;
|
||||||
|
} FstDfa;
|
||||||
|
|
||||||
|
FstDfa *dfaCreate(SArray *insts, SArray *states);
|
||||||
|
bool dfaIsMatch(FstDfa *dfa, uint32_t si);
|
||||||
|
bool dfaAccept(FstDfa *dfa, uint32_t si, uint8_t byte, uint32_t *result);
|
||||||
|
void dfaAdd(FstDfa *dfa, FstSparseSet *set, uint32_t ip);
|
||||||
|
bool dfaRun(FstDfa *dfa, FstSparseSet *from, FstSparseSet *to, uint8_t byte);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,74 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can use, redistribute, and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License, version 3
|
||||||
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _TD_INDEX_FST_REGEX_H_
|
||||||
|
#define _TD_INDEX_FST_REGEX_H_
|
||||||
|
|
||||||
|
//#include "indexFstDfa.h"
|
||||||
|
#include "taos.h"
|
||||||
|
#include "tarray.h"
|
||||||
|
#include "tchecksum.h"
|
||||||
|
#include "thash.h"
|
||||||
|
#include "tlog.h"
|
||||||
|
#include "tutil.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum { MATCH, JUMP, SPLIT, RANGE } InstType;
|
||||||
|
|
||||||
|
typedef struct MatchValue {
|
||||||
|
} MatchValue;
|
||||||
|
typedef struct JumpValue {
|
||||||
|
uint32_t step;
|
||||||
|
} JumpValue;
|
||||||
|
|
||||||
|
typedef struct SplitValue {
|
||||||
|
uint32_t len1;
|
||||||
|
uint32_t len2;
|
||||||
|
} SplitValue;
|
||||||
|
|
||||||
|
typedef struct RangeValue {
|
||||||
|
uint8_t start;
|
||||||
|
uint8_t end;
|
||||||
|
} RangeValue;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
InstType ty;
|
||||||
|
union {
|
||||||
|
MatchValue mv;
|
||||||
|
JumpValue jv;
|
||||||
|
SplitValue sv;
|
||||||
|
RangeValue rv;
|
||||||
|
};
|
||||||
|
} Inst;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char *orig;
|
||||||
|
void *dfa;
|
||||||
|
} FstRegex;
|
||||||
|
|
||||||
|
FstRegex *regexCreate(const char *str);
|
||||||
|
|
||||||
|
void regexSetup(FstRegex *regex, uint32_t size, const char *str);
|
||||||
|
|
||||||
|
// uint32_t regexStart()
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -13,8 +13,8 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _TD_INDEX_SPARSE_H_
|
#ifndef _TD_INDEX_FST_SPARSE_H_
|
||||||
#define _TD_INDEX_SPARSE_H_
|
#define _TD_INDEX_FST_SPARSE_H_
|
||||||
|
|
||||||
#include "tarray.h"
|
#include "tarray.h"
|
||||||
|
|
|
@ -0,0 +1,218 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can use, redistribute, and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License, version 3
|
||||||
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "indexFstDfa.h"
|
||||||
|
#include "thash.h"
|
||||||
|
|
||||||
|
const static uint32_t STATE_LIMIT = 1000;
|
||||||
|
|
||||||
|
static int dfaInstsEqual(const void *a, const void *b, size_t size) {
|
||||||
|
SArray *ar = (SArray *)a;
|
||||||
|
SArray *br = (SArray *)b;
|
||||||
|
size_t al = ar != NULL ? taosArrayGetSize(ar) : 0;
|
||||||
|
size_t bl = br != NULL ? taosArrayGetSize(br) : 0;
|
||||||
|
if (al != bl) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < al; i++) {
|
||||||
|
uint32_t v1 = *(uint32_t *)taosArrayGet(ar, i);
|
||||||
|
uint32_t v2 = *(uint32_t *)taosArrayGet(br, i);
|
||||||
|
if (v1 != v2) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
FstDfaBuilder *dfaBuilderCreate(SArray *insts) {
|
||||||
|
FstDfaBuilder *builder = taosMemoryCalloc(1, sizeof(FstDfaBuilder));
|
||||||
|
if (builder == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
SArray *states = taosArrayInit(4, sizeof(State));
|
||||||
|
|
||||||
|
builder->dfa = dfaCreate(insts, states);
|
||||||
|
builder->cache = taosHashInit(
|
||||||
|
4, taosGetDefaultHashFunction(POINTER_BYTES == sizeof(int64_t) ? TSDB_DATA_TYPE_BIGINT : TSDB_DATA_TYPE_INT),
|
||||||
|
false, HASH_NO_LOCK);
|
||||||
|
taosHashSetEqualFp(builder->cache, dfaInstsEqual);
|
||||||
|
return builder;
|
||||||
|
}
|
||||||
|
void dfaBuilderDestroy(FstDfaBuilder *builder) {
|
||||||
|
if (builder == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
void *pIter = builder->cache != NULL ? taosHashIterate(builder->cache, NULL) : NULL;
|
||||||
|
while (pIter) {
|
||||||
|
SArray **key = pIter;
|
||||||
|
taosArrayDestroy(*key);
|
||||||
|
pIter = taosHashIterate(builder->cache, pIter);
|
||||||
|
}
|
||||||
|
taosHashCleanup(builder->cache);
|
||||||
|
}
|
||||||
|
|
||||||
|
FstDfa *dfaBuilderBuild(FstDfaBuilder *builder) {
|
||||||
|
uint32_t sz = taosArrayGetSize(builder->dfa->insts);
|
||||||
|
FstSparseSet *cur = sparSetCreate(sz);
|
||||||
|
FstSparseSet *nxt = sparSetCreate(sz);
|
||||||
|
|
||||||
|
dfaAdd(builder->dfa, cur, 0);
|
||||||
|
|
||||||
|
SArray * states = taosArrayInit(0, sizeof(uint32_t));
|
||||||
|
uint32_t result;
|
||||||
|
if (dfaBuilderCachedState(builder, cur, &result)) {
|
||||||
|
taosArrayPush(states, &result);
|
||||||
|
}
|
||||||
|
SHashObj *seen = taosHashInit(12, taosGetDefaultHashFunction(TSDB_DATA_TYPE_INT), false, HASH_NO_LOCK);
|
||||||
|
while (taosArrayGetSize(states) != 0) {
|
||||||
|
result = *(uint32_t *)taosArrayPop(states);
|
||||||
|
for (int i = 0; i < 256; i++) {
|
||||||
|
uint32_t ns, dummpy = 0;
|
||||||
|
if (dfaBuilderRunState(builder, cur, nxt, result, i, &ns)) {
|
||||||
|
if (taosHashGet(seen, &ns, sizeof(ns)) == NULL) {
|
||||||
|
taosHashPut(seen, &ns, sizeof(ns), &dummpy, sizeof(dummpy));
|
||||||
|
taosArrayPush(states, &ns);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (taosArrayGetSize(builder->dfa->states) > STATE_LIMIT) {
|
||||||
|
// Too many state;
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
taosArrayDestroy(states);
|
||||||
|
taosHashCleanup(seen);
|
||||||
|
return builder->dfa;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dfaBuilderRunState(FstDfaBuilder *builder, FstSparseSet *cur, FstSparseSet *next, uint32_t state, uint8_t byte,
|
||||||
|
uint32_t *result) {
|
||||||
|
sparSetClear(cur);
|
||||||
|
State *t = taosArrayGet(builder->dfa->states, state);
|
||||||
|
for (int i = 0; i < taosArrayGetSize(t->insts); i++) {
|
||||||
|
uint32_t ip = *(int32_t *)taosArrayGet(t->insts, i);
|
||||||
|
sparSetAdd(cur, ip);
|
||||||
|
}
|
||||||
|
dfaRun(builder->dfa, cur, next, byte);
|
||||||
|
|
||||||
|
t = taosArrayGet(builder->dfa->states, state);
|
||||||
|
|
||||||
|
uint32_t nxtState;
|
||||||
|
if (dfaBuilderCachedState(builder, next, &nxtState)) {
|
||||||
|
t->next[byte] = nxtState;
|
||||||
|
*result = nxtState;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool dfaBuilderCachedState(FstDfaBuilder *builder, FstSparseSet *set, uint32_t *result) {
|
||||||
|
SArray *tinsts = taosArrayInit(4, sizeof(uint32_t));
|
||||||
|
bool isMatch = false;
|
||||||
|
|
||||||
|
for (int i = 0; i < sparSetLen(set); i++) {
|
||||||
|
uint32_t ip = sparSetGet(set, i);
|
||||||
|
|
||||||
|
Inst *inst = taosArrayGet(builder->dfa->insts, ip);
|
||||||
|
if (inst->ty == JUMP || inst->ty == SPLIT) {
|
||||||
|
continue;
|
||||||
|
} else if (inst->ty == RANGE) {
|
||||||
|
taosArrayPush(tinsts, &ip);
|
||||||
|
} else if (inst->ty == MATCH) {
|
||||||
|
isMatch = true;
|
||||||
|
taosArrayPush(tinsts, &ip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (taosArrayGetSize(tinsts) == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
uint32_t *v = taosHashGet(builder->cache, &tinsts, sizeof(POINTER_BYTES));
|
||||||
|
if (v != NULL) {
|
||||||
|
*result = *v;
|
||||||
|
taosArrayDestroy(tinsts);
|
||||||
|
} else {
|
||||||
|
State st;
|
||||||
|
st.insts = tinsts;
|
||||||
|
st.isMatch = isMatch;
|
||||||
|
taosArrayPush(builder->dfa->states, &st);
|
||||||
|
int32_t sz = taosArrayGetSize(builder->dfa->states) - 1;
|
||||||
|
taosHashPut(builder->cache, &tinsts, sizeof(POINTER_BYTES), &sz, sizeof(sz));
|
||||||
|
*result = sz;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
FstDfa *dfaCreate(SArray *insts, SArray *states) {
|
||||||
|
FstDfa *dfa = taosMemoryCalloc(1, sizeof(FstDfa));
|
||||||
|
if (dfa == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
dfa->insts = insts;
|
||||||
|
dfa->states = states;
|
||||||
|
return dfa;
|
||||||
|
}
|
||||||
|
bool dfaIsMatch(FstDfa *dfa, uint32_t si) {
|
||||||
|
if (dfa->states == NULL || si < taosArrayGetSize(dfa->states)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
State *st = taosArrayGet(dfa->states, si);
|
||||||
|
return st != NULL ? st->isMatch : false;
|
||||||
|
}
|
||||||
|
bool dfaAccept(FstDfa *dfa, uint32_t si, uint8_t byte, uint32_t *result) {
|
||||||
|
if (dfa->states == NULL || si < taosArrayGetSize(dfa->states)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
State *st = taosArrayGet(dfa->states, si);
|
||||||
|
*result = st->next[byte];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
void dfaAdd(FstDfa *dfa, FstSparseSet *set, uint32_t ip) {
|
||||||
|
if (sparSetContains(set, ip)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sparSetAdd(set, ip);
|
||||||
|
Inst *inst = taosArrayGet(dfa->insts, ip);
|
||||||
|
if (inst->ty == MATCH || inst->ty == RANGE) {
|
||||||
|
// do nothing
|
||||||
|
} else if (inst->ty == JUMP) {
|
||||||
|
dfaAdd(dfa, set, inst->jv.step);
|
||||||
|
} else if (inst->ty == SPLIT) {
|
||||||
|
dfaAdd(dfa, set, inst->sv.len1);
|
||||||
|
dfaAdd(dfa, set, inst->sv.len2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bool dfaRun(FstDfa *dfa, FstSparseSet *from, FstSparseSet *to, uint8_t byte) {
|
||||||
|
bool isMatch = false;
|
||||||
|
sparSetClear(to);
|
||||||
|
for (int i = 0; i < sparSetLen(from); i++) {
|
||||||
|
uint32_t ip = sparSetGet(from, i);
|
||||||
|
|
||||||
|
Inst *inst = taosArrayGet(dfa->insts, ip);
|
||||||
|
if (inst->ty == JUMP || inst->ty == SPLIT) {
|
||||||
|
continue;
|
||||||
|
} else if (inst->ty == MATCH) {
|
||||||
|
isMatch = true;
|
||||||
|
} else if (inst->ty == RANGE) {
|
||||||
|
if (inst->rv.start <= byte && byte <= inst->rv.end) {
|
||||||
|
dfaAdd(dfa, to, ip + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return isMatch;
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can use, redistribute, and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License, version 3
|
||||||
|
* or later ("AGPL"), as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "indexFstRegex.h"
|
||||||
|
#include "indexFstSparse.h"
|
||||||
|
|
||||||
|
FstRegex *regexCreate(const char *str) {
|
||||||
|
FstRegex *regex = taosMemoryCalloc(1, sizeof(FstRegex));
|
||||||
|
if (regex == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
int32_t sz = (int32_t)strlen(str);
|
||||||
|
char * orig = taosMemoryCalloc(1, sz);
|
||||||
|
memcpy(orig, str, sz);
|
||||||
|
|
||||||
|
regex->orig = orig;
|
||||||
|
}
|
||||||
|
|
||||||
|
void regexSetup(FstRegex *regex, uint32_t size, const char *str) {
|
||||||
|
// return
|
||||||
|
// return;
|
||||||
|
}
|
|
@ -13,7 +13,7 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "indexSparse.h"
|
#include "indexFstSparse.h"
|
||||||
|
|
||||||
FstSparseSet *sparSetCreate(int32_t sz) {
|
FstSparseSet *sparSetCreate(int32_t sz) {
|
||||||
FstSparseSet *ss = taosMemoryCalloc(1, sizeof(FstSparseSet));
|
FstSparseSet *ss = taosMemoryCalloc(1, sizeof(FstSparseSet));
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
|
#ifdef USE_TD_MEMORY
|
||||||
|
|
||||||
#define TD_MEMORY_SYMBOL ('T'<<24|'A'<<16|'O'<<8|'S')
|
#define TD_MEMORY_SYMBOL ('T'<<24|'A'<<16|'O'<<8|'S')
|
||||||
|
|
||||||
#define TD_MEMORY_STACK_TRACE_DEPTH 10
|
#define TD_MEMORY_STACK_TRACE_DEPTH 10
|
||||||
|
@ -70,6 +72,8 @@ int32_t taosBackTrace(void **buffer, int32_t size) {
|
||||||
// return backtrace_symbols(buffer, *size);
|
// return backtrace_symbols(buffer, *size);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void *taosMemoryMalloc(int32_t size) {
|
void *taosMemoryMalloc(int32_t size) {
|
||||||
#ifdef USE_TD_MEMORY
|
#ifdef USE_TD_MEMORY
|
||||||
void *tmp = malloc(size + sizeof(TdMemoryInfo));
|
void *tmp = malloc(size + sizeof(TdMemoryInfo));
|
||||||
|
@ -126,9 +130,9 @@ void *taosMemoryRealloc(void *ptr, int32_t size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void taosMemoryFree(const void *ptr) {
|
void taosMemoryFree(const void *ptr) {
|
||||||
#ifdef USE_TD_MEMORY
|
|
||||||
if (ptr == NULL) return;
|
if (ptr == NULL) return;
|
||||||
|
|
||||||
|
#ifdef USE_TD_MEMORY
|
||||||
TdMemoryInfoPtr pTdMemoryInfo = (TdMemoryInfoPtr)((char*)ptr - sizeof(TdMemoryInfo));
|
TdMemoryInfoPtr pTdMemoryInfo = (TdMemoryInfoPtr)((char*)ptr - sizeof(TdMemoryInfo));
|
||||||
if(pTdMemoryInfo->symbol == TD_MEMORY_SYMBOL) {
|
if(pTdMemoryInfo->symbol == TD_MEMORY_SYMBOL) {
|
||||||
pTdMemoryInfo->memorySize = 0;
|
pTdMemoryInfo->memorySize = 0;
|
||||||
|
@ -143,9 +147,9 @@ void taosMemoryFree(const void *ptr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t taosMemorySize(void *ptr) {
|
int32_t taosMemorySize(void *ptr) {
|
||||||
#ifdef USE_TD_MEMORY
|
|
||||||
if (ptr == NULL) return 0;
|
if (ptr == NULL) return 0;
|
||||||
|
|
||||||
|
#ifdef USE_TD_MEMORY
|
||||||
TdMemoryInfoPtr pTdMemoryInfo = (TdMemoryInfoPtr)((char*)ptr - sizeof(TdMemoryInfo));
|
TdMemoryInfoPtr pTdMemoryInfo = (TdMemoryInfoPtr)((char*)ptr - sizeof(TdMemoryInfo));
|
||||||
assert(pTdMemoryInfo->symbol == TD_MEMORY_SYMBOL);
|
assert(pTdMemoryInfo->symbol == TD_MEMORY_SYMBOL);
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,10 @@ class TDSql:
|
||||||
def prepare(self):
|
def prepare(self):
|
||||||
tdLog.info("prepare database:db")
|
tdLog.info("prepare database:db")
|
||||||
s = 'reset query cache'
|
s = 'reset query cache'
|
||||||
self.cursor.execute(s)
|
try:
|
||||||
|
self.cursor.execute(s)
|
||||||
|
except:
|
||||||
|
tdLog.notice("'reset query cache' is not supported")
|
||||||
s = 'drop database if exists db'
|
s = 'drop database if exists db'
|
||||||
self.cursor.execute(s)
|
self.cursor.execute(s)
|
||||||
s = 'create database db'
|
s = 'create database db'
|
||||||
|
@ -341,4 +344,4 @@ class TDSql:
|
||||||
tdLog.info("dir: %s is created" %dir)
|
tdLog.info("dir: %s is created" %dir)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
tdSql = TDSql()
|
tdSql = TDSql()
|
||||||
|
|
|
@ -0,0 +1,140 @@
|
||||||
|
#### abs, log, pow, sqrt, sin, cos, tan, asin, acos, atan, ceil, floor, round
|
||||||
|
|
||||||
|
system sh/stop_dnodes.sh
|
||||||
|
system sh/deploy.sh -n dnode1 -i 1
|
||||||
|
system sh/cfg.sh -n dnode1
|
||||||
|
system sh/exec.sh -n dnode1 -s start
|
||||||
|
|
||||||
|
$loop_cnt = 0
|
||||||
|
check_dnode_ready:
|
||||||
|
$loop_cnt = $loop_cnt + 1
|
||||||
|
sleep 200
|
||||||
|
if $loop_cnt == 10 then
|
||||||
|
print ====> dnode not ready!
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
sql show dnodes
|
||||||
|
print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05
|
||||||
|
if $data00 != 1 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
if $data04 != ready then
|
||||||
|
goto check_dnode_ready
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql connect
|
||||||
|
|
||||||
|
$vgroups = 4
|
||||||
|
$dbNamme = d0
|
||||||
|
|
||||||
|
print =============== create database $dbNamme vgroups $vgroups
|
||||||
|
sql create database $dbNamme vgroups $vgroups
|
||||||
|
sql show databases
|
||||||
|
print $data00 $data01 $data02 $data03 $data04 $data05 $data06 $data07 $data08 $data09
|
||||||
|
print $data10 $data11 $data12 $data13 $data14 $data15 $data16 $data17 $data18 $data19
|
||||||
|
#print $data20 $data21 $data22 $data23 $data24 $data25 $data26 $data27 $data28 $data29
|
||||||
|
|
||||||
|
sql use $dbNamme
|
||||||
|
|
||||||
|
print =============== create super table
|
||||||
|
sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int)
|
||||||
|
|
||||||
|
print =============== create child table
|
||||||
|
$tbPrefix = ct
|
||||||
|
$tbNum = 2
|
||||||
|
|
||||||
|
$i = 0
|
||||||
|
while $i < $tbNum
|
||||||
|
$tb = $tbPrefix . $i
|
||||||
|
sql create table $tb using stb tags( $i )
|
||||||
|
$i = $i + 1
|
||||||
|
endw
|
||||||
|
|
||||||
|
print =============== create normal table
|
||||||
|
sql create table ntb (ts timestamp, c1 int, c2 float, c3 double)
|
||||||
|
|
||||||
|
sql show tables
|
||||||
|
if $rows != 3 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print =============== insert data
|
||||||
|
$rowNum = 20
|
||||||
|
$tstart = 1640966400000 # 2022-01-01 00:00:00.000
|
||||||
|
|
||||||
|
$i = 0
|
||||||
|
while $i < $tbNum
|
||||||
|
$tb = $tbPrefix . $i
|
||||||
|
|
||||||
|
$x = 0
|
||||||
|
$c1 = 0
|
||||||
|
while $x < $rowNum
|
||||||
|
$c2 = 0 - $c1
|
||||||
|
$c3 = $c1 + 100
|
||||||
|
|
||||||
|
sql insert into $tb values ($tstart , $c1 , $c2 , $c3 )
|
||||||
|
sql insert into ntb values ($tstart , $c1 , $c2 , $c3 )
|
||||||
|
$tstart = $tstart + 1
|
||||||
|
$c1 = $c1 + 5
|
||||||
|
$x = $x + 1
|
||||||
|
endw
|
||||||
|
|
||||||
|
$i = $i + 1
|
||||||
|
$tstart = 1640966400000
|
||||||
|
endw
|
||||||
|
|
||||||
|
print ====> abs
|
||||||
|
sql select c1, abs(c1), c2, abs(c2), c3, abs(c3) from ct1
|
||||||
|
print ====> select c1, abs(c1), c2, abs(c2), c3, abs(c3) from ct1
|
||||||
|
print ====> rows: $rows
|
||||||
|
print ====> $data00 $data01 $data02 $data03 $data04 $data05
|
||||||
|
print ====> $data10 $data11 $data12 $data13 $data14 $data15
|
||||||
|
print ====> $data20 $data21 $data22 $data23 $data24 $data25
|
||||||
|
print ====> $data30 $data31 $data32 $data33 $data34 $data35
|
||||||
|
print ====> $data40 $data41 $data42 $data43 $data44 $data45
|
||||||
|
print ====> $data50 $data51 $data52 $data53 $data54 $data55
|
||||||
|
print ====> $data60 $data61 $data62 $data63 $data64 $data65
|
||||||
|
print ====> $data70 $data71 $data72 $data73 $data74 $data75
|
||||||
|
print ====> $data80 $data81 $data82 $data83 $data84 $data85
|
||||||
|
print ====> $data90 $data91 $data92 $data93 $data94 $data95
|
||||||
|
if $rows != 10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print ====> sin
|
||||||
|
sql select c1, sin(c1), c2, sin(c2), c3, sin(c3) from ct1
|
||||||
|
print ====> select c1, sin(c1), c2, sin(c2), c3, sin(c3) from ct1
|
||||||
|
print ====> rows: $rows
|
||||||
|
print ====> $data00 $data01 $data02 $data03 $data04 $data05
|
||||||
|
print ====> $data10 $data11 $data12 $data13 $data14 $data15
|
||||||
|
print ====> $data20 $data21 $data22 $data23 $data24 $data25
|
||||||
|
print ====> $data30 $data31 $data32 $data33 $data34 $data35
|
||||||
|
print ====> $data40 $data41 $data42 $data43 $data44 $data45
|
||||||
|
print ====> $data50 $data51 $data52 $data53 $data54 $data55
|
||||||
|
print ====> $data60 $data61 $data62 $data63 $data64 $data65
|
||||||
|
print ====> $data70 $data71 $data72 $data73 $data74 $data75
|
||||||
|
print ====> $data80 $data81 $data82 $data83 $data84 $data85
|
||||||
|
print ====> $data90 $data91 $data92 $data93 $data94 $data95
|
||||||
|
if $rows != 10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print ====> cos
|
||||||
|
sql select c1, cos(c1), c2, cos(c2), c3, cos(c3) from ct1
|
||||||
|
print ====> select c1, cos(c1), c2, cos(c2), c3, cos(c3) from ct1
|
||||||
|
print ====> rows: $rows
|
||||||
|
print ====> $data00 $data01 $data02 $data03 $data04 $data05
|
||||||
|
print ====> $data10 $data11 $data12 $data13 $data14 $data15
|
||||||
|
print ====> $data20 $data21 $data22 $data23 $data24 $data25
|
||||||
|
print ====> $data30 $data31 $data32 $data33 $data34 $data35
|
||||||
|
print ====> $data40 $data41 $data42 $data43 $data44 $data45
|
||||||
|
print ====> $data50 $data51 $data52 $data53 $data54 $data55
|
||||||
|
print ====> $data60 $data61 $data62 $data63 $data64 $data65
|
||||||
|
print ====> $data70 $data71 $data72 $data73 $data74 $data75
|
||||||
|
print ====> $data80 $data81 $data82 $data83 $data84 $data85
|
||||||
|
print ====> $data90 $data91 $data92 $data93 $data94 $data95
|
||||||
|
if $rows != 10 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
|
|
@ -226,7 +226,7 @@ void loop_consume(tmq_t* tmq) {
|
||||||
int32_t totalRows = 0;
|
int32_t totalRows = 0;
|
||||||
int32_t skipLogNum = 0;
|
int32_t skipLogNum = 0;
|
||||||
while (running) {
|
while (running) {
|
||||||
tmq_message_t* tmqMsg = tmq_consumer_poll(tmq, 3000);
|
tmq_message_t* tmqMsg = tmq_consumer_poll(tmq, 6000);
|
||||||
if (tmqMsg) {
|
if (tmqMsg) {
|
||||||
totalMsgs++;
|
totalMsgs++;
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit f36b07f710d661dca88fdd70e73b5e3e16a960e0
|
Subproject commit 33cdfe4f90a209f105c1b6091439798a9cde1e93
|
Loading…
Reference in New Issue