Changeset: 17d27e7daf68 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=17d27e7daf68
Modified Files:
common/utils/msabaoth.c
sql/benchmarks/tpch/Tests/01-explain.stable.out
sql/benchmarks/tpch/Tests/01-explain.stable.out.int128
sql/benchmarks/tpch/Tests/01-plan.stable.out
sql/benchmarks/tpch/Tests/03-explain.stable.out
sql/benchmarks/tpch/Tests/03-plan.stable.out
sql/benchmarks/tpch/Tests/05-explain.stable.out
sql/benchmarks/tpch/Tests/05-plan.stable.out
sql/benchmarks/tpch/Tests/06-explain.stable.out
sql/benchmarks/tpch/Tests/06-plan.stable.out
sql/benchmarks/tpch/Tests/07-explain.stable.out
sql/benchmarks/tpch/Tests/07-plan.stable.out
sql/benchmarks/tpch/Tests/08-explain.stable.out
sql/benchmarks/tpch/Tests/08-plan.stable.out
sql/benchmarks/tpch/Tests/09-explain.stable.out
sql/benchmarks/tpch/Tests/09-plan.stable.out
sql/benchmarks/tpch/Tests/10-explain.stable.out
sql/benchmarks/tpch/Tests/10-plan.stable.out
sql/benchmarks/tpch/Tests/11-explain.stable.out
sql/benchmarks/tpch/Tests/11-plan.stable.out
sql/benchmarks/tpch/Tests/14-explain.stable.out
sql/benchmarks/tpch/Tests/14-explain.stable.out.int128
sql/benchmarks/tpch/Tests/14-plan.stable.out
sql/benchmarks/tpch/Tests/15-explain.stable.out
sql/benchmarks/tpch/Tests/15-plan.stable.out
sql/benchmarks/tpch/Tests/17-explain.stable.out
sql/benchmarks/tpch/Tests/17-explain.stable.out.int128
sql/benchmarks/tpch/Tests/17-plan.stable.out
sql/benchmarks/tpch/Tests/18-plan.stable.out
sql/benchmarks/tpch/Tests/19-explain.stable.out
sql/benchmarks/tpch/Tests/19-plan.stable.out
sql/benchmarks/tpch/Tests/20-explain.stable.out.int128
sql/benchmarks/tpch/Tests/20-plan.stable.out
tools/merovingian/daemon/client.c
tools/merovingian/daemon/connections.c
tools/merovingian/daemon/controlrunner.c
tools/merovingian/daemon/discoveryrunner.c
tools/merovingian/daemon/forkmserver.c
tools/merovingian/daemon/handlers.c
tools/merovingian/daemon/handlers.h
tools/merovingian/daemon/merovingian.c
tools/merovingian/daemon/merovingian.h
tools/merovingian/daemon/multiplex-funnel.c
tools/merovingian/utils/properties.c
Branch: iot
Log Message:
Merge with default
diffs (truncated from 2139 to 300 lines):
diff --git a/common/utils/msabaoth.c b/common/utils/msabaoth.c
--- a/common/utils/msabaoth.c
+++ b/common/utils/msabaoth.c
@@ -594,6 +594,85 @@ msab_getSingleStatus(const char *pathbuf
sdb->path = strdup(buf);
sdb->dbname = sdb->path + strlen(sdb->path) - strlen(dbname);
+
+ /* check the state of the server by looking at its gdk lock:
+ * - if we can lock it, the server has crashed or isn't running
+ * - if we can't open it because it's locked, the server is
+ * running
+ * - to distinguish between a crash and proper shutdown, consult
+ * the uplog
+ * - one exception to all above; if this is the same process, we
+ * cannot lock (it always succeeds), hence, if we have the
+ * same signature, we assume running if the uplog states so.
+ */
+ snprintf(buf, sizeof(buf), "%s/%s/%s", pathbuf, dbname,
+ _sabaoth_internal_uuid);
+ if (stat(buf, &statbuf) != -1) {
+ /* database has the same process signature as ours, which
+ * means, it must be us, rely on the uplog state */
+ snprintf(log, sizeof(log), "%s/%s/%s", pathbuf, dbname,
UPLOGFILE);
+ if ((f = fopen(log, "r")) != NULL) {
+ (void)fseek(f, -1, SEEK_END);
+ if (fread(data, 1, 1, f) != 1) {
+ /* the log is empty, assume no crash */
+ sdb->state = SABdbInactive;
+ } else if (data[0] == '\t') {
+ /* see if the database has finished starting */
+ snprintf(buf, sizeof(buf), "%s/%s/%s",
+ pathbuf, dbname, STARTEDFILE);
+ if (stat(buf, &statbuf) == -1) {
+ sdb->state = SABdbStarting;
+ } else {
+ sdb->state = SABdbRunning;
+ }
+ } else { /* should be \n */
+ sdb->state = SABdbInactive;
+ }
+ (void)fclose(f);
+ }
+ } else if ((snprintf(buf, sizeof(buf), "%s/%s/%s", pathbuf, dbname,
".gdk_lock") > 0) & /* no typo */
+ ((fd = MT_lockf(buf, F_TEST, 4, 1)) == -2)) {
+ /* Locking failed; this can be because the lockfile couldn't
+ * be created. Probably there is no Mserver running for
+ * that case also.
+ */
+ sdb->state = SABdbInactive;
+ } else if (fd == -1) {
+ /* file is locked, so mserver is running, see if the database
+ * has finished starting */
+ snprintf(buf, sizeof(buf), "%s/%s/%s",
+ pathbuf, dbname, STARTEDFILE);
+ if (stat(buf, &statbuf) == -1) {
+ sdb->state = SABdbStarting;
+ } else {
+ sdb->state = SABdbRunning;
+ }
+ } else {
+ /* file is not locked, check for a crash in the uplog */
+ snprintf(log, sizeof(log), "%s/%s/%s", pathbuf, dbname,
UPLOGFILE);
+ if ((f = fopen(log, "r")) != NULL) {
+ (void)fseek(f, -1, SEEK_END);
+ if (fread(data, 1, 1, f) != 1) {
+ /* the log is empty, assume no crash */
+ sdb->state = SABdbInactive;
+ } else if (data[0] == '\n') {
+ sdb->state = SABdbInactive;
+ } else { /* should be \t */
+ sdb->state = SABdbCrashed;
+ }
+ (void)fclose(f);
+ } else {
+ /* no uplog, so presumably never started */
+ sdb->state = SABdbInactive;
+ }
+ }
+ snprintf(buf, sizeof(buf), "%s/%s/%s", pathbuf, dbname,
MAINTENANCEFILE);
+ if (stat(buf, &statbuf) == -1) {
+ sdb->locked = 0;
+ } else {
+ sdb->locked = 1;
+ }
+
/* add scenarios that are supported */
sdb->scens = NULL;
snprintf(buf, sizeof(buf), "%s/%s/%s", pathbuf, dbname, SCENARIOFILE);
@@ -638,84 +717,6 @@ msab_getSingleStatus(const char *pathbuf
(void)fclose(f);
}
-
- /* check the state of the server by looking at its gdk lock:
- * - if we can lock it, the server has crashed or isn't running
- * - if we can't open it because it's locked, the server is
- * running
- * - to distinguish between a crash and proper shutdown, consult
- * the uplog
- * - one exception to all above; if this is the same process, we
- * cannot lock (it always succeeds), hence, if we have the
- * same signature, we assume running if the uplog states so.
- */
- snprintf(buf, sizeof(buf), "%s/%s/%s", pathbuf, dbname,
- _sabaoth_internal_uuid);
- if (stat(buf, &statbuf) != -1) {
- /* database has the same process signature as ours, which
- * means, it must be us, rely on the uplog state */
- snprintf(log, sizeof(log), "%s/%s/%s", pathbuf, dbname,
UPLOGFILE);
- if ((f = fopen(log, "r")) != NULL) {
- (void)fseek(f, -1, SEEK_END);
- if (fread(data, 1, 1, f) != 1) {
- /* the log is empty, assume no crash */
- sdb->state = SABdbInactive;
- } else if (data[0] == '\t') {
- /* see if the database has finished starting */
- snprintf(buf, sizeof(buf), "%s/%s/%s",
- pathbuf, dbname, STARTEDFILE);
- if (stat(buf, &statbuf) == -1) {
- sdb->state = SABdbStarting;
- } else {
- sdb->state = SABdbRunning;
- }
- } else { /* should be \n */
- sdb->state = SABdbInactive;
- }
- (void)fclose(f);
- }
- } else if ((snprintf(buf, sizeof(buf), "%s/%s/%s", pathbuf, dbname,
".gdk_lock") > 0) & /* no typo */
- ((fd = MT_lockf(buf, F_TEST, 4, 1)) == -2)) {
- /* Locking failed; this can be because the lockfile couldn't
- * be created. Probably there is no Mserver running for
- * that case also.
- */
- sdb->state = SABdbInactive;
- } else if (fd == -1) {
- /* lock denied, so mserver is running, see if the database
- * has finished starting */
- snprintf(buf, sizeof(buf), "%s/%s/%s",
- pathbuf, dbname, STARTEDFILE);
- if (stat(buf, &statbuf) == -1) {
- sdb->state = SABdbStarting;
- } else {
- sdb->state = SABdbRunning;
- }
- } else {
- /* locking succeed, check for a crash in the uplog */
- snprintf(log, sizeof(log), "%s/%s/%s", pathbuf, dbname,
UPLOGFILE);
- if ((f = fopen(log, "r")) != NULL) {
- (void)fseek(f, -1, SEEK_END);
- if (fread(data, 1, 1, f) != 1) {
- /* the log is empty, assume no crash */
- sdb->state = SABdbInactive;
- } else if (data[0] == '\n') {
- sdb->state = SABdbInactive;
- } else { /* should be \t */
- sdb->state = SABdbCrashed;
- }
- (void)fclose(f);
- } else {
- /* no uplog, so presumably never started */
- sdb->state = SABdbInactive;
- }
- }
- snprintf(buf, sizeof(buf), "%s/%s/%s", pathbuf, dbname,
MAINTENANCEFILE);
- if (stat(buf, &statbuf) == -1) {
- sdb->locked = 0;
- } else {
- sdb->locked = 1;
- }
return sdb;
}
diff --git a/sql/benchmarks/tpch/Tests/01-explain.stable.out
b/sql/benchmarks/tpch/Tests/01-explain.stable.out
--- a/sql/benchmarks/tpch/Tests/01-explain.stable.out
+++ b/sql/benchmarks/tpch/Tests/01-explain.stable.out
@@ -55,14 +55,14 @@ function user.main():void;
X_1244 := bat.new(nil:str);
X_1251 := bat.append(X_1244,"sys.lineitem");
X_1261 := bat.append(X_1251,"sys.lineitem");
- X_1267 := bat.append(X_1261,"sys.L2");
- X_1277 := bat.append(X_1267,"sys.L4");
- X_1284 := bat.append(X_1277,"sys.L6");
- X_1292 := bat.append(X_1284,"sys.L10");
- X_1300 := bat.append(X_1292,"sys.L12");
- X_1310 := bat.append(X_1300,"sys.L14");
- X_1317 := bat.append(X_1310,"sys.L16");
- X_1324 := bat.append(X_1317,"sys.L20");
+ X_1267 := bat.append(X_1261,"sys.L5");
+ X_1277 := bat.append(X_1267,"sys.L10");
+ X_1284 := bat.append(X_1277,"sys.L13");
+ X_1292 := bat.append(X_1284,"sys.L16");
+ X_1300 := bat.append(X_1292,"sys.L21");
+ X_1310 := bat.append(X_1300,"sys.L24");
+ X_1317 := bat.append(X_1310,"sys.L27");
+ X_1324 := bat.append(X_1317,"sys.L32");
X_1246 := bat.new(nil:str);
X_1253 := bat.append(X_1246,"l_returnflag");
X_1262 := bat.append(X_1253,"l_linestatus");
diff --git a/sql/benchmarks/tpch/Tests/01-explain.stable.out.int128
b/sql/benchmarks/tpch/Tests/01-explain.stable.out.int128
--- a/sql/benchmarks/tpch/Tests/01-explain.stable.out.int128
+++ b/sql/benchmarks/tpch/Tests/01-explain.stable.out.int128
@@ -50,112 +50,112 @@ Ready.
% .explain # table_name
% mal # name
% clob # type
-% 109 # length
+% 124 # length
function user.main():void;
- X_844 := bat.new(nil:str);
- X_851 := bat.append(X_844,"sys.lineitem");
- X_861 := bat.append(X_851,"sys.lineitem");
- X_867 := bat.append(X_861,"sys.L5");
- X_877 := bat.append(X_867,"sys.L10");
- X_884 := bat.append(X_877,"sys.L13");
- X_892 := bat.append(X_884,"sys.L16");
- X_900 := bat.append(X_892,"sys.L21");
- X_910 := bat.append(X_900,"sys.L24");
- X_917 := bat.append(X_910,"sys.L27");
- X_924 := bat.append(X_917,"sys.L32");
- X_846 := bat.new(nil:str);
- X_853 := bat.append(X_846,"l_returnflag");
- X_862 := bat.append(X_853,"l_linestatus");
- X_869 := bat.append(X_862,"sum_qty");
- X_879 := bat.append(X_869,"sum_base_price");
- X_886 := bat.append(X_879,"sum_disc_price");
- X_894 := bat.append(X_886,"sum_charge");
- X_902 := bat.append(X_894,"avg_qty");
- X_912 := bat.append(X_902,"avg_price");
- X_919 := bat.append(X_912,"avg_disc");
- X_926 := bat.append(X_919,"count_order");
- X_847 := bat.new(nil:str);
- X_855 := bat.append(X_847,"char");
- X_864 := bat.append(X_855,"char");
- X_871 := bat.append(X_864,"decimal");
- X_881 := bat.append(X_871,"decimal");
- X_888 := bat.append(X_881,"decimal");
- X_896 := bat.append(X_888,"decimal");
- X_904 := bat.append(X_896,"double");
- X_914 := bat.append(X_904,"double");
- X_921 := bat.append(X_914,"double");
- X_928 := bat.append(X_921,"bigint");
- X_848 := bat.new(nil:int);
- X_857 := bat.append(X_848,1);
- X_865 := bat.append(X_857,1);
- X_873 := bat.append(X_865,39);
- X_882 := bat.append(X_873,39);
- X_889 := bat.append(X_882,39);
- X_897 := bat.append(X_889,39);
- X_906 := bat.append(X_897,53);
- X_915 := bat.append(X_906,53);
- X_922 := bat.append(X_915,53);
- X_930 := bat.append(X_922,64);
- X_850 := bat.new(nil:int);
- X_859 := bat.append(X_850,0);
- X_866 := bat.append(X_859,0);
- X_875 := bat.append(X_866,2);
- X_883 := bat.append(X_875,2);
- X_890 := bat.append(X_883,4);
- X_898 := bat.append(X_890,6);
- X_908 := bat.append(X_898,0);
- X_916 := bat.append(X_908,0);
- X_923 := bat.append(X_916,0);
- X_932 := bat.append(X_923,0);
- X_710 := sql.mvc();
- X_714:bat[:date] := sql.bind(X_710,"sys","lineitem","l_shipdate",0);
- C_711:bat[:oid] := sql.tid(X_710,"sys","lineitem");
- X_726:date := mtime.date_sub_msec_interval("1998-12-01",7776000000);
- C_727 := algebra.thetasubselect(X_714,C_711,X_726,"<=");
- X_729:bat[:str] := sql.bind(X_710,"sys","lineitem","l_linestatus",0);
- X_736 := algebra.projection(C_727,X_729);
- X_737:bat[:str] := sql.bind(X_710,"sys","lineitem","l_returnflag",0);
- X_744 := algebra.projection(C_727,X_737);
- (X_745,r1_44,r2_44) := group.subgroup(X_744);
- (X_748,r1_47,r2_47) := group.subgroupdone(X_736,X_745);
- X_751 := algebra.projection(r1_47,X_736);
- X_752 := algebra.projection(r1_47,X_744);
- X_763:bat[:lng] := sql.bind(X_710,"sys","lineitem","l_quantity",0);
- X_770 := algebra.projection(C_727,X_763);
- X_771:bat[:hge] := aggr.subsum(X_770,X_748,r1_47,true,true);
- X_775:bat[:lng] := sql.bind(X_710,"sys","lineitem","l_extendedprice",0);
- X_782 := algebra.projection(C_727,X_775);
- X_783:bat[:hge] := aggr.subsum(X_782,X_748,r1_47,true,true);
- X_793:bat[:lng] := sql.bind(X_710,"sys","lineitem","l_discount",0);
- X_800 := algebra.projection(C_727,X_793);
- X_801:bat[:lng] := batcalc.-(100:lng,X_800);
- X_803:bat[:hge] := batcalc.*(X_782,X_801);
- X_805:bat[:hge] := aggr.subsum(X_803,X_748,r1_47,true,true);
- X_813:bat[:lng] := sql.bind(X_710,"sys","lineitem","l_tax",0);
- X_820 := algebra.projection(C_727,X_813);
- X_824:bat[:lng] := batcalc.+(X_820,100:lng);
- X_827:bat[:hge] := batcalc.*(X_803,X_824);
- X_828:bat[:hge] := aggr.subsum(X_827,X_748,r1_47,true,true);
- X_830:bat[:dbl] := batcalc.dbl(2,X_770);
- X_832:bat[:dbl] := aggr.subavg(X_830,X_748,r1_47,true,true);
- X_834:bat[:dbl] := batcalc.dbl(2,X_782);
- X_835:bat[:dbl] := aggr.subavg(X_834,X_748,r1_47,true,true);
- X_837:bat[:dbl] := batcalc.dbl(2,X_800);
- X_838:bat[:dbl] := aggr.subavg(X_837,X_748,r1_47,true,true);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list