forked from bloomberg/comdb2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
{170477625}: Fixing dbstore function
Require a dbstore function to also be nullable. The dbstore function, however, will be evaluated for new records only. See discussion in bloomberg#3781. Signed-off-by: Rivers Zhang <[email protected]>
- Loading branch information
1 parent
129e63a
commit a9cd22c
Showing
9 changed files
with
87 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13192,4 +13192,3 @@ int comdb2_is_field_indexable(const char *table_name, int fld_idx) { | |
} | ||
return 1; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ifeq ($(TESTSROOTDIR),) | ||
include ../testcase.mk | ||
else | ||
include $(TESTSROOTDIR)/testcase.mk | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
- Testing dbstore now() - | ||
1 | ||
-- The schema change below should fail -- | ||
[ALTER TABLE t1 { tag ondisk { int i datetime t dbstore={now()} } }] failed with rc 240 column must be nullable to use a function as its default value | ||
-- The schema change below should succeed, instantly -- | ||
1 | ||
-- Verify records -- | ||
1 | ||
-- Verify records again after rebuild -- | ||
1 | ||
-- The schema change below should succeed. dta is untouched but a new index is built -- | ||
1 | ||
-- Verify records -- | ||
1 | ||
-- Verify records again after full rebuild -- | ||
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
bash -n "$0" | exit 1 | ||
|
||
dbnm=$1 | ||
|
||
cat << EOF | cdb2sql ${CDB2_OPTIONS} -tabs -s $dbnm default - >output.actual 2>&1 | ||
SELECT "- Testing dbstore now() -" | ||
CREATE TABLE t1 { tag ondisk { int i } }\$\$ | ||
INSERT INTO t1 VALUES (1) | ||
SELECT "-- The schema change below should fail --" | ||
ALTER TABLE t1 { tag ondisk { int i datetime t dbstore={now()} } }\$\$ | ||
SELECT "-- The schema change below should succeed, instantly --" | ||
ALTER TABLE t1 { tag ondisk { int i datetime t dbstore={now()} null=yes } }\$\$ | ||
INSERT INTO t1(i) VALUES (1) | ||
SELECT "-- Verify records --" | ||
SELECT COUNT(*) FROM t1 WHERE t IS NOT NULL | ||
SELECT "-- Verify records again after rebuild --" | ||
REBUILD t1 | ||
SELECT COUNT(*) FROM t1 WHERE t IS NOT NULL | ||
SELECT "-- The schema change below should succeed. dta is untouched but a new index is built --" | ||
ALTER TABLE t1 { tag ondisk { int i datetime t dbstore={now()} null=yes byte b[16] dbstore={guid()} null=yes } keys { uniqnulls "KEY_B" = b } }\$\$ | ||
INSERT INTO t1(i) VALUES (1) | ||
SELECT "-- Verify records --" | ||
SELECT COUNT(*) FROM t1 WHERE b IS NOT NULL | ||
SELECT "-- Verify records again after full rebuild --" | ||
REBUILD t1 | ||
SELECT COUNT(*) FROM t1 WHERE b IS NOT NULL | ||
EOF | ||
|
||
diff output.actual output.expected |