Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit 1201e61

Browse files
authored
Merge branch 'master' into fix/readme-platform-support
2 parents e1e8ffa + b8bf0bb commit 1201e61

File tree

307 files changed

+2527
-1743
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

307 files changed

+2527
-1743
lines changed

script/coding_style.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Another measure of the function is the number of local variables. They shouldn'
2121

2222
**PRINTF** Refrain from using `printf` and `std::cout`. Instead use the logging macros, such as LOG_LEVEL_INFO, in `common/logger.h`.
2323

24-
**DON'T REINVENT THE MACROS** Use `PL_ASSERT` in `common/macros.h` instead of regular `assert`. This header file icontains a number of macros that you should use, rather than explicitly coding some variant of them yourself.
24+
**DON'T REINVENT THE MACROS** Use `PELOTON_ASSERT` in `common/macros.h` instead of regular `assert`. This header file icontains a number of macros that you should use, rather than explicitly coding some variant of them yourself.
2525

2626
**PLAFORM-SPECIFIC CODE** Add platform-specific code only to `common/platform.h`.
2727

@@ -53,7 +53,7 @@ The example above illustrates a valid use of the `inline` keyword for the defini
5353
5454
**EDITOR MODELINES** Some editors can interpret configuration information embedded in source files, indicated with special markers. For example, emacs interprets lines marked like this: -*- mode: c -*-. Do NOT include any of these in source files. People have their own personal editor configurations, and your source files should not override them.
5555
56-
**ALLOCATING MEMORY** Use `PL_MEMCPY` macro in `common/macros.h`. Always use smart pointers, such as `std::unique_ptr`, to simplify memory management.
56+
**ALLOCATING MEMORY** Use `PELOTON_MEMCPY` macro in `common/macros.h`. Always use smart pointers, such as `std::unique_ptr`, to simplify memory management.
5757
5858
**PRINTING PELOTON MESSAGES** Peloton developers like to be seen as literate. Do mind the spelling of messages to make a good impression. Do not use crippled words like "dont"; use "do not" or "don't" instead. Make the messages concise, clear, and unambiguous. Use appropriate log levels, such as LOG_LEVEL_TRACE, in `common/logger.h`. Coming up with good debugging messages can be quite a challenge; and once you have them, they can be a huge help for troubleshooting.
5959

script/testing/jdbc/README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
## Simple JDBC test for Peloton
22

3-
The java program here provides simple JDBC operation tests for Peloton database. To run the test, simply type:
3+
The java program here provides simple JDBC operation tests for Peloton
4+
database.
45

5-
test_jdbc.sh <type>
6+
To run the test:
7+
1. Start peloton. Typically, locally, so hostname would be localhost
8+
and if default port would be 15721
69

7-
Where 'type' is either 'basic', 'stats', or 'copy'
10+
2. Compile and run the test:
11+
test_jdbc.sh <type> <hostname> <port>
12+
13+
e.g. test_jdbc.sh PelotonBasicTest localhost 15721
14+
15+
Where 'type' is one of:
16+
PelotonBasicTest
17+
PelotonErrorTest
18+
PelotonTypeTest
19+
StocklevelTest
20+
SSLTest
821

922
The program performs the following tests:
1023

script/testing/junit/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11

2-
!Makefile
2+
!Makefile
3+
!lib/*.jar

script/testing/junit/InsertPSTest.java

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ public void testPS_1Tuple_CS_1() throws SQLException {
111111
* Prepared statement, 1 tuple insert, with columns inserted
112112
* in different order from schema.
113113
*/
114-
115-
// Currently fails. See #1197
116114
@Test
117115
public void testPS_1Tuple_CS_2() throws SQLException {
118116

@@ -135,8 +133,6 @@ public void testPS_1Tuple_CS_2() throws SQLException {
135133
* Prepared statement, 1 tuple insert, with columns inserted
136134
* in different order from schema, with one constant column.
137135
*/
138-
139-
// Currently fails. See #1197
140136
@Test
141137
public void testPS_1Tuple_CS_3() throws SQLException {
142138

@@ -182,8 +178,6 @@ public void testPS_1Tuple_CS_4() throws SQLException {
182178
* Prepared statement, 1 tuple insert, with columns inserted
183179
* in schema order, one constant column
184180
*/
185-
// Works, due to use of insert rather than push back
186-
187181
@Test
188182
public void testPS_1Tuple_CS_5() throws SQLException {
189183

@@ -205,8 +199,6 @@ public void testPS_1Tuple_CS_5() throws SQLException {
205199
/**
206200
* Prepared statement, 1 tuple insert, all constants
207201
*/
208-
// Works, due to use of insert rather than push back
209-
210202
@Test
211203
public void testPS_1Tuple_CS_6() throws SQLException {
212204

@@ -295,7 +287,6 @@ public void testPS_2Tuple_CS_1() throws SQLException {
295287
* Prepared statement, 2 tuple insert, with columns inserted
296288
* in different order from schema.
297289
*/
298-
// Currently fails. See #1197
299290
@Test
300291
public void testPS_2Tuple_CS_2() throws SQLException {
301292

@@ -325,7 +316,6 @@ public void testPS_2Tuple_CS_2() throws SQLException {
325316
* Prepared statement, 2 tuple insert, with columns inserted
326317
* in different order from schema, with one constant column.
327318
*/
328-
// Currently fails. See #1197
329319
@Test
330320
public void testPS_2Tuple_CS_3() throws SQLException {
331321

@@ -355,7 +345,6 @@ public void testPS_2Tuple_CS_3() throws SQLException {
355345
* in different order from schema, with one constant column.
356346
* Variant of above, with constant column last.
357347
*/
358-
// Currently fails. See #1197
359348
@Test
360349
public void testPS_2Tuple_CS_3a() throws SQLException {
361350

@@ -384,7 +373,6 @@ public void testPS_2Tuple_CS_3a() throws SQLException {
384373
* Prepared statement, 2 tuple insert, with columns inserted
385374
* in schema order, with 2nd column missing.
386375
*/
387-
// Currently failing. See comments in #1197
388376
@Test
389377
public void testPS_2Tuple_CS_4() throws SQLException {
390378

@@ -419,7 +407,7 @@ public void testPS_2Tuple_CS_4() throws SQLException {
419407
/**
420408
* 1 tuple insert, with no column specification.
421409
*/
422-
//@Test
410+
@Test
423411
public void test_1Tuple_NCS() throws SQLException {
424412

425413
String sql = "INSERT INTO tbl VALUES (1, 2, 3);";
@@ -440,7 +428,7 @@ public void test_1Tuple_NCS() throws SQLException {
440428
/**
441429
* 1 tuple insert, with columns inserted in schema order.
442430
*/
443-
//@Test
431+
@Test
444432
public void test_1Tuple_CS_1() throws SQLException {
445433

446434
String sql = "INSERT INTO tbl (c1, c2, c3) VALUES (1, 2, 3);";
@@ -461,7 +449,7 @@ public void test_1Tuple_CS_1() throws SQLException {
461449
/**
462450
* 1 tuple insert, with columns inserted in different order from schema.
463451
*/
464-
//@Test
452+
@Test
465453
public void test_1Tuple_CS_2() throws SQLException {
466454

467455
String sql = "INSERT INTO tbl (c3, c1, c2) VALUES (3, 1, 2);";
@@ -484,7 +472,7 @@ public void test_1Tuple_CS_2() throws SQLException {
484472
/**
485473
* 2 tuple insert, with no column specification.
486474
*/
487-
//@Test
475+
@Test
488476
public void test_2Tuple_NCS() throws SQLException {
489477

490478
String sql = "INSERT INTO tbl VALUES (1, 2, 3), (11, 12, 13);";

script/testing/junit/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ clean:
2828
test: $(CLASSES)
2929
java -jar lib/junit-platform-console-standalone-1.1.0.jar \
3030
--class-path $(CP) \
31-
-c InsertPSTest
32-
# -c UpdateTest
33-
# -c InsertPSTest -c InsertTPCCTest
31+
-c InsertTPCCTest \
32+
-c InsertPSTest \
33+
-c UpdateTest
34+
3435

3536

3637

script/testing/junit/Readme.txt

Lines changed: 60 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,72 @@
11

22

3-
This directory contains tests using Junit4 and JDBC and prepared statements.
3+
This directory contains tests using Junit4 and JDBC.
44

5-
To compile:
6-
make
5+
Note:
6+
- These tests are not yet integrated into the continuous integration
7+
process (i.e. Travis or Jenkins). They will be integrated as soon
8+
as feasible.
79

8-
To run, using the Junit console:
9-
1. Start up the database server, manually, e.g.
10+
In the meantime, run the tests manually. Instructions follow.
11+
12+
Installation and pre-requisites
13+
-------------------------------
14+
You'll need
15+
- java JDK or JRE
16+
17+
Other than that, no explicit installation is required.
18+
19+
The necessary Java libraries supporting these tests are included in the
20+
lib directory.
21+
22+
Running the tests
23+
-----------------
24+
25+
1. Compile the tests.
26+
make
27+
28+
2. To run the tests, first start Peloton manually in a separate shell, e.g.
1029
./peloton
1130

12-
2. Run the tests, (from this directory):
31+
3. Run the tests, (from this directory):
1332
make test
1433

34+
Adding new tests
35+
----------------
36+
Add the tests to the Makefile for compilation and execution.
37+
38+
Code structure for tests
39+
------------------------
40+
- PLTestBase contains supporting functions shared across tests. Supplement
41+
as needed. Avoid duplicating code in tests.
42+
43+
- Add a new XXX.java file for each new test class. Each class may
44+
contain as many tests as desired. The current tests use
45+
one schema for the class.
46+
47+
- See UpdateTest.java for an example of a simple test.
48+
- Each test will need a Connection variable and SQL statements
49+
to setup the tables.
1550

16-
If the JUnit console output style is not to your taste,
17-
they can be run more directly using the Junit runner. Copy the following
51+
- See InsertPSTest.java for additional examples, including use
52+
of prepared statements. Most likely you'll want to implement
53+
using normal statements rather than prepared statements.
54+
55+
- Setup() is called prior to each test
56+
- Teardown() is called after each test
57+
If you need different granularity, see the JUnit4 documentation. Class
58+
level setup / teardown is possible.
59+
60+
- Functions annotated with @Test are the actual tests.
61+
Tests may be temporarily disabled by commented out the annotation, e.g.
62+
//@Test.
63+
64+
65+
Alternatives
66+
------------
67+
68+
If the JUnit console output style is not to your taste when running the
69+
tests, they can be run more directly using the Junit runner. Copy the following
1870
code into a file, and invoke it from this directory, e.g.
1971
bash run_tests.sh
2072

@@ -24,15 +76,3 @@ CP=".:lib/hamcrest-core-1.3.jar:lib/postgresql-9.4.1209.jre6.jar:lib/junit-4.12.
2476
# execute the InsertPSTest class. More than one test class may be
2577
# supplied on the command line
2678
java -cp $CP org.junit.runner.JUnitCore InsertPSTest
27-
28-
29-
Test notes
30-
----------
31-
32-
1. The InsertTPCCTest uses a table schema and insert statment from the
33-
TPPC benchmark.
34-
Peloton fails this test. It will be enabled once fixed.
35-
36-
2. InsertPSTest contains a set of prepared statement tests. The tests that
37-
currently do not pass on Peloton are disabled.
38-

script/testing/junit/UpdateTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ public void setValues(PreparedStatement pstmt,
6767
}
6868

6969
/**
70-
* xxx
70+
* Update columns in non-schema order. Exercises issue #1223.
7171
*/
72-
@Test
72+
// Disable until #1223 is fixed
73+
//@Test
7374
public void test_Update_1() throws SQLException {
7475

7576
String sql_1 = "INSERT INTO tbl VALUES (5, 400);";
Binary file not shown.
308 KB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)