Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix update bugs #2098

Merged
merged 1 commit into from
Sep 29, 2023
Merged

Fix update bugs #2098

merged 1 commit into from
Sep 29, 2023

Conversation

ray6080
Copy link
Contributor

@ray6080 ray6080 commented Sep 27, 2023

No description provided.

@ray6080 ray6080 marked this pull request as ready for review September 27, 2023 13:59
Copy link
Collaborator

@benjaminwinger benjaminwinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to work properly for me. I checked out this branch and modified the InsertManyNodesTest to also check the inserted values, and it's still failing:

diff --git a/test/storage/node_insertion_deletion_test.cpp b/test/storage/node_insertion_deletion_test.cpp
index e5cb932b9..7d9fa4e97 100644
--- a/test/storage/node_insertion_deletion_test.cpp
+++ b/test/storage/node_insertion_deletion_test.cpp
@@ -87,12 +87,18 @@ TEST_F(NodeInsertionDeletionTests, InsertManyNodesTest) {
     auto preparedStatement = conn->prepare("CREATE (:person {ID:$id});");
     for (int64_t i = 0; i < BufferPoolConstants::PAGE_4KB_SIZE; i++) {
         auto result =
-            conn->execute(preparedStatement.get(), std::make_pair(std::string("id"), 10001 + i));
+            conn->execute(preparedStatement.get(), std::make_pair(std::string("id"), 10000 + i));
         ASSERT_TRUE(result->isSuccess()) << result->toString();
     }
-    auto result = conn->query("MATCH (a:person) WHERE a.ID >= 10001 RETURN COUNT(*);");
+    auto result = conn->query("MATCH (a:person) WHERE a.ID >= 10000 RETURN COUNT(*);");
     ASSERT_TRUE(result->hasNext());
     auto tuple = result->getNext();
     ASSERT_EQ(tuple->getValue(0)->getValue<int64_t>(), BufferPoolConstants::PAGE_4KB_SIZE);
     ASSERT_FALSE(result->hasNext());
+    result = conn->query("MATCH (a:person) RETURN a.ID;");
+    int64_t i = 0;
+    while(result->hasNext()) {
+        auto tuple = result->getNext();
+        EXPECT_EQ(i++, tuple->getValue(0)->getValue<int64_t>());
+    }
 }

src/storage/store/node_column.cpp Show resolved Hide resolved
src/storage/store/column_chunk.cpp Outdated Show resolved Hide resolved
if (numValuesPerPage == UINT64_MAX) {
// This is a special case that bit_width is 0.
numValuesPerPage = 0;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking forwards to implementing constant compression, I'm not sure this is the best way to handle this, as for constant compression we would have the same maximum values per page, but the values read would be non-zero, so we would actually need to scan them.

Then again, if the constant value is stored in the metadata, rather than in the page, then we would need a special way of scanning it anyway, but the simple implementation I would think (which would also work for variable sized values) would be to store it in the page once and copy it numValues times to the output.

@ray6080
Copy link
Contributor Author

ray6080 commented Sep 28, 2023

This doesn't seem to work properly for me. I checked out this branch and modified the InsertManyNodesTest to also check the inserted values, and it's still failing:

diff --git a/test/storage/node_insertion_deletion_test.cpp b/test/storage/node_insertion_deletion_test.cpp
index e5cb932b9..7d9fa4e97 100644
--- a/test/storage/node_insertion_deletion_test.cpp
+++ b/test/storage/node_insertion_deletion_test.cpp
@@ -87,12 +87,18 @@ TEST_F(NodeInsertionDeletionTests, InsertManyNodesTest) {
     auto preparedStatement = conn->prepare("CREATE (:person {ID:$id});");
     for (int64_t i = 0; i < BufferPoolConstants::PAGE_4KB_SIZE; i++) {
         auto result =
-            conn->execute(preparedStatement.get(), std::make_pair(std::string("id"), 10001 + i));
+            conn->execute(preparedStatement.get(), std::make_pair(std::string("id"), 10000 + i));
         ASSERT_TRUE(result->isSuccess()) << result->toString();
     }
-    auto result = conn->query("MATCH (a:person) WHERE a.ID >= 10001 RETURN COUNT(*);");
+    auto result = conn->query("MATCH (a:person) WHERE a.ID >= 10000 RETURN COUNT(*);");
     ASSERT_TRUE(result->hasNext());
     auto tuple = result->getNext();
     ASSERT_EQ(tuple->getValue(0)->getValue<int64_t>(), BufferPoolConstants::PAGE_4KB_SIZE);
     ASSERT_FALSE(result->hasNext());
+    result = conn->query("MATCH (a:person) RETURN a.ID;");
+    int64_t i = 0;
+    while(result->hasNext()) {
+        auto tuple = result->getNext();
+        EXPECT_EQ(i++, tuple->getValue(0)->getValue<int64_t>());
+    }
 }

Is your ground truth correct here? Why compare to i++? It should be 10000 + i++ here.

@benjaminwinger
Copy link
Collaborator

Is your ground truth correct here? Why compare to i++? It should be 10000 + i++ here.

The datasets starts with 0-9999 from a csv. I guess it could only query the ones which are added, but a lot of the time the erroneous values end up with smaller IDs, so it would skip the values and maybe the output would be less helpful.

@ray6080
Copy link
Contributor Author

ray6080 commented Sep 28, 2023

Is your ground truth correct here? Why compare to i++? It should be 10000 + i++ here.

The datasets starts with 0-9999 from a csv. I guess it could only query the ones which are added, but a lot of the time the erroneous values end up with smaller IDs, so it would skip the values and maybe the output would be less helpful.

Yeah, because the scan runs in parallel, so the output needs to be ordered to be easily checked.

@codecov
Copy link

codecov bot commented Sep 28, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (f05d348) 89.55% compared to head (dd413f0) 89.53%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2098      +/-   ##
==========================================
- Coverage   89.55%   89.53%   -0.03%     
==========================================
  Files         981      981              
  Lines       35901    35906       +5     
==========================================
- Hits        32151    32148       -3     
- Misses       3750     3758       +8     
Files Coverage Δ
src/include/storage/store/column_chunk.h 92.15% <100.00%> (+0.15%) ⬆️
src/include/storage/store/compression.h 96.22% <100.00%> (ø)
src/include/storage/store/node_column.h 100.00% <ø> (ø)
src/storage/local_table.cpp 94.17% <100.00%> (ø)
src/storage/store/compression.cpp 73.26% <100.00%> (ø)
src/storage/store/string_node_column.cpp 98.96% <100.00%> (ø)
src/storage/store/var_list_node_column.cpp 100.00% <100.00%> (ø)
src/storage/store/node_column.cpp 80.00% <94.11%> (+0.24%) ⬆️

... and 3 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ray6080 ray6080 merged commit 722b25a into master Sep 29, 2023
11 checks passed
@ray6080 ray6080 deleted the fix-update branch September 29, 2023 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants