提交 de7b632a 编写于 作者: P Ping Xiao

Merge branch 'develop' into coverity_scan

...@@ -14,12 +14,9 @@ ...@@ -14,12 +14,9 @@
# local fully qualified domain name (FQDN) # local fully qualified domain name (FQDN)
# fqdn hostname # fqdn hostname
# first port number for the connection (10 continuous UDP/TCP port number are used) # first port number for the connection (12 continuous UDP/TCP port number are used)
# serverPort 6030 # serverPort 6030
# http service port, default tcp [6041]
# httpPort 6041
# log file's directory # log file's directory
# logDir /var/log/taos # logDir /var/log/taos
......
<svg xmlns="http://www.w3.org/2000/svg" role="img" viewBox="-5.86 -5.86 304.72 93.47"><title>TDengine logo</title><g data-name="图层 2"><path fill="#718cc7" fill-rule="evenodd" d="M288.45 43.86q0 2.49-3 4.52-1.49 1-4.18 2.76A7.12 7.12 0 0 1 278 52h-20c-.72 0-1.28-.48-1.69-1.42a3.61 3.61 0 0 1-.13-1.35 5.64 5.64 0 0 1 .1-1.31A2.17 2.17 0 0 1 257 47a1.7 1.7 0 0 1 1-.54h16.77a5 5 0 0 0 3.2-1.55 6 6 0 0 0 2-3.16c.05-.36.07-1.37.07-3s0-2.76-.07-3a6.31 6.31 0 0 0-2.09-3.2 4.9 4.9 0 0 0-3.16-1.52h-8.02a8.39 8.39 0 0 1-4.18-1.35q-.4-.27-4.31-3a6 6 0 0 1-1.08-1.07 4.2 4.2 0 0 1-.94-2.63v-9q0-2.49 3.1-4.51c1.07-.76 2.47-1.68 4.17-2.76a7.43 7.43 0 0 1 3.37-.81h19.67a2.07 2.07 0 0 1 1.88 1.42 6.38 6.38 0 0 1 .07 1.34 5.63 5.63 0 0 1-.1 1.28 2.22 2.22 0 0 1-.67 1 1.64 1.64 0 0 1-1.05.54h-16.7a5.08 5.08 0 0 0-3.3 1.58 5.3 5.3 0 0 0-1.95 2.94 18.73 18.73 0 0 0-.14 3 16 16 0 0 0 .2 3.37 6.84 6.84 0 0 0 2.12 2.93 4.89 4.89 0 0 0 3.07 1.45H278a8.15 8.15 0 0 1 4.18 1.41q.4.2 4.24 3a4 4 0 0 1 1.68 2.06 6.18 6.18 0 0 1 .34 1.65v9zM42.62 0A5.58 5.58 0 1 1 37 5.58 5.59 5.59 0 0 1 42.62 0zm-37 26.81A5.58 5.58 0 1 1 0 32.39a5.58 5.58 0 0 1 5.58-5.58zm14.5 43.62A5.58 5.58 0 1 1 14.5 76a5.6 5.6 0 0 1 5.58-5.58zm45.09 0A5.58 5.58 0 1 1 59.59 76a5.59 5.59 0 0 1 5.58-5.58zM50.8 33.23H34.44l-5 15.56 13.19 9.61 13.21-9.6-5-15.57zM34.87 31.9l5.73-17.64a7.4 7.4 0 0 1-1.26-.4l-5.86 18h-19v1.33h18.57L28.26 48 13.19 37a8.31 8.31 0 0 1-.77 1.07l12.81 9.33 2.6 1.89-.83 2.48-5 15.53a7.76 7.76 0 0 1 1.27.38L29 50.1l12.5 9.12L26.66 70a10.12 10.12 0 0 1 .82 1l15.15-11 15.14 11a8.15 8.15 0 0 1 .82-1L43.75 59.22l12.52-9.1.54 1.67L62 67.67a8.85 8.85 0 0 1 1.27-.37l-5.85-18L60 47.42l12.83-9.32a10 10 0 0 1-.77-1.1l-12.47 9-.35.26L57 48l-4.82-14.77h18.61a8.06 8.06 0 0 1 0-.85v-.47h-19l-5.85-18a7.4 7.4 0 0 1-1.26.4l5.73 17.65zm-22.28-5l22.59-16.43a8.16 8.16 0 0 0 .81 1L13.33 28a8.46 8.46 0 0 0-.74-1.1zm4.07 40.88L8 41a8.72 8.72 0 0 0 1.24-.45l8.72 26.83a10.9 10.9 0 0 0-1.26.41zm39.6 8.6H29v-.36a7.89 7.89 0 0 0-.06-1H56.3V76.38zM77.29 41l-8.71 26.8a8.74 8.74 0 0 0-1.25-.42L76 40.53a8.84 8.84 0 0 0 1.25.45zM50.07 10.47l22.59 16.42a9.08 9.08 0 0 0-.74 1.11L49.26 11.52a10.46 10.46 0 0 0 .81-1zm29.6 16.34a5.58 5.58 0 1 1-5.58 5.58 5.58 5.58 0 0 1 5.58-5.58zM290.07 45V33.69a5.15 5.15 0 0 0-.37-1.48 3.06 3.06 0 0 0-.64-1.21c-1.4-1.08-2.81-2.16-4.25-3.23-2.47-1.75-4.37-2.63-5.72-2.63h-8.76a4.11 4.11 0 0 1-1.08-.24 5 5 0 0 1-1.85-1.41 3.29 3.29 0 0 1-1.11-1.92c-.09-1.57-.13-2.43-.13-2.56a14.37 14.37 0 0 1 .13-2.56 4.42 4.42 0 0 1 1.55-2.36 3.94 3.94 0 0 1 2.49-1.21h17.51a1.86 1.86 0 0 0 2-1.41 12.22 12.22 0 0 0 .21-3c0-2.15-.18-3.42-.54-3.8a2.43 2.43 0 0 0-1.82-.57h-22c-1.48 0-3.34.8-5.59 2.42-1.16.81-2.6 1.86-4.31 3.17a3.73 3.73 0 0 0-1.21 3V24a3.78 3.78 0 0 0 .94 2.7 43.57 43.57 0 0 0 3.64 2.76q4.3 3.11 6.33 3.1h8.82q2 0 3.91 3a2.31 2.31 0 0 1 .13.54 17.07 17.07 0 0 1 .14 2.56 18.92 18.92 0 0 1-.14 2.52 4.44 4.44 0 0 1-1.34 2.26 4.06 4.06 0 0 1-2.7 1.35h-17.52a1.91 1.91 0 0 0-1.68.6 9.3 9.3 0 0 0-.47 3.77 9 9 0 0 0 .44 3.71 1.89 1.89 0 0 0 1.71.67h22.3q2.09 0 6-2.76l3.76-2.78a3.75 3.75 0 0 0 1.22-3zm1.93 1V32.75a4.26 4.26 0 0 0-1.41-3.17c-1.8-1.48-3.19-2.55-4.18-3.23-2.83-2.06-4.94-3.1-6.33-3.1h-8.82a3.25 3.25 0 0 1-1.92-.77 2.69 2.69 0 0 1-1.18-1.85c-.05-.54-.07-1.08-.07-1.62a15.09 15.09 0 0 1 .07-1.62 2.81 2.81 0 0 1 1.28-1.88 2.94 2.94 0 0 1 1.82-.68h17.51a3 3 0 0 0 2.22-1 3.09 3.09 0 0 0 1-2.12V5.34a2.77 2.77 0 0 0-1.08-2.19 3.48 3.48 0 0 0-2.29-.91h-23.88a6.16 6.16 0 0 0-3.1.81c-2.15 1.39-3.72 2.45-4.71 3.16-2.83 1.93-4.24 3.78-4.24 5.53v13.2a4.24 4.24 0 0 0 1.41 3.16q3.11 2.56 4.72 3.64c2.46 1.8 4.4 2.69 5.79 2.69h8.82a3.21 3.21 0 0 1 1.95.78A2.57 2.57 0 0 1 276.5 37c.06.69.1 1.24.1 1.65a9.73 9.73 0 0 1-.14 1.61 2.58 2.58 0 0 1-1.14 1.86 3.38 3.38 0 0 1-1.89.7h-17.58a3 3 0 0 0-2.19 1 3.16 3.16 0 0 0-1 2.23v6.19a3.34 3.34 0 0 0 3.16 3.17h24.28a9 9 0 0 0 1.55-.2 11 11 0 0 0 3.16-1.62c1-.72 2-1.44 2.9-2.16Q292 48.65 292 46zm-64.91-6.2V17.93a3 3 0 0 0-.78-1.88 3.1 3.1 0 0 0-1.85-1.15c-.4 0-.94-.07-1.62-.07s-1.19 0-1.68.07a2.94 2.94 0 0 0-1.82 1.18 3.21 3.21 0 0 0-.74 1.92v21.69a3.15 3.15 0 0 0 .74 2 3 3 0 0 0 1.82 1.15q.54.06 1.68.06a16 16 0 0 0 1.62-.06 3.16 3.16 0 0 0 2-1.28 3.36 3.36 0 0 0 .61-1.76zm1.95 1a3.91 3.91 0 0 1-1.28 2.46 4.76 4.76 0 0 1-2.29 1.58c-.49 0-1.37.07-2.63.07-1 0-1.86 0-2.62-.07a3.76 3.76 0 0 1-1.89-1.11 5.13 5.13 0 0 1-1.41-1.79 3.6 3.6 0 0 1-.27-1.14V17a3.93 3.93 0 0 1 1.35-2.5 3.92 3.92 0 0 1 2.24-1.5c.94-.09 1.82-.14 2.62-.14a12.54 12.54 0 0 1 2.63.14 5.71 5.71 0 0 1 2.42 1.61 3.52 3.52 0 0 1 1.15 2.39v23.7zm1.55.4a5.11 5.11 0 0 1-1.79 3.37c-1.19 1.21-2.14 1.82-2.86 1.82l-1.65.06-1.45.07a19 19 0 0 1-3.43-.2 6.46 6.46 0 0 1-3-2.22 4.59 4.59 0 0 1-1.35-2.9V16.65a4.92 4.92 0 0 1 1.75-3.36 5.23 5.23 0 0 1 3-1.89 22 22 0 0 1 3.09-.13 17.61 17.61 0 0 1 3.44.2 5.91 5.91 0 0 1 2.83 2 5 5 0 0 1 1.48 3.07V41.1zm8.41 2.66q0 2.49-3 4.52-1.49 1-4.18 2.76a7.12 7.12 0 0 1-3.23.81h-12.66q-3.7 0-8-4.85a4.43 4.43 0 0 1-1.21-3.17V13.82q0-2.49 3.1-4.51c1.07-.76 2.47-1.68 4.17-2.76a7.43 7.43 0 0 1 3.37-.81h11A9 9 0 0 1 233 7.29a42.19 42.19 0 0 1 4.72 3.5 3.73 3.73 0 0 1 1.21 3v30zm1.58 1.14a3.75 3.75 0 0 1-1.22 3l-3.77 2.83q-3.9 2.76-6 2.76h-14.81a7 7 0 0 1-3.84-1.48q-.87-.6-4-3.3a4.7 4.7 0 0 1-.74-.81 5 5 0 0 1-1-2.89V12.68a3.73 3.73 0 0 1 1.21-3c1.71-1.31 3.15-2.36 4.31-3.17 2.25-1.62 4.11-2.42 5.59-2.42h13.2a9.52 9.52 0 0 1 5.12 2c.32.22 1.91 1.44 4.78 3.64a3.46 3.46 0 0 1 .78 1.31 4.71 4.71 0 0 1 .44 1.65V45zm1.95.94q0 2.7-4.31 5.52c-.94.72-1.91 1.44-2.9 2.16a11 11 0 0 1-3.16 1.62 9 9 0 0 1-1.55.2h-16.77q-3.84 0-9.57-6.47a4.33 4.33 0 0 1-1.07-3V11.74c0-1.75 1.41-3.6 4.24-5.53 1-.71 2.56-1.77 4.71-3.16a6.16 6.16 0 0 1 3.1-.81h15.16q2.49 0 6.13 2.76a42.2 42.2 0 0 1 4.71 3.71 4.81 4.81 0 0 1 1.28 3V46zM177.62 19c0-2.78-1.42-4.18-4.25-4.18s-4.24 1.4-4.24 4.18 1.41 4.24 4.24 4.24 4.25-1.41 4.25-4.24zm1.95 0a10 10 0 0 1-.3 3.17 7 7 0 0 1-1.42 1.75 3.47 3.47 0 0 1-1.85 1.15c-.81.05-1.68.07-2.63.07a14 14 0 0 1-3-.2 5.18 5.18 0 0 1-1.89-1.42 3.33 3.33 0 0 1-1.18-1.95c-.09-1.35-.13-2.2-.13-2.56a13.39 13.39 0 0 1 .2-3 4.75 4.75 0 0 1 1.41-1.89 3.36 3.36 0 0 1 2-1.14c1.39-.09 2.26-.14 2.62-.14a14.25 14.25 0 0 1 3 .2 5 5 0 0 1 1.88 1.38 3.72 3.72 0 0 1 1.22 2 24.55 24.55 0 0 1 .13 2.56zm1.55 0a14.45 14.45 0 0 1-.34 3.91 7 7 0 0 1-3.5 3.5 12.62 12.62 0 0 1-3.91.34 14.83 14.83 0 0 1-3.43-.21 6.39 6.39 0 0 1-2.7-1.81A5.33 5.33 0 0 1 165.7 22a19.12 19.12 0 0 1-.14-3 17.27 17.27 0 0 1 .2-3.37 6.07 6.07 0 0 1 1.85-2.63 4.82 4.82 0 0 1 2.66-1.58c1-.09 2-.13 3.1-.13a17.61 17.61 0 0 1 3.44.2 6.35 6.35 0 0 1 2.66 1.82 4.92 4.92 0 0 1 1.58 2.69c0 .58.07 1.59.07 3zm8.35 31.12a1.76 1.76 0 0 1-1.35 1.75c-.22 0-1.16.07-2.83.07-1.48 0-2.36 0-2.66-.07a1.81 1.81 0 0 1-1-.71 1.84 1.84 0 0 1-.54-1V36.25a5 5 0 0 0-1.52-3.2 5.5 5.5 0 0 0-3.13-2 19.89 19.89 0 0 0-3.1-.14c-1.39 0-2.42 0-3.1.1a4.09 4.09 0 0 0-2.22 1.25q-2.49 2.22-2.49 4v13.87a1.93 1.93 0 0 1-.44 1 1.53 1.53 0 0 1-.91.74 19.92 19.92 0 0 1-2.83.11c-1.48 0-2.36 0-2.66-.07a1.81 1.81 0 0 1-1-.71 1.84 1.84 0 0 1-.54-1V16.38q0-2.35 2.42-5 1.89-1.89 3.78-3.7c.09-.09.44-.36 1.07-.81a5.84 5.84 0 0 1 3.57-1.15h10.64a7 7 0 0 1 4.58 2c.54.44 2.09 2 4.65 4.71a5.69 5.69 0 0 1 1.55 4v33.7zm1.62 1.21a2.81 2.81 0 0 1-.44 1.55 2 2 0 0 1-1.79.67h-7.13a2.47 2.47 0 0 1-1.55-.47 2.09 2.09 0 0 1-.61-1.75V36.66a3.8 3.8 0 0 0-1.38-2.66 4.19 4.19 0 0 0-2.26-1.41c-.94 0-1.79-.07-2.56-.07a16 16 0 0 0-3 .2 4.23 4.23 0 0 0-1.65 1.14 5.52 5.52 0 0 0-1.31 1.69 3.11 3.11 0 0 0-.27 1.08v14.71a2.81 2.81 0 0 1-.44 1.55 2 2 0 0 1-1.79.67h-7.14a2.46 2.46 0 0 1-1.54-.47 2.09 2.09 0 0 1-.61-1.75v-36.1a5.21 5.21 0 0 1 .81-2.7 8.46 8.46 0 0 1 .81-1.07Q159.64 9 162 6.55c1.8-1.62 3.44-2.42 4.92-2.42h12.93a6.79 6.79 0 0 1 4.38 2l4.58 4.58 1.14 1.34a4.89 4.89 0 0 1 1.15 3.17v36.1zm1.95 1a3 3 0 0 1-1 2.09 3.09 3.09 0 0 1-2.22 1h-9a3.07 3.07 0 0 1-2.15-1 3 3 0 0 1-1-2.19V37.67a3.21 3.21 0 0 0-.74-1.92 3 3 0 0 0-1.93-1.18 7.65 7.65 0 0 0-1.62-.14 14.71 14.71 0 0 0-1.68.14 2.64 2.64 0 0 0-1.82 1.11 3.21 3.21 0 0 0-.74 1.92v14.75a3 3 0 0 1-1 2.09 3.09 3.09 0 0 1-2.22 1h-9a3.34 3.34 0 0 1-3.16-3.17v-38a5.21 5.21 0 0 1 .81-2.7c.17-.27.44-.65.8-1.14 1.75-1.75 3.51-3.53 5.26-5.32q3-2.89 5.38-2.9h14.82a5.42 5.42 0 0 1 4 1.62l5.11 5Q193 12.28 193 14.3v38.05zM141.8 8.5a5.63 5.63 0 0 1-.1 1.28 2.17 2.17 0 0 1-.68 1 1.62 1.62 0 0 1-1 .54h-5.39a5.15 5.15 0 0 0-3.53 1.88 5.25 5.25 0 0 0-1.86 3.44v33.49a2 2 0 0 1-.43 1 1.61 1.61 0 0 1-.88.74 12.82 12.82 0 0 1-2.19.11 19.35 19.35 0 0 1-2.09-.07 1.86 1.86 0 0 1-.94-.68 1.72 1.72 0 0 1-.54-1.07V16.65a5.19 5.19 0 0 0-1.88-3.53 5.25 5.25 0 0 0-3.44-1.85h-5.45c-.72 0-1.28-.45-1.69-1.35a4.32 4.32 0 0 1-.13-1.42 3.58 3.58 0 0 1 .13-1.34 2.17 2.17 0 0 1 1.89-1.42h28.29a2.08 2.08 0 0 1 1.88 1.42 6.38 6.38 0 0 1 .07 1.34zm1.62 0c0-2.15-.18-3.42-.54-3.8a2.43 2.43 0 0 0-1.82-.57h-30.71a2.09 2.09 0 0 0-2.23 1.41 18.24 18.24 0 0 0-.13 3c0 2 .14 3.26.44 3.71a1.89 1.89 0 0 0 1.71.67h6.27a2.73 2.73 0 0 1 1.61.47q2.57 1.89 2.56 3.64v34.31a2.12 2.12 0 0 0 .61 1.75 2.47 2.47 0 0 0 1.55.47h5.86a2 2 0 0 0 1.78-.67 2.81 2.81 0 0 0 .44-1.55V17a4.19 4.19 0 0 1 1.38-2.63 3.93 3.93 0 0 1 2.8-1.48h6.19a1.87 1.87 0 0 0 2-1.41 12.22 12.22 0 0 0 .21-3zM287.72 76l-2.93-5.6a.52.52 0 0 0-.5-.3.54.54 0 0 0-.51.3l-3 5.6a.58.58 0 0 0 0 .62.62.62 0 0 0 .55.31h5.83a.62.62 0 0 0 .54-.31.56.56 0 0 0 0-.62zm5.46 6h-2.26c-.11-.19-.54-1-1.3-2.45a1.35 1.35 0 0 0-1.27-.79h-8.15a1.36 1.36 0 0 0-1.29.79L277.66 82h-2.28l7.49-14.15h2.81q.26.45 7.5 14.15zM240 69.7h-6.1a.94.94 0 0 0-1 .93V82h-1.82V70.63a.94.94 0 0 0-.93-.93h-6.08v-1.84H240v1.84zM183.28 76l-2.93-5.6a.52.52 0 0 0-.5-.3.54.54 0 0 0-.51.3l-3 5.6a.58.58 0 0 0 0 .62.61.61 0 0 0 .55.31h5.83a.62.62 0 0 0 .54-.31.58.58 0 0 0 0-.62zm5.46 6h-2.26c-.11-.19-.54-1-1.3-2.45a1.35 1.35 0 0 0-1.27-.79h-8.15a1.36 1.36 0 0 0-1.29.79L173.22 82h-2.28l7.49-14.15h2.81l7.5 14.15zm-55-7a5 5 0 0 0-1.56-3.85 5.61 5.61 0 0 0-4-1.45h-6.38a.91.91 0 0 0-.66.28 1 1 0 0 0-.27.67v8.63a.94.94 0 0 0 .27.68.9.9 0 0 0 .66.27h6.89a5 5 0 0 0 3.66-1.44 5.14 5.14 0 0 0 1.43-3.79zm1.8.06a6.46 6.46 0 0 1-2.29 5.09A7.66 7.66 0 0 1 128 82h-9V67.88h8.51a8.41 8.41 0 0 1 5.85 2 6.71 6.71 0 0 1 2.15 5.2zm9.79-63.37V5.34a2.77 2.77 0 0 0-1.08-2.19 3.48 3.48 0 0 0-2.25-.91h-32.6a3.44 3.44 0 0 0-2.32.91 2.87 2.87 0 0 0-1 2.26v6.19a3.12 3.12 0 0 0 1 2.22 3 3 0 0 0 2.19 1h6.26a3.12 3.12 0 0 1 2.16.95 3 3 0 0 1 1 2.22v34.29a3 3 0 0 0 1 2.19 3.15 3.15 0 0 0 2.13 1h7.74a3.09 3.09 0 0 0 2.22-1 3 3 0 0 0 1-2.09V17.93a3.31 3.31 0 0 1 3.17-3.1h6.2a3 3 0 0 0 2.22-1 3.09 3.09 0 0 0 1-2.16z" data-name="图层 1"/></g></svg>
\ No newline at end of file
#!/bin/sh
if [ ! -d /var/lib/taos ]; then
mkdir -p /var/lib/taos
fi
if [ ! -d /var/log/taos ]; then
mkdir -p -m777 /var/log/taos
fi
if [ ! -d /etc/taos ]; then
mkdir -p /etc/taos
fi
if [ ! -f /etc/taos/taos.cfg ]; then
cp $SNAP/etc/taos/taos.cfg /etc/taos/taos.cfg
fi
#!/bin/sh
# Wrapper to check for custom config in $SNAP_USER_COMMON or $SNAP_COMMON and
# use it otherwise fall back to the included basic config which will at least
# allow mosquitto to run and do something.
# This script will also copy the full example config in to SNAP_USER_COMMON or
# SNAP_COMMON so that people can refer to it.
#
# The decision about whether to use SNAP_USER_COMMON or SNAP_COMMON is taken
# based on the user that runs the command. If the user is root, it is assumed
# that mosquitto is being run as a system daemon, and SNAP_COMMON will be used.
# If a non-root user runs the command, then SNAP_USER_COMMON will be used.
case "$SNAP_USER_COMMON" in
*/root/snap/tdengine/common*) COMMON=$SNAP_COMMON ;;
*) COMMON=$SNAP_USER_COMMON ;;
esac
if [ -d /etc/taos ]; then
CONFIG_FILE="/etc/taos"
else
CONFIG_FILE="$SNAP/etc/taos"
fi
# Launch the snap
$SNAP/usr/bin/taosd -c $CONFIG_FILE $@
#!/bin/sh
# Wrapper to check for custom config in $SNAP_USER_COMMON or $SNAP_COMMON and
# use it otherwise fall back to the included basic config which will at least
# allow mosquitto to run and do something.
# This script will also copy the full example config in to SNAP_USER_COMMON or
# SNAP_COMMON so that people can refer to it.
#
# The decision about whether to use SNAP_USER_COMMON or SNAP_COMMON is taken
# based on the user that runs the command. If the user is root, it is assumed
# that mosquitto is being run as a system daemon, and SNAP_COMMON will be used.
# If a non-root user runs the command, then SNAP_USER_COMMON will be used.
case "$SNAP_USER_COMMON" in
*/root/snap/tdengine/common*) COMMON=$SNAP_COMMON ;;
*) COMMON=$SNAP_USER_COMMON ;;
esac
if [ -d /etc/taos ]; then
CONFIG_FILE="/etc/taos"
else
CONFIG_FILE="$SNAP/etc/taos"
fi
# Launch the snap
$SNAP/usr/bin/taos -c $CONFIG_FILE $@
name: tdengine
base: core18 # the base snap is the execution environment for this snap
version: '2.0.0.6' # just for humans, typically '1.2+git' or '1.3.2'
icon: snap/gui/t-dengine.svg
summary: an open-source big data platform designed and optimized for IoT.
description: |
TDengine is an open-source big data platform designed and optimized for Internet of Things (IoT), Connected Vehicles, and Industrial IoT. Besides the 10x faster time-series database, it provides caching, stream computing, message queuing and other functionalities to reduce the complexity and costs of development and operations.
grade: stable
confinement: classic
apps:
tdengine:
command: launcher.sh
daemon: simple
restart-condition: always
plugs:
- network
- network-bind
- system-observe
- systemfiles
taos:
command: taoswrapper.sh
plugs:
- network
- systemfiles
taosdemo:
command: usr/bin/taosdemo
plugs:
- network
plugs:
systemfiles:
interface: system-files
read:
- /etc/taos
- /var/lib/taos
- /tmp
write:
- /var/log/taos
- /var/lib/taos
- /tmp
parts:
script:
plugin: dump
source: snap/local/
prime:
- launcher.sh
- taoswrapper.sh
tdengine:
source: .
source-type: local
plugin: cmake
build-packages:
- gcc
- g++
- make
- cmake
override-build: |
snapcraftctl build
if [ ! -d $SNAPCRAFT_STAGE/usr ]; then
mkdir $SNAPCRAFT_STAGE/usr
fi
if [ ! -d $SNAPCRAFT_STAGE/etc/taos ]; then
mkdir -p $SNAPCRAFT_STAGE/etc/taos
fi
cp $SNAPCRAFT_PART_BUILD/build/* -rf $SNAPCRAFT_STAGE/usr/
cp $SNAPCRAFT_PART_SRC/packaging/cfg/taos.cfg -rf $SNAPCRAFT_STAGE/etc/taos/
if [ ! -d $SNAPCRAFT_STAGE/var/lib/taos ]; then
mkdir -p $SNAPCRAFT_STAGE/var/lib/taos
fi
if [ ! -d $SNAPCRAFT_STAGE/var/log/taos ]; then
mkdir -p $SNAPCRAFT_STAGE/var/log/taos
fi
prime:
- etc/taos/taos.cfg
- usr/bin/taosd
- usr/bin/taos
- usr/bin/taosdemo
- usr/lib/libtaos.so.2.0.0.6
- usr/lib/libtaos.so.1
- usr/lib/libtaos.so
override-prime: |
snapcraftctl prime
if [ ! -d $SNAPCRAFT_STAGE/var/lib/taos ]; then
cp -rf $SNAPCRAFT_STAGE/var/lib/taos $SNAPCRAFT_PRIME
fi
if [ ! -d $SNAPCRAFT_STAGE/var/log/taos ]; then
cp -rf $SNAPCRAFT_STAGE/var/log/taos $SNAPCRAFT_PRIME
fi
layout:
/var/lib/taos:
bind: $SNAP_DATA/var/lib/taos
/var/log/taos:
bind: $SNAP_DATA/var/log/taos
/etc/taos/taos.cfg:
bind-file: $SNAP_DATA/etc/taos/taos.cfg
hooks:
install:
plugs: [systemfiles]
...@@ -118,6 +118,7 @@ static void balanceSwapVnodeGid(SVnodeGid *pVnodeGid1, SVnodeGid *pVnodeGid2) { ...@@ -118,6 +118,7 @@ static void balanceSwapVnodeGid(SVnodeGid *pVnodeGid1, SVnodeGid *pVnodeGid2) {
} }
int32_t balanceAllocVnodes(SVgObj *pVgroup) { int32_t balanceAllocVnodes(SVgObj *pVgroup) {
static int32_t randIndex = 0;
int32_t dnode = 0; int32_t dnode = 0;
int32_t vnodes = 0; int32_t vnodes = 0;
...@@ -160,7 +161,7 @@ int32_t balanceAllocVnodes(SVgObj *pVgroup) { ...@@ -160,7 +161,7 @@ int32_t balanceAllocVnodes(SVgObj *pVgroup) {
*/ */
if (pVgroup->numOfVnodes == 1) { if (pVgroup->numOfVnodes == 1) {
} else if (pVgroup->numOfVnodes == 2) { } else if (pVgroup->numOfVnodes == 2) {
if (rand() % 2 == 0) { if (randIndex++ % 2 == 0) {
balanceSwapVnodeGid(pVgroup->vnodeGid, pVgroup->vnodeGid + 1); balanceSwapVnodeGid(pVgroup->vnodeGid, pVgroup->vnodeGid + 1);
} }
} else { } else {
......
...@@ -3,6 +3,7 @@ taos_init ...@@ -3,6 +3,7 @@ taos_init
taos_cleanup taos_cleanup
taos_options taos_options
taos_connect taos_connect
taos_connect_auth
taos_close taos_close
taos_stmt_init taos_stmt_init
taos_stmt_prepare taos_stmt_prepare
......
...@@ -904,6 +904,11 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) { ...@@ -904,6 +904,11 @@ static int32_t tscCheckIfCreateTable(char **sqlstr, SSqlObj *pSql) {
sToken = tStrGetToken(sql, &index, true, numOfIgnoreToken, &ignoreTokenTypes); sToken = tStrGetToken(sql, &index, true, numOfIgnoreToken, &ignoreTokenTypes);
sql += index; sql += index;
if (TK_ILLEGAL == sToken.type) {
tdDestroyKVRowBuilder(&kvRowBuilder);
return TSDB_CODE_TSC_INVALID_SQL;
}
if (sToken.n == 0 || sToken.type == TK_RP) { if (sToken.n == 0 || sToken.type == TK_RP) {
break; break;
} }
......
...@@ -1158,8 +1158,9 @@ static int32_t handleArithmeticExpr(SSqlCmd* pCmd, int32_t clauseIndex, int32_t ...@@ -1158,8 +1158,9 @@ static int32_t handleArithmeticExpr(SSqlCmd* pCmd, int32_t clauseIndex, int32_t
int32_t ret = exprTreeFromSqlExpr(pCmd, &pNode, pItem->pNode, pQueryInfo->exprList, pQueryInfo, colList); int32_t ret = exprTreeFromSqlExpr(pCmd, &pNode, pItem->pNode, pQueryInfo->exprList, pQueryInfo, colList);
if (ret != TSDB_CODE_SUCCESS) { if (ret != TSDB_CODE_SUCCESS) {
tExprTreeDestroy(&pNode, NULL);
taosTFree(arithmeticExprStr); taosTFree(arithmeticExprStr);
taosArrayDestroy(colList);
tExprTreeDestroy(&pNode, NULL);
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2);
} }
...@@ -1168,6 +1169,8 @@ static int32_t handleArithmeticExpr(SSqlCmd* pCmd, int32_t clauseIndex, int32_t ...@@ -1168,6 +1169,8 @@ static int32_t handleArithmeticExpr(SSqlCmd* pCmd, int32_t clauseIndex, int32_t
SColIndex* pIndex = taosArrayGet(colList, k); SColIndex* pIndex = taosArrayGet(colList, k);
if (pIndex->flag == 1) { if (pIndex->flag == 1) {
taosTFree(arithmeticExprStr); taosTFree(arithmeticExprStr);
taosArrayDestroy(colList);
tExprTreeDestroy(&pNode, NULL);
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3); return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg3);
} }
} }
......
...@@ -158,6 +158,7 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) { ...@@ -158,6 +158,7 @@ void tscProcessHeartBeatRsp(void *param, TAOS_RES *tres, int code) {
if (pRsp->killConnection) { if (pRsp->killConnection) {
tscKillConnection(pObj); tscKillConnection(pObj);
return;
} else { } else {
if (pRsp->queryId) tscKillQuery(pObj, htonl(pRsp->queryId)); if (pRsp->queryId) tscKillQuery(pObj, htonl(pRsp->queryId));
if (pRsp->streamId) tscKillStream(pObj, htonl(pRsp->streamId)); if (pRsp->streamId) tscKillStream(pObj, htonl(pRsp->streamId));
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "hash.h" #include "hash.h"
#include "os.h" #include "os.h"
#include "qAst.h" #include "qAst.h"
#include "tkey.h"
#include "tcache.h" #include "tcache.h"
#include "tnote.h" #include "tnote.h"
#include "trpc.h" #include "trpc.h"
...@@ -47,18 +48,37 @@ static bool validPassword(const char* passwd) { ...@@ -47,18 +48,37 @@ static bool validPassword(const char* passwd) {
return validImpl(passwd, TSDB_PASSWORD_LEN - 1); return validImpl(passwd, TSDB_PASSWORD_LEN - 1);
} }
SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, const char *db, uint16_t port, SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, const char *auth, const char *db,
void (*fp)(void *, TAOS_RES *, int), void *param, void **taos) { uint16_t port, void (*fp)(void *, TAOS_RES *, int), void *param, void **taos) {
taos_init(); taos_init();
if (!validUserName(user)) { if (!validUserName(user)) {
terrno = TSDB_CODE_TSC_INVALID_USER_LENGTH; terrno = TSDB_CODE_TSC_INVALID_USER_LENGTH;
return NULL; return NULL;
} }
if (!validPassword(pass)) { char secretEncrypt[32] = {0};
terrno = TSDB_CODE_TSC_INVALID_PASS_LENGTH; int secretEncryptLen = 0;
return NULL; if (auth == NULL) {
if (!validPassword(pass)) {
terrno = TSDB_CODE_TSC_INVALID_PASS_LENGTH;
return NULL;
}
taosEncryptPass((uint8_t *)pass, strlen(pass), secretEncrypt);
} else {
int outlen = 0;
int len = (int)strlen(auth);
char *base64 = (char *)base64_decode(auth, len, &outlen);
if (base64 == NULL || outlen == 0) {
tscError("invalid auth info:%s", auth);
free(base64);
terrno = TSDB_CODE_TSC_INVALID_PASS_LENGTH;
return NULL;
} else {
memcpy(secretEncrypt, base64, outlen);
free(base64);
}
secretEncryptLen = outlen;
} }
if (ip) { if (ip) {
...@@ -67,7 +87,7 @@ SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con ...@@ -67,7 +87,7 @@ SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
} }
void *pDnodeConn = NULL; void *pDnodeConn = NULL;
if (tscInitRpc(user, pass, &pDnodeConn) != 0) { if (tscInitRpc(user, secretEncrypt, &pDnodeConn) != 0) {
terrno = TSDB_CODE_RPC_NETWORK_UNAVAIL; terrno = TSDB_CODE_RPC_NETWORK_UNAVAIL;
return NULL; return NULL;
} }
...@@ -82,7 +102,8 @@ SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con ...@@ -82,7 +102,8 @@ SSqlObj *taosConnectImpl(const char *ip, const char *user, const char *pass, con
pObj->signature = pObj; pObj->signature = pObj;
tstrncpy(pObj->user, user, sizeof(pObj->user)); tstrncpy(pObj->user, user, sizeof(pObj->user));
taosEncryptPass((uint8_t *)pass, strlen(pass), pObj->pass); secretEncryptLen = MIN(secretEncryptLen, sizeof(pObj->pass));
memcpy(pObj->pass, secretEncrypt, secretEncryptLen);
if (db) { if (db) {
int32_t len = (int32_t)strlen(db); int32_t len = (int32_t)strlen(db);
...@@ -144,20 +165,17 @@ static void syncConnCallback(void *param, TAOS_RES *tres, int code) { ...@@ -144,20 +165,17 @@ static void syncConnCallback(void *param, TAOS_RES *tres, int code) {
tsem_post(&pSql->rspSem); tsem_post(&pSql->rspSem);
} }
TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port) { TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass, const char *auth, const char *db,
tscDebug("try to create a connection to %s:%u, user:%s db:%s", ip, port, user, db); uint16_t port) {
if (user == NULL) user = TSDB_DEFAULT_USER; STscObj *pObj = NULL;
if (pass == NULL) pass = TSDB_DEFAULT_PASS; SSqlObj *pSql = taosConnectImpl(ip, user, pass, auth, db, port, syncConnCallback, NULL, (void **)&pObj);
STscObj* pObj = NULL;
SSqlObj *pSql = taosConnectImpl(ip, user, pass, db, port, syncConnCallback, NULL, (void**) &pObj);
if (pSql != NULL) { if (pSql != NULL) {
pSql->fp = syncConnCallback; pSql->fp = syncConnCallback;
pSql->param = pSql; pSql->param = pSql;
tscProcessSql(pSql); tscProcessSql(pSql);
tsem_wait(&pSql->rspSem); tsem_wait(&pSql->rspSem);
if (pSql->res.code != TSDB_CODE_SUCCESS) { if (pSql->res.code != TSDB_CODE_SUCCESS) {
terrno = pSql->res.code; terrno = pSql->res.code;
taos_free_result(pSql); taos_free_result(pSql);
...@@ -182,23 +200,38 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha ...@@ -182,23 +200,38 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha
return NULL; return NULL;
} }
TAOS *taos_connect_c(const char *ip, uint8_t ipLen, const char *user, uint8_t userLen, TAOS *taos_connect(const char *ip, const char *user, const char *pass, const char *db, uint16_t port) {
const char *pass, uint8_t passLen, const char *db, uint8_t dbLen, uint16_t port) { tscDebug("try to create a connection to %s:%u, user:%s db:%s", ip, port, user, db);
char ipBuf[TSDB_EP_LEN] = {0}; if (user == NULL) user = TSDB_DEFAULT_USER;
char userBuf[TSDB_USER_LEN] = {0}; if (pass == NULL) pass = TSDB_DEFAULT_PASS;
char passBuf[TSDB_PASSWORD_LEN] = {0};
char dbBuf[TSDB_DB_NAME_LEN] = {0}; return taos_connect_internal(ip, user, pass, NULL, db, port);
strncpy(ipBuf, ip, MIN(TSDB_EP_LEN - 1, ipLen)); }
strncpy(userBuf, user, MIN(TSDB_USER_LEN - 1, userLen));
strncpy(passBuf, pass, MIN(TSDB_PASSWORD_LEN - 1,passLen)); TAOS *taos_connect_auth(const char *ip, const char *user, const char *auth, const char *db, uint16_t port) {
strncpy(dbBuf, db, MIN(TSDB_DB_NAME_LEN - 1, dbLen)); tscDebug("try to create a connection to %s:%u by auth, user:%s db:%s", ip, port, user, db);
return taos_connect(ipBuf, userBuf, passBuf, dbBuf, port); if (user == NULL) user = TSDB_DEFAULT_USER;
if (auth == NULL) return NULL;
return taos_connect_internal(ip, user, NULL, auth, db, port);
} }
TAOS *taos_connect_c(const char *ip, uint8_t ipLen, const char *user, uint8_t userLen, const char *pass,
uint8_t passLen, const char *db, uint8_t dbLen, uint16_t port) {
char ipBuf[TSDB_EP_LEN] = {0};
char userBuf[TSDB_USER_LEN] = {0};
char passBuf[TSDB_PASSWORD_LEN] = {0};
char dbBuf[TSDB_DB_NAME_LEN] = {0};
strncpy(ipBuf, ip, MIN(TSDB_EP_LEN - 1, ipLen));
strncpy(userBuf, user, MIN(TSDB_USER_LEN - 1, userLen));
strncpy(passBuf, pass, MIN(TSDB_PASSWORD_LEN - 1, passLen));
strncpy(dbBuf, db, MIN(TSDB_DB_NAME_LEN - 1, dbLen));
return taos_connect(ipBuf, userBuf, passBuf, dbBuf, port);
}
TAOS *taos_connect_a(char *ip, char *user, char *pass, char *db, uint16_t port, void (*fp)(void *, TAOS_RES *, int), TAOS *taos_connect_a(char *ip, char *user, char *pass, char *db, uint16_t port, void (*fp)(void *, TAOS_RES *, int),
void *param, void **taos) { void *param, void **taos) {
SSqlObj* pSql = taosConnectImpl(ip, user, pass, db, port, fp, param, taos); SSqlObj* pSql = taosConnectImpl(ip, user, pass, NULL, db, port, fp, param, taos);
if (pSql == NULL) { if (pSql == NULL) {
return NULL; return NULL;
} }
......
...@@ -684,6 +684,8 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow ...@@ -684,6 +684,8 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
freeJoinSubqueryObj(pParentSql); freeJoinSubqueryObj(pParentSql);
pParentSql->res.code = code; pParentSql->res.code = code;
tscQueueAsyncRes(pParentSql); tscQueueAsyncRes(pParentSql);
taosArrayDestroy(s1);
taosArrayDestroy(s2);
return; return;
} }
...@@ -1296,7 +1298,9 @@ int32_t tscHandleMasterJoinQuery(SSqlObj* pSql) { ...@@ -1296,7 +1298,9 @@ int32_t tscHandleMasterJoinQuery(SSqlObj* pSql) {
tscError("%p tableIndex:%d, failed to allocate join support object, abort further query", pSql, i); tscError("%p tableIndex:%d, failed to allocate join support object, abort further query", pSql, i);
pState->numOfRemain = i; pState->numOfRemain = i;
pSql->res.code = TSDB_CODE_TSC_OUT_OF_MEMORY; pSql->res.code = TSDB_CODE_TSC_OUT_OF_MEMORY;
if (0 == i) {
taosTFree(pState);
}
return pSql->res.code; return pSql->res.code;
} }
...@@ -1304,7 +1308,9 @@ int32_t tscHandleMasterJoinQuery(SSqlObj* pSql) { ...@@ -1304,7 +1308,9 @@ int32_t tscHandleMasterJoinQuery(SSqlObj* pSql) {
if (code != TSDB_CODE_SUCCESS) { // failed to create subquery object, quit query if (code != TSDB_CODE_SUCCESS) { // failed to create subquery object, quit query
tscDestroyJoinSupporter(pSupporter); tscDestroyJoinSupporter(pSupporter);
pSql->res.code = TSDB_CODE_TSC_OUT_OF_MEMORY; pSql->res.code = TSDB_CODE_TSC_OUT_OF_MEMORY;
if (0 == i) {
taosTFree(pState);
}
break; break;
} }
} }
...@@ -2091,17 +2097,17 @@ void tscBuildResFromSubqueries(SSqlObj *pSql) { ...@@ -2091,17 +2097,17 @@ void tscBuildResFromSubqueries(SSqlObj *pSql) {
// return; // return;
// } // }
tscFetchDatablockFromSubquery(pSql); // tscFetchDatablockFromSubquery(pSql);
if (pRes->code != TSDB_CODE_SUCCESS) { // if (pRes->code != TSDB_CODE_SUCCESS) {
return; // return;
} // }
} }
if (pSql->res.code == TSDB_CODE_SUCCESS) { // if (pSql->res.code == TSDB_CODE_SUCCESS) {
(*pSql->fp)(pSql->param, pSql, pRes->numOfRows); // (*pSql->fp)(pSql->param, pSql, pRes->numOfRows);
} else { // } else {
tscQueueAsyncRes(pSql); // tscQueueAsyncRes(pSql);
} // }
} }
static void transferNcharData(SSqlObj *pSql, int32_t columnIndex, TAOS_FIELD *pField) { static void transferNcharData(SSqlObj *pSql, int32_t columnIndex, TAOS_FIELD *pField) {
......
...@@ -47,10 +47,8 @@ void tscCheckDiskUsage(void *UNUSED_PARAM(para), void* UNUSED_PARAM(param)) { ...@@ -47,10 +47,8 @@ void tscCheckDiskUsage(void *UNUSED_PARAM(para), void* UNUSED_PARAM(param)) {
taosTmrReset(tscCheckDiskUsage, 1000, NULL, tscTmr, &tscCheckDiskUsageTmr); taosTmrReset(tscCheckDiskUsage, 1000, NULL, tscTmr, &tscCheckDiskUsageTmr);
} }
int32_t tscInitRpc(const char *user, const char *secret, void** pDnodeConn) { int32_t tscInitRpc(const char *user, const char *secretEncrypt, void **pDnodeConn) {
SRpcInit rpcInit; SRpcInit rpcInit;
char secretEncrypt[32] = {0};
taosEncryptPass((uint8_t *)secret, strlen(secret), secretEncrypt);
if (*pDnodeConn == NULL) { if (*pDnodeConn == NULL) {
memset(&rpcInit, 0, sizeof(rpcInit)); memset(&rpcInit, 0, sizeof(rpcInit));
...@@ -60,11 +58,11 @@ int32_t tscInitRpc(const char *user, const char *secret, void** pDnodeConn) { ...@@ -60,11 +58,11 @@ int32_t tscInitRpc(const char *user, const char *secret, void** pDnodeConn) {
rpcInit.cfp = tscProcessMsgFromServer; rpcInit.cfp = tscProcessMsgFromServer;
rpcInit.sessions = tsMaxConnections; rpcInit.sessions = tsMaxConnections;
rpcInit.connType = TAOS_CONN_CLIENT; rpcInit.connType = TAOS_CONN_CLIENT;
rpcInit.user = (char*)user; rpcInit.user = (char *)user;
rpcInit.idleTime = 2000; rpcInit.idleTime = 2000;
rpcInit.ckey = "key"; rpcInit.ckey = "key";
rpcInit.spi = 1; rpcInit.spi = 1;
rpcInit.secret = secretEncrypt; rpcInit.secret = (char *)secretEncrypt;
*pDnodeConn = rpcOpen(&rpcInit); *pDnodeConn = rpcOpen(&rpcInit);
if (*pDnodeConn == NULL) { if (*pDnodeConn == NULL) {
......
...@@ -113,6 +113,7 @@ extern char tsInternalPass[]; ...@@ -113,6 +113,7 @@ extern char tsInternalPass[];
extern int32_t tsMonitorInterval; extern int32_t tsMonitorInterval;
// internal // internal
extern int32_t tsPrintAuth;
extern int32_t tscEmbedded; extern int32_t tscEmbedded;
extern char configDir[]; extern char configDir[];
extern char tsVnodeDir[]; extern char tsVnodeDir[];
......
...@@ -146,6 +146,7 @@ char tsInternalPass[] = "secretkey"; ...@@ -146,6 +146,7 @@ char tsInternalPass[] = "secretkey";
int32_t tsMonitorInterval = 30; // seconds int32_t tsMonitorInterval = 30; // seconds
// internal // internal
int32_t tsPrintAuth = 0;
int32_t tscEmbedded = 0; int32_t tscEmbedded = 0;
char configDir[TSDB_FILENAME_LEN] = {0}; char configDir[TSDB_FILENAME_LEN] = {0};
char tsVnodeDir[TSDB_FILENAME_LEN] = {0}; char tsVnodeDir[TSDB_FILENAME_LEN] = {0};
......
...@@ -23,7 +23,9 @@ ...@@ -23,7 +23,9 @@
// TODO refactor to set the tz value through parameter // TODO refactor to set the tz value through parameter
void tsSetTimeZone() { void tsSetTimeZone() {
SGlobalCfg *cfg_timezone = taosGetConfigOption("timezone"); SGlobalCfg *cfg_timezone = taosGetConfigOption("timezone");
uInfo("timezone is set to %s by %s", tsTimezone, tsCfgStatusStr[cfg_timezone->cfgStatus]); if (cfg_timezone != NULL) {
uInfo("timezone is set to %s by %s", tsTimezone, tsCfgStatusStr[cfg_timezone->cfgStatus]);
}
#ifdef WINDOWS #ifdef WINDOWS
char winStr[TSDB_LOCALE_LEN * 2]; char winStr[TSDB_LOCALE_LEN * 2];
......
...@@ -158,7 +158,7 @@ public class TSDBStatement implements Statement { ...@@ -158,7 +158,7 @@ public class TSDBStatement implements Statement {
throw new SQLException(TSDBConstants.FixErrMsg(TSDBConstants.JNI_CONNECTION_NULL)); throw new SQLException(TSDBConstants.FixErrMsg(TSDBConstants.JNI_CONNECTION_NULL));
} else if (resultSetPointer == TSDBConstants.JNI_NULL_POINTER) { } else if (resultSetPointer == TSDBConstants.JNI_NULL_POINTER) {
// no result set is retrieved // no result set is retrieved
this.connecter.freeResultSet(pSql); this.connecter.freeResultSet(pSql);
res = false; res = false;
} }
......
...@@ -449,7 +449,12 @@ static int32_t dnodeProcessConfigDnodeMsg(SRpcMsg *pMsg) { ...@@ -449,7 +449,12 @@ static int32_t dnodeProcessConfigDnodeMsg(SRpcMsg *pMsg) {
} }
void dnodeUpdateMnodeEpSetForPeer(SRpcEpSet *pEpSet) { void dnodeUpdateMnodeEpSetForPeer(SRpcEpSet *pEpSet) {
dInfo("mnode EP list for is changed, numOfEps:%d inUse:%d", pEpSet->numOfEps, pEpSet->inUse); if (pEpSet->numOfEps <= 0) {
dError("mnode EP list for peer is changed, but content is invalid, discard it");
return;
}
dInfo("mnode EP list for peer is changed, numOfEps:%d inUse:%d", pEpSet->numOfEps, pEpSet->inUse);
for (int i = 0; i < pEpSet->numOfEps; ++i) { for (int i = 0; i < pEpSet->numOfEps; ++i) {
pEpSet->port[i] -= TSDB_PORT_DNODEDNODE; pEpSet->port[i] -= TSDB_PORT_DNODEDNODE;
dInfo("mnode index:%d %s:%u", i, pEpSet->fqdn[i], pEpSet->port[i]) dInfo("mnode index:%d %s:%u", i, pEpSet->fqdn[i], pEpSet->port[i])
...@@ -710,10 +715,10 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) { ...@@ -710,10 +715,10 @@ static void dnodeSendStatusMsg(void *handle, void *tmrId) {
pStatus->clusterCfg.statusInterval = htonl(tsStatusInterval); pStatus->clusterCfg.statusInterval = htonl(tsStatusInterval);
pStatus->clusterCfg.maxtablesPerVnode = htonl(tsMaxTablePerVnode); pStatus->clusterCfg.maxtablesPerVnode = htonl(tsMaxTablePerVnode);
pStatus->clusterCfg.maxVgroupsPerDb = htonl(tsMaxVgroupsPerDb); pStatus->clusterCfg.maxVgroupsPerDb = htonl(tsMaxVgroupsPerDb);
strcpy(pStatus->clusterCfg.arbitrator, tsArbitrator); tstrncpy(pStatus->clusterCfg.arbitrator, tsArbitrator, TSDB_EP_LEN);
strcpy(pStatus->clusterCfg.timezone, tsTimezone); tstrncpy(pStatus->clusterCfg.timezone, tsTimezone, 64);
strcpy(pStatus->clusterCfg.locale, tsLocale); tstrncpy(pStatus->clusterCfg.locale, tsLocale, TSDB_LOCALE_LEN);
strcpy(pStatus->clusterCfg.charset, tsCharset); tstrncpy(pStatus->clusterCfg.charset, tsCharset, TSDB_LOCALE_LEN);
vnodeBuildStatusMsg(pStatus); vnodeBuildStatusMsg(pStatus);
contLen = sizeof(SDMStatusMsg) + pStatus->openVnodes * sizeof(SVnodeLoad); contLen = sizeof(SDMStatusMsg) + pStatus->openVnodes * sizeof(SVnodeLoad);
......
...@@ -52,6 +52,8 @@ int32_t main(int32_t argc, char *argv[]) { ...@@ -52,6 +52,8 @@ int32_t main(int32_t argc, char *argv[]) {
} else if (strcmp(argv[i], "-k") == 0) { } else if (strcmp(argv[i], "-k") == 0) {
grantParseParameter(); grantParseParameter();
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} else if (strcmp(argv[i], "-A") == 0) {
tsPrintAuth = 1;
} }
#ifdef TAOS_MEM_CHECK #ifdef TAOS_MEM_CHECK
else if (strcmp(argv[i], "--alloc-random-fail") == 0) { else if (strcmp(argv[i], "--alloc-random-fail") == 0) {
......
...@@ -39,6 +39,7 @@ typedef struct SShellArguments { ...@@ -39,6 +39,7 @@ typedef struct SShellArguments {
char* host; char* host;
char* password; char* password;
char* user; char* user;
char* auth;
char* database; char* database;
char* timezone; char* timezone;
bool is_raw_time; bool is_raw_time;
......
...@@ -32,16 +32,16 @@ void insertChar(Command *cmd, char *c, int size); ...@@ -32,16 +32,16 @@ void insertChar(Command *cmd, char *c, int size);
void printHelp() { void printHelp() {
char indent[10] = " "; char indent[10] = " ";
printf("taos shell is used to test the TDEngine database\n"); printf("taos shell is used to test the TDengine database\n");
printf("%s%s\n", indent, "-h"); printf("%s%s\n", indent, "-h");
printf("%s%s%s\n", indent, indent, "TDEngine server IP address to connect. The default host is localhost."); printf("%s%s%s\n", indent, indent, "TDengine server IP address to connect. The default host is localhost.");
printf("%s%s\n", indent, "-p"); printf("%s%s\n", indent, "-p");
printf("%s%s%s\n", indent, indent, "The password to use when connecting to the server."); printf("%s%s%s\n", indent, indent, "The password to use when connecting to the server.");
printf("%s%s\n", indent, "-P"); printf("%s%s\n", indent, "-P");
printf("%s%s%s\n", indent, indent, "The TCP/IP port number to use for the connection"); printf("%s%s%s\n", indent, indent, "The TCP/IP port number to use for the connection");
printf("%s%s\n", indent, "-u"); printf("%s%s\n", indent, "-u");
printf("%s%s%s\n", indent, indent, "The TDEngine user name to use when connecting to the server."); printf("%s%s%s\n", indent, indent, "The user name to use when connecting to the server.");
printf("%s%s\n", indent, "-c"); printf("%s%s\n", indent, "-c");
printf("%s%s%s\n", indent, indent, "Configuration directory."); printf("%s%s%s\n", indent, indent, "Configuration directory.");
printf("%s%s\n", indent, "-s"); printf("%s%s\n", indent, "-s");
......
...@@ -38,6 +38,7 @@ SShellHistory history; ...@@ -38,6 +38,7 @@ SShellHistory history;
#define DEFAULT_MAX_BINARY_DISPLAY_WIDTH 30 #define DEFAULT_MAX_BINARY_DISPLAY_WIDTH 30
extern int32_t tsMaxBinaryDisplayWidth; extern int32_t tsMaxBinaryDisplayWidth;
extern TAOS *taos_connect_auth(const char *ip, const char *user, const char *auth, const char *db, uint16_t port);
/* /*
* FUNCTION: Initialize the shell. * FUNCTION: Initialize the shell.
...@@ -70,7 +71,13 @@ TAOS *shellInit(SShellArguments *args) { ...@@ -70,7 +71,13 @@ TAOS *shellInit(SShellArguments *args) {
tsTableMetaKeepTimer = 3000; tsTableMetaKeepTimer = 3000;
// Connect to the database. // Connect to the database.
TAOS *con = taos_connect(args->host, args->user, args->password, args->database, args->port); TAOS *con = NULL;
if (args->auth == NULL) {
con = taos_connect(args->host, args->user, args->password, args->database, args->port);
} else {
con = taos_connect_auth(args->host, args->user, args->auth, args->database, args->port);
}
if (con == NULL) { if (con == NULL) {
printf("taos connect failed, reason: %s.\n\n", tstrerror(terrno)); printf("taos connect failed, reason: %s.\n\n", tstrerror(terrno));
fflush(stdout); fflush(stdout);
......
...@@ -33,10 +33,11 @@ const char *argp_program_bug_address = "<support@taosdata.com>"; ...@@ -33,10 +33,11 @@ const char *argp_program_bug_address = "<support@taosdata.com>";
static char doc[] = ""; static char doc[] = "";
static char args_doc[] = ""; static char args_doc[] = "";
static struct argp_option options[] = { static struct argp_option options[] = {
{"host", 'h', "HOST", 0, "TDEngine server IP address to connect. The default host is localhost."}, {"host", 'h', "HOST", 0, "TDengine server IP address to connect. The default host is localhost."},
{"password", 'p', "PASSWORD", OPTION_ARG_OPTIONAL, "The password to use when connecting to the server."}, {"password", 'p', "PASSWORD", OPTION_ARG_OPTIONAL, "The password to use when connecting to the server."},
{"port", 'P', "PORT", 0, "The TCP/IP port number to use for the connection."}, {"port", 'P', "PORT", 0, "The TCP/IP port number to use for the connection."},
{"user", 'u', "USER", 0, "The TDEngine user name to use when connecting to the server."}, {"user", 'u', "USER", 0, "The user name to use when connecting to the server."},
{"user", 'A', "Auth", 0, "The user auth to use when connecting to the server."},
{"config-dir", 'c', "CONFIG_DIR", 0, "Configuration directory."}, {"config-dir", 'c', "CONFIG_DIR", 0, "Configuration directory."},
{"commands", 's', "COMMANDS", 0, "Commands to run without enter the shell."}, {"commands", 's', "COMMANDS", 0, "Commands to run without enter the shell."},
{"raw-time", 'r', 0, 0, "Output time as uint64_t."}, {"raw-time", 'r', 0, 0, "Output time as uint64_t."},
...@@ -76,11 +77,14 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) { ...@@ -76,11 +77,14 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) {
case 'u': case 'u':
arguments->user = arg; arguments->user = arg;
break; break;
case 'A':
arguments->auth = arg;
break;
case 'c': case 'c':
if (wordexp(arg, &full_path, 0) != 0) { if (wordexp(arg, &full_path, 0) != 0) {
fprintf(stderr, "Invalid path %s\n", arg); fprintf(stderr, "Invalid path %s\n", arg);
return -1; return -1;
} }
if (strlen(full_path.we_wordv[0]) >= TSDB_FILENAME_LEN) { if (strlen(full_path.we_wordv[0]) >= TSDB_FILENAME_LEN) {
fprintf(stderr, "config file path: %s overflow max len %d\n", full_path.we_wordv[0], TSDB_FILENAME_LEN - 1); fprintf(stderr, "config file path: %s overflow max len %d\n", full_path.we_wordv[0], TSDB_FILENAME_LEN - 1);
wordfree(&full_path); wordfree(&full_path);
......
...@@ -21,16 +21,18 @@ extern char configDir[]; ...@@ -21,16 +21,18 @@ extern char configDir[];
void printHelp() { void printHelp() {
char indent[10] = " "; char indent[10] = " ";
printf("taos shell is used to test the TDEngine database\n"); printf("taos shell is used to test the TDengine database\n");
printf("%s%s\n", indent, "-h"); printf("%s%s\n", indent, "-h");
printf("%s%s%s\n", indent, indent, "TDEngine server IP address to connect. The default host is localhost."); printf("%s%s%s\n", indent, indent, "TDengine server IP address to connect. The default host is localhost.");
printf("%s%s\n", indent, "-p"); printf("%s%s\n", indent, "-p");
printf("%s%s%s\n", indent, indent, "The password to use when connecting to the server."); printf("%s%s%s\n", indent, indent, "The password to use when connecting to the server.");
printf("%s%s\n", indent, "-P"); printf("%s%s\n", indent, "-P");
printf("%s%s%s\n", indent, indent, "The TCP/IP port number to use for the connection"); printf("%s%s%s\n", indent, indent, "The TCP/IP port number to use for the connection");
printf("%s%s\n", indent, "-u"); printf("%s%s\n", indent, "-u");
printf("%s%s%s\n", indent, indent, "The TDEngine user name to use when connecting to the server."); printf("%s%s%s\n", indent, indent, "The user name to use when connecting to the server.");
printf("%s%s\n", indent, "-A");
printf("%s%s%s\n", indent, indent, "The user auth to use when connecting to the server.");
printf("%s%s\n", indent, "-c"); printf("%s%s\n", indent, "-c");
printf("%s%s%s\n", indent, indent, "Configuration directory."); printf("%s%s%s\n", indent, indent, "Configuration directory.");
printf("%s%s\n", indent, "-s"); printf("%s%s\n", indent, "-s");
...@@ -79,6 +81,13 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) { ...@@ -79,6 +81,13 @@ void shellParseArgument(int argc, char *argv[], SShellArguments *arguments) {
fprintf(stderr, "option -u requires an argument\n"); fprintf(stderr, "option -u requires an argument\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} else if (strcmp(argv[i], "-A") == 0) {
if (i < argc - 1) {
arguments->auth = argv[++i];
} else {
fprintf(stderr, "option -A requires an argument\n");
exit(EXIT_FAILURE);
}
} else if (strcmp(argv[i], "-c") == 0) { } else if (strcmp(argv[i], "-c") == 0) {
if (i < argc - 1) { if (i < argc - 1) {
if (strlen(argv[++i]) >= TSDB_FILENAME_LEN) { if (strlen(argv[++i]) >= TSDB_FILENAME_LEN) {
......
...@@ -85,9 +85,9 @@ typedef struct DemoArguments { ...@@ -85,9 +85,9 @@ typedef struct DemoArguments {
#ifdef LINUX #ifdef LINUX
/* The options we understand. */ /* The options we understand. */
static struct argp_option options[] = { static struct argp_option options[] = {
{0, 'h', "host", 0, "The host to connect to TDEngine. Default is localhost.", 0}, {0, 'h', "host", 0, "The host to connect to TDengine. Default is localhost.", 0},
{0, 'p', "port", 0, "The TCP/IP port number to use for the connection. Default is 0.", 1}, {0, 'p', "port", 0, "The TCP/IP port number to use for the connection. Default is 0.", 1},
{0, 'u', "user", 0, "The TDEngine user name to use when connecting to the server. Default is 'root'.", 2}, {0, 'u', "user", 0, "The TDengine user name to use when connecting to the server. Default is 'root'.", 2},
{0, 'P', "password", 0, "The password to use when connecting to the server. Default is 'taosdata'.", 3}, {0, 'P', "password", 0, "The password to use when connecting to the server. Default is 'taosdata'.", 3},
{0, 'd', "database", 0, "Destination database. Default is 'test'.", 3}, {0, 'd', "database", 0, "Destination database. Default is 'test'.", 3},
{0, 'm', "table_prefix", 0, "Table prefix name. Default is 't'.", 3}, {0, 'm', "table_prefix", 0, "Table prefix name. Default is 't'.", 3},
...@@ -264,11 +264,11 @@ typedef struct DemoArguments { ...@@ -264,11 +264,11 @@ typedef struct DemoArguments {
void printHelp() { void printHelp() {
char indent[10] = " "; char indent[10] = " ";
printf("%s%s\n", indent, "-h"); printf("%s%s\n", indent, "-h");
printf("%s%s%s\n", indent, indent, "host, The host to connect to TDEngine. Default is localhost."); printf("%s%s%s\n", indent, indent, "host, The host to connect to TDengine. Default is localhost.");
printf("%s%s\n", indent, "-p"); printf("%s%s\n", indent, "-p");
printf("%s%s%s\n", indent, indent, "port, The TCP/IP port number to use for the connection. Default is 0."); printf("%s%s%s\n", indent, indent, "port, The TCP/IP port number to use for the connection. Default is 0.");
printf("%s%s\n", indent, "-u"); printf("%s%s\n", indent, "-u");
printf("%s%s%s\n", indent, indent, "user, The TDEngine user name to use when connecting to the server. Default is 'root'."); printf("%s%s%s\n", indent, indent, "user, The user name to use when connecting to the server. Default is 'root'.");
printf("%s%s\n", indent, "-p"); printf("%s%s\n", indent, "-p");
printf("%s%s%s\n", indent, indent, "password, The password to use when connecting to the server. Default is 'taosdata'."); printf("%s%s%s\n", indent, indent, "password, The password to use when connecting to the server. Default is 'taosdata'.");
printf("%s%s\n", indent, "-d"); printf("%s%s\n", indent, "-d");
......
...@@ -73,9 +73,9 @@ static int32_t mnodeDbActionInsert(SSdbOper *pOper) { ...@@ -73,9 +73,9 @@ static int32_t mnodeDbActionInsert(SSdbOper *pOper) {
pthread_mutex_lock(&pDb->mutex); pthread_mutex_lock(&pDb->mutex);
pDb->vgListSize = VG_LIST_SIZE; pDb->vgListSize = VG_LIST_SIZE;
pDb->vgList = calloc(pDb->vgListSize, sizeof(SVgObj *)); pDb->vgList = calloc(pDb->vgListSize, sizeof(SVgObj *));
pDb->numOfVgroups = 0;
pthread_mutex_unlock(&pDb->mutex); pthread_mutex_unlock(&pDb->mutex);
pDb->numOfVgroups = 0;
pDb->numOfTables = 0; pDb->numOfTables = 0;
pDb->numOfSuperTables = 0; pDb->numOfSuperTables = 0;
...@@ -927,7 +927,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) { ...@@ -927,7 +927,7 @@ static SDbCfg mnodeGetAlterDbOption(SDbObj *pDb, SCMAlterDbMsg *pAlter) {
if (quorum >= 0 && quorum != pDb->cfg.quorum) { if (quorum >= 0 && quorum != pDb->cfg.quorum) {
mDebug("db:%s, quorum:%d change to %d", pDb->name, pDb->cfg.quorum, quorum); mDebug("db:%s, quorum:%d change to %d", pDb->name, pDb->cfg.quorum, quorum);
newCfg.compression = quorum; newCfg.quorum = quorum;
} }
return newCfg; return newCfg;
......
...@@ -58,7 +58,8 @@ int32_t mnodeProcessPeerReq(SMnodeMsg *pMsg) { ...@@ -58,7 +58,8 @@ int32_t mnodeProcessPeerReq(SMnodeMsg *pMsg) {
rpcRsp->rsp = epSet; rpcRsp->rsp = epSet;
rpcRsp->len = sizeof(SRpcEpSet); rpcRsp->len = sizeof(SRpcEpSet);
mDebug("%p, msg:%s in mpeer queue, will be redireced inUse:%d", pMsg->rpcMsg.ahandle, taosMsg[pMsg->rpcMsg.msgType], epSet->inUse); mDebug("%p, msg:%s in mpeer queue, will be redireced, numOfEps:%d inUse:%d", pMsg->rpcMsg.ahandle,
taosMsg[pMsg->rpcMsg.msgType], epSet->numOfEps, epSet->inUse);
for (int32_t i = 0; i < epSet->numOfEps; ++i) { for (int32_t i = 0; i < epSet->numOfEps; ++i) {
mDebug("mnode index:%d ep:%s:%d", i, epSet->fqdn[i], htons(epSet->port[i])); mDebug("mnode index:%d ep:%s:%d", i, epSet->fqdn[i], htons(epSet->port[i]));
} }
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "tglobal.h" #include "tglobal.h"
#include "tgrant.h" #include "tgrant.h"
#include "tdataformat.h" #include "tdataformat.h"
#include "tkey.h"
#include "mnode.h" #include "mnode.h"
#include "dnode.h" #include "dnode.h"
#include "mnodeDef.h" #include "mnodeDef.h"
...@@ -100,6 +101,32 @@ static int32_t mnodeUserActionDecode(SSdbOper *pOper) { ...@@ -100,6 +101,32 @@ static int32_t mnodeUserActionDecode(SSdbOper *pOper) {
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
static void mnodePrintUserAuth() {
FILE *fp = fopen("auth.txt", "w");
if (!fp) {
mDebug("failed to auth.txt for write");
return;
}
void * pIter = NULL;
SUserObj *pUser = NULL;
while (1) {
pIter = mnodeGetNextUser(pIter, &pUser);
if (pUser == NULL) break;
char *base64 = base64_encode((const unsigned char *)pUser->pass, TSDB_KEY_LEN * 2);
fprintf(fp, "user:%24s auth:%s\n", pUser->user, base64);
free(base64);
mnodeDecUserRef(pUser);
}
fflush(fp);
sdbFreeIter(pIter);
fclose(fp);
}
static int32_t mnodeUserActionRestored() { static int32_t mnodeUserActionRestored() {
int32_t numOfRows = sdbGetNumOfRows(tsUserSdb); int32_t numOfRows = sdbGetNumOfRows(tsUserSdb);
if (numOfRows <= 0 && dnodeIsFirstDeploy()) { if (numOfRows <= 0 && dnodeIsFirstDeploy()) {
...@@ -111,6 +138,11 @@ static int32_t mnodeUserActionRestored() { ...@@ -111,6 +138,11 @@ static int32_t mnodeUserActionRestored() {
mnodeDecAcctRef(pAcct); mnodeDecAcctRef(pAcct);
} }
if (tsPrintAuth != 0) {
mInfo("print user auth, for -A parameter is set");
mnodePrintUserAuth();
}
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
......
...@@ -170,6 +170,7 @@ static void taosGetSystemTimezone() { ...@@ -170,6 +170,7 @@ static void taosGetSystemTimezone() {
fclose(f); fclose(f);
buf[sizeof(buf) - 1] = 0;
char *lineEnd = strstr(buf, "\n"); char *lineEnd = strstr(buf, "\n");
if (lineEnd != NULL) { if (lineEnd != NULL) {
*lineEnd = 0; *lineEnd = 0;
......
...@@ -210,10 +210,14 @@ void httpProcessSingleSqlRetrieveCallBack(void *param, TAOS_RES *result, int num ...@@ -210,10 +210,14 @@ void httpProcessSingleSqlRetrieveCallBack(void *param, TAOS_RES *result, int num
} }
} }
#if 0
// todo refactor // todo refactor
if (tscResultsetFetchCompleted(result)) { if (tscResultsetFetchCompleted(result)) {
httpDebug("context:%p, fd:%d, ip:%s, user:%s, resultset fetch completed", pContext, pContext->fd, pContext->ipstr,
pContext->user);
isContinue = false; isContinue = false;
} }
#endif
if (isContinue) { if (isContinue) {
// retrieve next batch of rows // retrieve next batch of rows
......
...@@ -70,14 +70,27 @@ int32_t mqttInitSystem() { ...@@ -70,14 +70,27 @@ int32_t mqttInitSystem() {
recntStatus.port = strbetween("'1883'", "'", "'"); recntStatus.port = strbetween("'1883'", "'", "'");
} }
topicPath = strbetween(strstr(url, strstr(_begin_hostname, ":") != NULL ? recntStatus.port : recntStatus.hostname), char* portStr = recntStatus.hostname;
"/", "/"); if (_begin_hostname != NULL) {
char* _topic = "+/+/+/"; char* colonStr = strstr(_begin_hostname, ":");
int _tpsize = strlen(topicPath) + strlen(_topic) + 1; if (colonStr != NULL) {
recntStatus.topic = calloc(1, _tpsize); portStr = recntStatus.port;
sprintf(recntStatus.topic, "/%s/%s", topicPath, _topic); }
recntStatus.client_id = strlen(tsMqttBrokerClientId) < 3 ? tsMqttBrokerClientId : "taos_mqtt"; }
mqttConnect = NULL;
char* topicStr = strstr(url, portStr);
if (topicStr != NULL) {
topicPath = strbetween(topicStr, "/", "/");
char* _topic = "+/+/+/";
int _tpsize = strlen(topicPath) + strlen(_topic) + 1;
recntStatus.topic = calloc(1, _tpsize);
sprintf(recntStatus.topic, "/%s/%s", topicPath, _topic);
recntStatus.client_id = strlen(tsMqttBrokerClientId) < 3 ? tsMqttBrokerClientId : "taos_mqtt";
mqttConnect = NULL;
} else {
topicPath = NULL;
}
return rc; return rc;
} }
......
...@@ -132,7 +132,7 @@ int tsdbOpenFileH(STsdbRepo *pRepo) { ...@@ -132,7 +132,7 @@ int tsdbOpenFileH(STsdbRepo *pRepo) {
char *fname = malloc(strlen(tDataDir) + strlen(dp->d_name) + 2); char *fname = malloc(strlen(tDataDir) + strlen(dp->d_name) + 2);
if (fname == NULL) goto _err; if (fname == NULL) goto _err;
sprintf(fname, "%s/%s", tDataDir, dp->d_name); sprintf(fname, "%s/%s", tDataDir, dp->d_name);
remove(fname); (void)remove(fname);
free(fname); free(fname);
} else if (code == REG_NOMATCH) { } else if (code == REG_NOMATCH) {
tsdbError("vgId:%d invalid file %s exists, ignore it", REPO_ID(pRepo), dp->d_name); tsdbError("vgId:%d invalid file %s exists, ignore it", REPO_ID(pRepo), dp->d_name);
...@@ -447,6 +447,8 @@ void tsdbGetFileInfoImpl(char *fname, uint32_t *magic, int32_t *size) { ...@@ -447,6 +447,8 @@ void tsdbGetFileInfoImpl(char *fname, uint32_t *magic, int32_t *size) {
*magic = info.magic; *magic = info.magic;
*size = (int32_t)offset; *size = (int32_t)offset;
return;
_err: _err:
if (fd >= 0) close(fd); if (fd >= 0) close(fd);
*magic = TSDB_FILE_INIT_MAGIC; *magic = TSDB_FILE_INIT_MAGIC;
......
...@@ -683,11 +683,11 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SCommitIter *iters, SRWHe ...@@ -683,11 +683,11 @@ static int tsdbCommitToFile(STsdbRepo *pRepo, int fid, SCommitIter *iters, SRWHe
pthread_rwlock_wrlock(&(pFileH->fhlock)); pthread_rwlock_wrlock(&(pFileH->fhlock));
rename(helperNewHeadF(pHelper)->fname, helperHeadF(pHelper)->fname); (void)rename(helperNewHeadF(pHelper)->fname, helperHeadF(pHelper)->fname);
pGroup->files[TSDB_FILE_TYPE_HEAD].info = helperNewHeadF(pHelper)->info; pGroup->files[TSDB_FILE_TYPE_HEAD].info = helperNewHeadF(pHelper)->info;
if (newLast) { if (newLast) {
rename(helperNewLastF(pHelper)->fname, helperLastF(pHelper)->fname); (void)rename(helperNewLastF(pHelper)->fname, helperLastF(pHelper)->fname);
pGroup->files[TSDB_FILE_TYPE_LAST].info = helperNewLastF(pHelper)->info; pGroup->files[TSDB_FILE_TYPE_LAST].info = helperNewLastF(pHelper)->info;
} else { } else {
pGroup->files[TSDB_FILE_TYPE_LAST].info = helperLastF(pHelper)->info; pGroup->files[TSDB_FILE_TYPE_LAST].info = helperLastF(pHelper)->info;
......
...@@ -351,6 +351,8 @@ void tsdbGetStoreInfo(char *fname, uint32_t *magic, int32_t *size) { ...@@ -351,6 +351,8 @@ void tsdbGetStoreInfo(char *fname, uint32_t *magic, int32_t *size) {
*magic = info.magic; *magic = info.magic;
*size = (int32_t)offset; *size = (int32_t)offset;
return;
_err: _err:
if (fd >= 0) close(fd); if (fd >= 0) close(fd);
*magic = TD_KVSTORE_INIT_MAGIC; *magic = TD_KVSTORE_INIT_MAGIC;
......
...@@ -371,7 +371,7 @@ SOCKET taosOpenTcpServerSocket(uint32_t ip, uint16_t port) { ...@@ -371,7 +371,7 @@ SOCKET taosOpenTcpServerSocket(uint32_t ip, uint16_t port) {
serverAdd.sin_addr.s_addr = ip; serverAdd.sin_addr.s_addr = ip;
serverAdd.sin_port = (uint16_t)htons(port); serverAdd.sin_port = (uint16_t)htons(port);
if ((sockFd = (int)socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { if ((sockFd = (int)socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 2) {
uError("failed to open TCP socket: %d (%s)", errno, strerror(errno)); uError("failed to open TCP socket: %d (%s)", errno, strerror(errno));
return -1; return -1;
} }
...@@ -382,7 +382,7 @@ SOCKET taosOpenTcpServerSocket(uint32_t ip, uint16_t port) { ...@@ -382,7 +382,7 @@ SOCKET taosOpenTcpServerSocket(uint32_t ip, uint16_t port) {
uError("setsockopt SO_REUSEADDR failed: %d (%s)", errno, strerror(errno)); uError("setsockopt SO_REUSEADDR failed: %d (%s)", errno, strerror(errno));
taosCloseSocket(sockFd); taosCloseSocket(sockFd);
return -1; return -1;
}; }
/* bind socket to server address */ /* bind socket to server address */
if (bind(sockFd, (struct sockaddr *)&serverAdd, sizeof(serverAdd)) < 0) { if (bind(sockFd, (struct sockaddr *)&serverAdd, sizeof(serverAdd)) < 0) {
......
char version[12] = "2.0.0.6"; char version[12] = "2.0.1.0";
char compatible_version[12] = "2.0.0.0"; char compatible_version[12] = "2.0.0.0";
char gitinfo[48] = "e9a20fafbe9e3b0b12cbdf55604163b4b9a41b41"; char gitinfo[48] = "7ac6c2b8de3cd66e180132fc1cf77715237308a1";
char gitinfoOfInternal[48] = "dd679db0b9edeedad68574c1e031544711a9831f"; char gitinfoOfInternal[48] = "e1e64838ece2b6dbe964ec3a39953455f354d930";
char buildinfo[64] = "Built by at 2020-08-12 07:59"; char buildinfo[64] = "Built by root at 2020-08-17 11:13";
void libtaos_2_0_0_6_Linux_x64() {}; void libtaos_2_0_1_0_Linux_x64() {};
...@@ -8,4 +8,3 @@ select * from devices where devgroup='60'; ...@@ -8,4 +8,3 @@ select * from devices where devgroup='60';
select * from devices where devgroup='70'; select * from devices where devgroup='70';
select * from devices where devgroup='80'; select * from devices where devgroup='80';
select * from devices where devgroup='90'; select * from devices where devgroup='90';
...@@ -58,4 +58,3 @@ select spread(temperature) from devices where devgroup=~/[1-7][0-9]/; ...@@ -58,4 +58,3 @@ select spread(temperature) from devices where devgroup=~/[1-7][0-9]/;
select spread(temperature) from devices where devgroup=~/[1-8][0-9]/; select spread(temperature) from devices where devgroup=~/[1-8][0-9]/;
select spread(temperature) from devices where devgroup=~/[1-9][0-9]/; select spread(temperature) from devices where devgroup=~/[1-9][0-9]/;
select spread(temperature) from devices; select spread(temperature) from devices;
...@@ -8,4 +8,3 @@ select count(temperature), sum(temperature), mean(temperature) from devices wher ...@@ -8,4 +8,3 @@ select count(temperature), sum(temperature), mean(temperature) from devices wher
select count(temperature), sum(temperature), mean(temperature) from devices where devgroup=~/[1-8][0-9]/ group by devgroup; select count(temperature), sum(temperature), mean(temperature) from devices where devgroup=~/[1-8][0-9]/ group by devgroup;
select count(temperature), sum(temperature), mean(temperature) from devices where devgroup=~/[1-9][0-9]/ group by devgroup; select count(temperature), sum(temperature), mean(temperature) from devices where devgroup=~/[1-9][0-9]/ group by devgroup;
select count(temperature), sum(temperature), mean(temperature) from devices group by devgroup; select count(temperature), sum(temperature), mean(temperature) from devices group by devgroup;
...@@ -8,4 +8,3 @@ select count(temperature), sum(temperature), mean(temperature) from devices wher ...@@ -8,4 +8,3 @@ select count(temperature), sum(temperature), mean(temperature) from devices wher
select count(temperature), sum(temperature), mean(temperature) from devices where devgroup=~/[1-8][0-9]/ group by time(1m); select count(temperature), sum(temperature), mean(temperature) from devices where devgroup=~/[1-8][0-9]/ group by time(1m);
select count(temperature), sum(temperature), mean(temperature) from devices where devgroup=~/[1-9][0-9]/ group by time(1m); select count(temperature), sum(temperature), mean(temperature) from devices where devgroup=~/[1-9][0-9]/ group by time(1m);
select count(temperature), sum(temperature), mean(temperature) from devices group by time(1m); select count(temperature), sum(temperature), mean(temperature) from devices group by time(1m);
#!/bin/bash
NUM_LOOP=5
function printTo {
if $verbose ; then
echo $1
fi
}
INFLUXDBTESTQ1OUT=influxdbTestQ1.out
function runTest {
totalG0=0
totalG10=0
totalG20=0
totalG30=0
totalG40=0
totalG50=0
totalG60=0
totalG70=0
totalG80=0
totalG90=0
for i in `seq 1 $NUM_LOOP`; do
printTo "loop i:$i, $INFLUXDBTEST_DIR/infludbTest \
-sql $INFLUXDBTEST_DIR/q1.txt"
$INFLUXDBTEST_DIR/influxdbTest \
-sql $INFLUXDBTEST_DIR/q1.txt 2>&1 \
| tee $INFLUXDBTESTQ1OUT
G0=`grep "devgroup='0'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG0=`echo "scale=4; $totalG0 + $G0" | bc`
G10=`grep "devgroup='10'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG10=`echo "scale=4; $totalG10 + $G10" | bc`
G20=`grep "devgroup='20'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG20=`echo "scale=4; $totalG20 + $G20" | bc`
G30=`grep "devgroup='30'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG30=`echo "scale=4; $totalG30 + $G30" | bc`
G40=`grep "devgroup='40'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG40=`echo "scale=4; $totalG40 + $G40" | bc`
G50=`grep "devgroup='50'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG50=`echo "scale=4; $totalG50 + $G50" | bc`
G60=`grep "devgroup='60'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG60=`echo "scale=4; $totalG60 + $G60" | bc`
G70=`grep "devgroup='70'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG70=`echo "scale=4; $totalG70 + $G70" | bc`
G80=`grep "devgroup='80'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG80=`echo "scale=4; $totalG80 + $G80" | bc`
G90=`grep "devgroup='90'" $INFLUXDBTESTQ1OUT| awk '{print $5}'`
totalG90=`echo "scale=4; $totalG90 + $G90" | bc`
done
avgG0=`echo "scale=4; x = $totalG0 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG10=`echo "scale=4; x = $totalG10 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG20=`echo "scale=4; x = $totalG20 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG30=`echo "scale=4; x = $totalG30 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG40=`echo "scale=4; x = $totalG40 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG50=`echo "scale=4; x = $totalG50 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG60=`echo "scale=4; x = $totalG60 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG70=`echo "scale=4; x = $totalG70 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG80=`echo "scale=4; x = $totalG80 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG90=`echo "scale=4; x = $totalG90 / $NUM_LOOP; if(x<1) print 0; x" | bc`
echo "Latency, G-0, G-10, G-20, G-30, G-40, G-50, G-60, G-70, G-80, G-90"
echo "InfluxDB, $avgG0, $avgG10, $avgG20, $avgG30, $avgG40, $avgG50, $avgG60, $avgG70, $avgG80, $avgG90"
}
################ Main ################
master=false
develop=true
verbose=false
clients=1
while : ; do
case $1 in
-v)
verbose=true
shift ;;
-c)
clients=$2
shift 2;;
-n)
NUM_LOOP=$2
shift 2;;
*)
break ;;
esac
done
WORK_DIR=/mnt/root/TDengine
INFLUXDBTEST_DIR=$WORK_DIR/tests/comparisonTest/influxdb
runTest
printTo "Test done!"
#!/bin/bash
NUM_LOOP=5
function printTo {
if $verbose ; then
echo $1
fi
}
INFLUXDBTESTQ2OUT=influxdbTestQ2.out
function runTest {
totalCount10=0
totalCount20=0
totalCount30=0
totalCount40=0
totalCount50=0
totalCount60=0
totalCount70=0
totalCount80=0
totalCount90=0
totalCount100=0
totalMean10=0
totalMean20=0
totalMean30=0
totalMean40=0
totalMean50=0
totalMean60=0
totalMean70=0
totalMean80=0
totalMean90=0
totalMean100=0
totalSum10=0
totalSum20=0
totalSum30=0
totalSum40=0
totalSum50=0
totalSum60=0
totalSum70=0
totalSum80=0
totalSum90=0
totalSum100=0
totalMax10=0
totalMax20=0
totalMax30=0
totalMax40=0
totalMax50=0
totalMax60=0
totalMax70=0
totalMax80=0
totalMax90=0
totalMax100=0
totalMin10=0
totalMin20=0
totalMin30=0
totalMin40=0
totalMin50=0
totalMin60=0
totalMin70=0
totalMin80=0
totalMin90=0
totalMin100=0
totalSpread10=0
totalSpread20=0
totalSpread30=0
totalSpread40=0
totalSpread50=0
totalSpread60=0
totalSpread70=0
totalSpread80=0
totalSpread90=0
totalSpread100=0
for i in `seq 1 $NUM_LOOP`; do
printTo "loop i:$i, $INFLUXDBTEST_DIR/influxdbTest \
-sql $INFLUXDBTEST_DIR/q2.txt"
$INFLUXDBTEST_DIR/influxdbTest \
-sql $INFLUXDBTEST_DIR/q2.txt 2>&1 \
| tee $INFLUXDBTESTQ2OUT
Count10=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devgroup=~\/\[1-1\]" | awk '{print $5}'`
totalCount10=`echo "scale=4; $totalCount10 + $Count10" | bc`
Count20=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devgroup=~\/\[1-2\]" | awk '{print $5}'`
totalCount20=`echo "scale=4; $totalCount20 + $Count20" | bc`
Count30=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devgroup=~\/\[1-3\]" | awk '{print $5}'`
totalCount30=`echo "scale=4; $totalCount30 + $Count30" | bc`
Count40=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devgroup=~\/\[1-4\]" | awk '{print $5}'`
totalCount40=`echo "scale=4; $totalCount40 + $Count40" | bc`
Count50=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devgroup=~\/\[1-5\]" | awk '{print $5}'`
totalCount50=`echo "scale=4; $totalCount50 + $Count50" | bc`
Count60=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devgroup=~\/\[1-6\]" | awk '{print $5}'`
totalCount60=`echo "scale=4; $totalCount60 + $Count60" | bc`
Count70=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devgroup=~\/\[1-7\]" | awk '{print $5}'`
totalCount70=`echo "scale=4; $totalCount70 + $Count70" | bc`
Count80=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devgroup=~\/\[1-8\]" | awk '{print $5}'`
totalCount80=`echo "scale=4; $totalCount80 + $Count80" | bc`
Count90=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devgroup=~\/\[1-9\]" | awk '{print $5}'`
totalCount90=`echo "scale=4; $totalCount90 + $Count90" | bc`
Count100=`cat $INFLUXDBTESTQ2OUT | grep count | grep "devices;" | awk '{print $5}'`
totalCount100=`echo "scale=4; $totalCount100 + $Count100" | bc`
Mean10=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devgroup=~\/\[1-1\]" | awk '{print $5}'`
totalMean10=`echo "scale=4; $totalMean10 + $Mean10" | bc`
Mean20=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devgroup=~\/\[1-2\]" | awk '{print $5}'`
totalMean20=`echo "scale=4; $totalMean20 + $Mean20" | bc`
Mean30=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devgroup=~\/\[1-3\]" | awk '{print $5}'`
totalMean30=`echo "scale=4; $totalMean30 + $Mean30" | bc`
Mean40=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devgroup=~\/\[1-4\]" | awk '{print $5}'`
totalMean40=`echo "scale=4; $totalMean40 + $Mean40" | bc`
Mean50=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devgroup=~\/\[1-5\]" | awk '{print $5}'`
totalMean50=`echo "scale=4; $totalMean50 + $Mean50" | bc`
Mean60=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devgroup=~\/\[1-6\]" | awk '{print $5}'`
totalMean60=`echo "scale=4; $totalMean60 + $Mean60" | bc`
Mean70=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devgroup=~\/\[1-7\]" | awk '{print $5}'`
totalMean70=`echo "scale=4; $totalMean70 + $Mean70" | bc`
Mean80=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devgroup=~\/\[1-8\]" | awk '{print $5}'`
totalMean80=`echo "scale=4; $totalMean80 + $Mean80" | bc`
Mean90=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devgroup=~\/\[1-9\]" | awk '{print $5}'`
totalMean90=`echo "scale=4; $totalMean90 + $Mean90" | bc`
Mean100=`cat $INFLUXDBTESTQ2OUT | grep mean | grep "devices;" | awk '{print $5}'`
totalMean100=`echo "scale=4; $totalMean100 + $Mean100" | bc`
Sum10=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devgroup=~\/\[1-1\]" | awk '{print $5}'`
totalSum10=`echo "scale=4; $totalSum10 + $Sum10" | bc`
Sum20=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devgroup=~\/\[1-2\]" | awk '{print $5}'`
totalSum20=`echo "scale=4; $totalSum20 + $Sum20" | bc`
Sum30=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devgroup=~\/\[1-3\]" | awk '{print $5}'`
totalSum30=`echo "scale=4; $totalSum30 + $Sum30" | bc`
Sum40=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devgroup=~\/\[1-4\]" | awk '{print $5}'`
totalSum40=`echo "scale=4; $totalSum40 + $Sum40" | bc`
Sum50=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devgroup=~\/\[1-5\]" | awk '{print $5}'`
totalSum50=`echo "scale=4; $totalSum50 + $Sum50" | bc`
Sum60=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devgroup=~\/\[1-6\]" | awk '{print $5}'`
totalSum60=`echo "scale=4; $totalSum60 + $Sum60" | bc`
Sum70=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devgroup=~\/\[1-7\]" | awk '{print $5}'`
totalSum70=`echo "scale=4; $totalSum70 + $Sum70" | bc`
Sum80=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devgroup=~\/\[1-8\]" | awk '{print $5}'`
totalSum80=`echo "scale=4; $totalSum80 + $Sum80" | bc`
Sum90=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devgroup=~\/\[1-9\]" | awk '{print $5}'`
totalSum90=`echo "scale=4; $totalSum90 + $Sum90" | bc`
Sum100=`cat $INFLUXDBTESTQ2OUT | grep sum | grep "devices;" | awk '{print $5}'`
totalSum100=`echo "scale=4; $totalSum100 + $Sum100" | bc`
Max10=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devgroup=~\/\[1-1\]" | awk '{print $5}'`
totalMax10=`echo "scale=4; $totalMax10 + $Max10" | bc`
Max20=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devgroup=~\/\[1-2\]" | awk '{print $5}'`
totalMax20=`echo "scale=4; $totalMax20 + $Max20" | bc`
Max30=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devgroup=~\/\[1-3\]" | awk '{print $5}'`
totalMax30=`echo "scale=4; $totalMax30 + $Max30" | bc`
Max40=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devgroup=~\/\[1-4\]" | awk '{print $5}'`
totalMax40=`echo "scale=4; $totalMax40 + $Max40" | bc`
Max50=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devgroup=~\/\[1-5\]" | awk '{print $5}'`
totalMax50=`echo "scale=4; $totalMax50 + $Max50" | bc`
Max60=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devgroup=~\/\[1-6\]" | awk '{print $5}'`
totalMax60=`echo "scale=4; $totalMax60 + $Max60" | bc`
Max70=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devgroup=~\/\[1-7\]" | awk '{print $5}'`
totalMax70=`echo "scale=4; $totalMax70 + $Max70" | bc`
Max80=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devgroup=~\/\[1-8\]" | awk '{print $5}'`
totalMax80=`echo "scale=4; $totalMax80 + $Max80" | bc`
Max90=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devgroup=~\/\[1-9\]" | awk '{print $5}'`
totalMax90=`echo "scale=4; $totalMax90 + $Max90" | bc`
Max100=`cat $INFLUXDBTESTQ2OUT | grep max | grep "devices;" | awk '{print $5}'`
totalMax100=`echo "scale=4; $totalMax100 + $Max100" | bc`
Min10=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devgroup=~\/\[1-1\]" | awk '{print $5}'`
totalMin10=`echo "scale=4; $totalMin10 + $Min10" | bc`
Min20=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devgroup=~\/\[1-2\]" | awk '{print $5}'`
totalMin20=`echo "scale=4; $totalMin20 + $Min20" | bc`
Min30=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devgroup=~\/\[1-3\]" | awk '{print $5}'`
totalMin30=`echo "scale=4; $totalMin30 + $Min30" | bc`
Min40=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devgroup=~\/\[1-4\]" | awk '{print $5}'`
totalMin40=`echo "scale=4; $totalMin40 + $Min40" | bc`
Min50=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devgroup=~\/\[1-5\]" | awk '{print $5}'`
totalMin50=`echo "scale=4; $totalMin50 + $Min50" | bc`
Min60=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devgroup=~\/\[1-6\]" | awk '{print $5}'`
totalMin60=`echo "scale=4; $totalMin60 + $Min60" | bc`
Min70=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devgroup=~\/\[1-7\]" | awk '{print $5}'`
totalMin70=`echo "scale=4; $totalMin70 + $Min70" | bc`
Min80=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devgroup=~\/\[1-8\]" | awk '{print $5}'`
totalMin80=`echo "scale=4; $totalMin80 + $Min80" | bc`
Min90=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devgroup=~\/\[1-9\]" | awk '{print $5}'`
totalMin90=`echo "scale=4; $totalMin90 + $Min90" | bc`
Min100=`cat $INFLUXDBTESTQ2OUT | grep min | grep "devices;" | awk '{print $5}'`
totalMin100=`echo "scale=4; $totalMin100 + $Min100" | bc`
Spread10=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devgroup=~\/\[1-1\]" | awk '{print $5}'`
totalSpread10=`echo "scale=4; $totalSpread10 + $Spread10" | bc`
Spread20=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devgroup=~\/\[1-2\]" | awk '{print $5}'`
totalSpread20=`echo "scale=4; $totalSpread20 + $Spread20" | bc`
Spread30=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devgroup=~\/\[1-3\]" | awk '{print $5}'`
totalSpread30=`echo "scale=4; $totalSpread30 + $Spread30" | bc`
Spread40=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devgroup=~\/\[1-4\]" | awk '{print $5}'`
totalSpread40=`echo "scale=4; $totalSpread40 + $Spread40" | bc`
Spread50=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devgroup=~\/\[1-5\]" | awk '{print $5}'`
totalSpread50=`echo "scale=4; $totalSpread50 + $Spread50" | bc`
Spread60=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devgroup=~\/\[1-6\]" | awk '{print $5}'`
totalSpread60=`echo "scale=4; $totalSpread60 + $Spread60" | bc`
Spread70=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devgroup=~\/\[1-7\]" | awk '{print $5}'`
totalSpread70=`echo "scale=4; $totalSpread70 + $Spread70" | bc`
Spread80=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devgroup=~\/\[1-8\]" | awk '{print $5}'`
totalSpread80=`echo "scale=4; $totalSpread80 + $Spread80" | bc`
Spread90=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devgroup=~\/\[1-9\]" | awk '{print $5}'`
totalSpread90=`echo "scale=4; $totalSpread90 + $Spread90" | bc`
Spread100=`cat $INFLUXDBTESTQ2OUT | grep spread | grep "devices;" | awk '{print $5}'`
totalSpread100=`echo "scale=4; $totalSpread100 + $Spread100" | bc`
done
avgCount10=`echo "scale=4; x = $totalCount10 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgCount20=`echo "scale=4; x = $totalCount20 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgCount30=`echo "scale=4; x = $totalCount30 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgCount40=`echo "scale=4; x = $totalCount40 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgCount50=`echo "scale=4; x = $totalCount50 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgCount60=`echo "scale=4; x = $totalCount60 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgCount70=`echo "scale=4; x = $totalCount70 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgCount80=`echo "scale=4; x = $totalCount80 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgCount90=`echo "scale=4; x = $totalCount90 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgCount100=`echo "scale=4; x = $totalCount100 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean10=`echo "scale=4; x = $totalMean10 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean20=`echo "scale=4; x = $totalMean20 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean30=`echo "scale=4; x = $totalMean30 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean40=`echo "scale=4; x = $totalMean40 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean50=`echo "scale=4; x = $totalMean50 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean60=`echo "scale=4; x = $totalMean60 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean70=`echo "scale=4; x = $totalMean70 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean80=`echo "scale=4; x = $totalMean80 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean90=`echo "scale=4; x = $totalMean90 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMean100=`echo "scale=4; x = $totalMean100 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum10=`echo "scale=4; x = $totalSum10 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum20=`echo "scale=4; x = $totalSum20 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum30=`echo "scale=4; x = $totalSum30 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum40=`echo "scale=4; x = $totalSum40 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum50=`echo "scale=4; x = $totalSum50 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum60=`echo "scale=4; x = $totalSum60 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum70=`echo "scale=4; x = $totalSum70 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum80=`echo "scale=4; x = $totalSum80 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum90=`echo "scale=4; x = $totalSum90 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSum100=`echo "scale=4; x = $totalSum100 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax10=`echo "scale=4; x = $totalMax10 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax20=`echo "scale=4; x = $totalMax20 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax30=`echo "scale=4; x = $totalMax30 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax40=`echo "scale=4; x = $totalMax40 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax50=`echo "scale=4; x = $totalMax50 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax60=`echo "scale=4; x = $totalMax60 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax70=`echo "scale=4; x = $totalMax70 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax80=`echo "scale=4; x = $totalMax80 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax90=`echo "scale=4; x = $totalMax90 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMax100=`echo "scale=4; x = $totalMax100 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin10=`echo "scale=4; x = $totalMin10 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin20=`echo "scale=4; x = $totalMin20 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin30=`echo "scale=4; x = $totalMin30 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin40=`echo "scale=4; x = $totalMin40 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin50=`echo "scale=4; x = $totalMin50 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin60=`echo "scale=4; x = $totalMin60 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin70=`echo "scale=4; x = $totalMin70 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin80=`echo "scale=4; x = $totalMin80 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin90=`echo "scale=4; x = $totalMin90 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgMin100=`echo "scale=4; x = $totalMin100 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread10=`echo "scale=4; x = $totalSpread10 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread20=`echo "scale=4; x = $totalSpread20 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread30=`echo "scale=4; x = $totalSpread30 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread40=`echo "scale=4; x = $totalSpread40 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread50=`echo "scale=4; x = $totalSpread50 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread60=`echo "scale=4; x = $totalSpread60 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread70=`echo "scale=4; x = $totalSpread70 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread80=`echo "scale=4; x = $totalSpread80 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread90=`echo "scale=4; x = $totalSpread90 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgSpread100=`echo "scale=4; x = $totalSpread100 / $NUM_LOOP; if(x<1) print 0; x" | bc`
echo "Latency, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%"
echo "Count, $avgCount10, $avgCount20, $avgCount30, $avgCount40, $avgCount50, $avgCount60, $avgCount70, $avgCount80, $avgCount90, $avgCount100"
echo "Mean, $avgMean10, $avgMean20, $avgMean30, $avgMean40, $avgMean50, $avgMean60, $avgMean70, $avgMean80, $avgMean90, $avgMean100"
echo "Sum, $avgSum10, $avgSum20, $avgSum30, $avgSum40, $avgSum50, $avgSum60, $avgSum70, $avgSum80, $avgSum90, $avgSum100"
echo "Max, $avgMax10, $avgMax20, $avgMax30, $avgMax40, $avgMax50, $avgMax60, $avgMax70, $avgMax80, $avgMax90, $avgMax100"
echo "Min, $avgMin10, $avgMin20, $avgMin30, $avgMin40, $avgMin50, $avgMin60, $avgMin70, $avgMin80, $avgMin90, $avgMin100"
echo "Spread, $avgSpread10, $avgSpread20, $avgSpread30, $avgSpread40, $avgSpread50, $avgSpread60, $avgSpread70, $avgSpread80, $avgSpread90, $avgSpread100"
}
################ Main ################
verbose=false
for arg in "$@"
do
case $arg in
-v)
verbose=true
shift ;;
-c)
clients=$2
shift 2;;
-n)
NUM_LOOP=$2
shift 2;;
*)
;;
esac
done
WORK_DIR=/mnt/root/TDengine
INFLUXDBTEST_DIR=$WORK_DIR/tests/comparisonTest/influxdb
runTest
printTo "Test done!"
#!/bin/bash
NUM_LOOP=5
function printTo {
if $verbose ; then
echo $1
fi
}
INFLUXDBTESTQ3OUT=opentsdbTestQ3.out
function runTest {
totalG10=0
totalG20=0
totalG30=0
totalG40=0
totalG50=0
totalG60=0
totalG70=0
totalG80=0
totalG90=0
totalG100=0
for i in `seq 1 $NUM_LOOP`; do
printTo "loop i:$i, $INFLUXDBTEST_DIR/influxdbTest \
-sql $INFLUXDBTEST_DIR/q3.txt"
$INFLUXDBTEST_DIR/influxdbTest \
-sql $INFLUXDBTEST_DIR/q3.txt 2>&1 \
| tee $INFLUXDBTESTQ3OUT
G10=`grep -w "devgroup=~\/\[1-1\]" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG10=`echo "scale=4; $totalG10 + $G10" | bc`
G20=`grep -w "devgroup=~\/\[1-2\]" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG20=`echo "scale=4; $totalG20 + $G20" | bc`
G30=`grep -w "devgroup=~\/\[1-3\]" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG30=`echo "scale=4; $totalG30 + $G30" | bc`
G40=`grep -w "devgroup=~\/\[1-4\]" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG40=`echo "scale=4; $totalG40 + $G40" | bc`
G50=`grep -w "devgroup=~\/\[1-5\]" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG50=`echo "scale=4; $totalG50 + $G50" | bc`
G60=`grep -w "devgroup=~\/\[1-6\]" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG60=`echo "scale=4; $totalG60 + $G60" | bc`
G70=`grep -w "devgroup=~\/\[1-7\]" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG70=`echo "scale=4; $totalG70 + $G70" | bc`
G80=`grep -w "devgroup=~\/\[1-8\]" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG80=`echo "scale=4; $totalG80 + $G80" | bc`
G90=`grep -w "devgroup=~\/\[1-9\]" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG90=`echo "scale=4; $totalG90 + $G90" | bc`
G100=`grep -w "devices group by devgroup;" $INFLUXDBTESTQ3OUT| awk '{print $5}'`
totalG100=`echo "scale=4; $totalG100 + $G100" | bc`
done
avgG10=`echo "scale=4; x = $totalG10 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG20=`echo "scale=4; x = $totalG20 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG30=`echo "scale=4; x = $totalG30 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG40=`echo "scale=4; x = $totalG40 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG50=`echo "scale=4; x = $totalG50 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG60=`echo "scale=4; x = $totalG60 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG70=`echo "scale=4; x = $totalG70 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG80=`echo "scale=4; x = $totalG80 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG90=`echo "scale=4; x = $totalG90 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG100=`echo "scale=4; x = $totalG100 / $NUM_LOOP; if(x<1) print 0; x" | bc`
echo "Latency, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%"
echo "InfluxDB, $avgG10, $avgG20, $avgG30, $avgG40, $avgG50, $avgG60, $avgG70, $avgG80, $avgG90, $avgG100"
}
################ Main ################
verbose=false
for arg in "$@"
do
case $arg in
-v)
verbose=true
shift ;;
-c)
clients=$2
shift 2;;
-n)
NUM_LOOP=$2
shift 2;;
*)
;;
esac
done
WORK_DIR=/mnt/root/TDengine
INFLUXDBTEST_DIR=$WORK_DIR/tests/comparisonTest/influxdb
runTest
printTo "Test done!"
#!/bin/bash -x
DATA_DIR=/mnt/root/testdata
NUM_LOOP=5
function printTo {
if $verbose ; then
echo $1
fi
}
INFLUXDBTESTQ4OUT=influxdbTestQ4.out
function runTest {
totalG10=0
totalG20=0
totalG30=0
totalG40=0
totalG50=0
totalG60=0
totalG70=0
totalG80=0
totalG90=0
totalG100=0
for i in `seq 1 $NUM_LOOP`; do
printTo "loop i:$i, $INFLUXDBTEST_DIR/influxdbTest \
-sql $INFLUXDBTEST_DIR/q4.txt"
$INFLUXDBTEST_DIR/influxdbTest \
-sql $INFLUXDBTEST_DIR/q4.txt 2>&1 |
tee $INFLUXDBTESTQ4OUT
G10=`grep -w "devgroup=~\/\[1-1\]" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG10=`echo "scale=4; $totalG10 + $G10" | bc`
G20=`grep -w "devgroup=~\/\[1-2\]" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG20=`echo "scale=4; $totalG20 + $G20" | bc`
G30=`grep -w "devgroup=~\/\[1-3\]" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG30=`echo "scale=4; $totalG30 + $G30" | bc`
G40=`grep -w "devgroup=~\/\[1-4\]" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG40=`echo "scale=4; $totalG40 + $G40" | bc`
G50=`grep -w "devgroup=~\/\[1-5\]" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG50=`echo "scale=4; $totalG50 + $G50" | bc`
G60=`grep -w "devgroup=~\/\[1-6\]" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG60=`echo "scale=4; $totalG60 + $G60" | bc`
G70=`grep -w "devgroup=~\/\[1-7\]" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG70=`echo "scale=4; $totalG70 + $G70" | bc`
G80=`grep -w "devgroup=~\/\[1-8\]" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG80=`echo "scale=4; $totalG80 + $G80" | bc`
G90=`grep -w "devgroup=~\/\[1-9\]" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG90=`echo "scale=4; $totalG90 + $G90" | bc`
G100=`grep -w "devices group by time" $INFLUXDBTESTQ4OUT| awk '{print $5}'`
totalG100=`echo "scale=4; $totalG100 + $G100" | bc`
done
avgG10=`echo "scale=4; x = $totalG10 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG20=`echo "scale=4; x = $totalG20 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG30=`echo "scale=4; x = $totalG30 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG40=`echo "scale=4; x = $totalG40 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG50=`echo "scale=4; x = $totalG50 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG60=`echo "scale=4; x = $totalG60 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG70=`echo "scale=4; x = $totalG70 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG80=`echo "scale=4; x = $totalG80 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG90=`echo "scale=4; x = $totalG90 / $NUM_LOOP; if(x<1) print 0; x" | bc`
avgG100=`echo "scale=4; x = $totalG100 / $NUM_LOOP; if(x<1) print 0; x" | bc`
echo "Latency, 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, 90%, 100%"
echo "InfluxDB, $avgG10, $avgG20, $avgG30, $avgG40, $avgG50, $avgG60, $avgG70, $avgG80, $avgG90, $avgG100"
}
################ Main ################
verbose=false
regeneratedata=false
for arg in "$@"
do
case $arg in
-v)
verbose=true
shift ;;
-c)
clients=$2
shift 2;;
-r)
regeneratedata=true
;;
-n)
NUM_LOOP=$2
shift 2;;
*)
;;
esac
done
WORK_DIR=/mnt/root/TDengine
INFLUXDBTEST_DIR=$WORK_DIR/tests/comparisonTest/influxdb
runTest
printTo "Test done!"
...@@ -21,17 +21,16 @@ function runTest { ...@@ -21,17 +21,16 @@ function runTest {
done done
done done
for r in ${rowsPerRequest[@]}; do for r in ${!rowsPerRequest[@]}; do
if [ "$r" == "1" ] || [ "$r" == "100" ] || [ "$r" == "1000" ]; then if [ "$r" == "1" ] || [ "$r" == "100" ] || [ "$r" == "1000" ]; then
NUM_OF_FILES=$clients NUM_OF_FILES=$clients
else else
NUM_OF_FILES=100 NUM_OF_FILES=100
fi fi
printf "$r, "
for c in `seq 1 $clients`; do for c in `seq 1 $clients`; do
totalRPR=0 totalRPR=0
OUTPUT_FILE=influxdbTestWrite-RPR$r-clients$c.out OUTPUT_FILE=influxdbTestWrite-RPR${rowsPerRequest[$r]}-clients$c.out
for i in `seq 1 $NUM_LOOP`; do for i in `seq 1 $NUM_LOOP`; do
printTo "loop i:$i, $INF_TEST_DIR/influxdbTest \ printTo "loop i:$i, $INF_TEST_DIR/influxdbTest \
-dataDir $DATA_DIR \ -dataDir $DATA_DIR \
...@@ -43,7 +42,7 @@ function runTest { ...@@ -43,7 +42,7 @@ function runTest {
-numOfFiles $NUM_OF_FILES \ -numOfFiles $NUM_OF_FILES \
-writeClients $c \ -writeClients $c \
-rowsPerRequest $r 2>&1 \ -rowsPerRequest $r 2>&1 \
> $OUTPUT_FILE | tee $OUTPUT_FILE
RPR=`cat $OUTPUT_FILE | grep speed | awk '{print $(NF-1)}'` RPR=`cat $OUTPUT_FILE | grep speed | awk '{print $(NF-1)}'`
totalRPR=`echo "scale=4; $totalRPR + $RPR" | bc` totalRPR=`echo "scale=4; $totalRPR + $RPR" | bc`
printTo "rows:$r, clients:$c, i:$i RPR:$RPR" printTo "rows:$r, clients:$c, i:$i RPR:$RPR"
......
#!/bin/bash #!/bin/bash
DATA_DIR=/mnt/root/testdata DATA_DIR=/mnt/root/testdata
NUM_LOOP=1 NUM_LOOP=5
NUM_OF_FILES=100 NUM_OF_FILES=100
rowsPerRequest=(1 100 500 1000 2000) rowsPerRequest=(1 100 500 1000 2000)
...@@ -13,20 +13,19 @@ function printTo { ...@@ -13,20 +13,19 @@ function printTo {
} }
function runTest { function runTest {
printf "R/R, " declare -A avgRPR
for c in `seq 1 $clients`; do
if [ "$c" == "1" ]; then for r in ${!rowsPerRequest[@]}; do
printf "$c client, " for c in `seq 1 $clients`; do
else avgRPR[$r,$c]=0
printf "$c clients, " done
fi
done done
printf "\n"
for r in ${rowsPerRequest[@]}; do for r in ${!rowsPerRequest[@]}; do
printf "$r, "
for c in `seq 1 $clients`; do for c in `seq 1 $clients`; do
totalRPR=0 totalRPR=0
OUTPUT_FILE=tdengineTestWrite-RPR${rowsPerRequest[$r]}-clients$c.out
for i in `seq 1 $NUM_LOOP`; do for i in `seq 1 $NUM_LOOP`; do
restartTaosd restartTaosd
$TAOSD_DIR/taos -s "drop database db" > /dev/null 2>&1 $TAOSD_DIR/taos -s "drop database db" > /dev/null 2>&1
...@@ -34,18 +33,36 @@ function runTest { ...@@ -34,18 +33,36 @@ function runTest {
-dataDir $DATA_DIR \ -dataDir $DATA_DIR \
-numOfFiles $NUM_OF_FILES \ -numOfFiles $NUM_OF_FILES \
-w -clients $c \ -w -clients $c \
-rowsPerRequest $r" -rowsPerRequest ${rowsPerRequest[$r]}"
RPR=`$TDTEST_DIR/tdengineTest \ $TDTEST_DIR/tdengineTest \
-dataDir $DATA_DIR \ -dataDir $DATA_DIR \
-numOfFiles $NUM_OF_FILES \ -numOfFiles $NUM_OF_FILES \
-w -clients $c \ -w -clients $c \
-rowsPerRequest $r \ -rowsPerRequest ${rowsPerRequest[$r]} \
| grep speed | awk '{print $(NF-1)}'` | tee $OUTPUT_FILE
RPR=`cat $OUTPUT_FILE | grep speed | awk '{print $(NF-1)}'`
totalRPR=`echo "scale=4; $totalRPR + $RPR" | bc` totalRPR=`echo "scale=4; $totalRPR + $RPR" | bc`
printTo "rows:$r, clients:$c, i:$i RPR:$RPR" printTo "rows:${rowsPerRequest[$r]}, clients:$c, i:$i RPR:$RPR"
done done
avgRPR=`echo "scale=4; $totalRPR / $NUM_LOOP" | bc` avgRPR[$r,$c]=`echo "scale=4; $totalRPR / $NUM_LOOP" | bc`
printf "$avgRPR, " printTo "r:${rowsPerRequest[$r]} c:$c avgRPR:${avgRPR[$r,$c]}"
done
done
printf "R/R, "
for c in `seq 1 $clients`; do
if [ "$c" == "1" ]; then
printf "$c client, "
else
printf "$c clients, "
fi
done
printf "\n"
for r in ${!rowsPerRequest[@]}; do
printf "${rowsPerRequest[$r]}, "
for c in `seq 1 $clients`; do
printf "${avgRPR[$r,$c]}, "
done done
printf "\n" printf "\n"
done done
...@@ -80,10 +97,6 @@ while : ; do ...@@ -80,10 +97,6 @@ while : ; do
verbose=true verbose=true
shift ;; shift ;;
-n)
NUM_LOOP=$2
shift 2;;
master) master)
master=true master=true
develop=false develop=false
...@@ -98,18 +111,22 @@ while : ; do ...@@ -98,18 +111,22 @@ while : ; do
clients=$2 clients=$2
shift 2;; shift 2;;
-n)
NUM_LOOP=$2
shift 2;;
*) *)
break ;; break ;;
esac esac
done done
if $master ; then if $master ; then
printTo "Test master branch.." echo "Test master branch.."
cp /mnt/root/cfg/master/taos.cfg /etc/taos/taos.cfg cp /mnt/root/cfg/master/taos.cfg /etc/taos/taos.cfg
WORK_DIR=/mnt/root/TDengine.master WORK_DIR=/mnt/root/TDengine.master
else else
printTo "Test develop branch.." echo "Test develop branch.."
cp /mnt/root/cfg/perftest/taos.cfg /etc/taos/taos.cfg cp /mnt/root/cfg/develop/taos.cfg /etc/taos/taos.cfg
WORK_DIR=/mnt/root/TDengine WORK_DIR=/mnt/root/TDengine
fi fi
...@@ -118,4 +135,4 @@ TDTEST_DIR=$WORK_DIR/tests/comparisonTest/tdengine ...@@ -118,4 +135,4 @@ TDTEST_DIR=$WORK_DIR/tests/comparisonTest/tdengine
runTest runTest
printTo "Test done!" echo "Test done!"
...@@ -49,11 +49,7 @@ class TDTestCase: ...@@ -49,11 +49,7 @@ class TDTestCase:
tdSql.query("select col1 + col2 from test1") tdSql.query("select col1 + col2 from test1")
tdSql.checkRows(10) tdSql.checkRows(10)
tdSql.checkData(0, 0, 2.0) tdSql.checkData(0, 0, 2.0)
tdSql.query("select col1 + col2 * col3 from test1")
tdSql.checkRows(10)
tdSql.checkData(1, 0, 6.0)
tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 from test1") tdSql.query("select col1 + col2 * col3 + col3 / col4 + col5 + col6 from test1")
tdSql.checkRows(10) tdSql.checkRows(10)
......
...@@ -36,7 +36,8 @@ class TDTestCase: ...@@ -36,7 +36,8 @@ class TDTestCase:
"insert into tb2 using stb1 tags(2,'tb2', '表2') values ('2020-04-18 15:00:02.000', 3, 2.1), ('2020-04-18 15:00:03.000', 4, 2.2)") "insert into tb2 using stb1 tags(2,'tb2', '表2') values ('2020-04-18 15:00:02.000', 3, 2.1), ('2020-04-18 15:00:03.000', 4, 2.2)")
# inner join --- bug # inner join --- bug
tdSql.error("select * from tb1 a, tb2 b where a.ts = b.ts") tdSql.query("select * from tb1 a, tb2 b where a.ts = b.ts")
tdSql.checkRows(0)
# join 3 tables -- bug exists # join 3 tables -- bug exists
tdSql.error("select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_p.id, stb_p.dscrption, stb_p.pressure,stb_v.velocity from stb_p, stb_t, stb_v where stb_p.ts=stb_t.ts and stb_p.ts=stb_v.ts and stb_p.id = stb_t.id") tdSql.error("select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_p.id, stb_p.dscrption, stb_p.pressure,stb_v.velocity from stb_p, stb_t, stb_v where stb_p.ts=stb_t.ts and stb_p.ts=stb_v.ts and stb_p.id = stb_t.id")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册