You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/06/04 07:09:55 UTC

[GitHub] [incubator-kvrocks] git-hulk opened a new pull request, #620: Fix don't swallow the error when creating column families failed

git-hulk opened a new pull request, #620:
URL: https://github.com/apache/incubator-kvrocks/pull/620

   We expected to ignore the column families not opened error
   opened error, but we ignored all errors without checking the
   error type and message. This may cause other errors being ignored
   as well.
   
   This close: https://github.com/apache/incubator-kvrocks/issues/437


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] git-hulk commented on a diff in pull request #620: Fix don't swallow the error when creating column families failed

Posted by GitBox <gi...@apache.org>.
git-hulk commented on code in PR #620:
URL: https://github.com/apache/incubator-kvrocks/pull/620#discussion_r889581045


##########
src/storage.cc:
##########
@@ -209,9 +210,16 @@ Status Storage::CreateColumnFamilies(const rocksdb::Options &options) {
     tmp_db->Close();
     delete tmp_db;
   }
-  // Open db would be failed if the column families have already exists,

Review Comment:
   > Is it possible we check exact that it failed because of "already exists" instead of "NOT column families not opened"? I'm afraid there is still some edge case we miss.
   
   Yes, it's a bit tricky and confuse, but we can't change the status message AFAIK since it returned by the RocksDB.
   
   For the second suggestion, We do prefer C++ idiom. my initial intention was to ignore the case when comparing the prefix. But seems this's unnecessary since it can't protect anything if the status message is modified, I will change to `find` to simplify the expression. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] git-hulk commented on a diff in pull request #620: Fix don't swallow the error when creating column families failed

Posted by GitBox <gi...@apache.org>.
git-hulk commented on code in PR #620:
URL: https://github.com/apache/incubator-kvrocks/pull/620#discussion_r889581045


##########
src/storage.cc:
##########
@@ -209,9 +210,16 @@ Status Storage::CreateColumnFamilies(const rocksdb::Options &options) {
     tmp_db->Close();
     delete tmp_db;
   }
-  // Open db would be failed if the column families have already exists,

Review Comment:
   > Is it possible we check exact that it failed because of "already exists" instead of "NOT column families not opened"? I'm afraid there is still some edge case we miss.
   
   Yes, it's a bit tricky and confuse, but we can't change the status message AFAIK since it returned by the RocksDB.
   
   For the second suggestion, We do prefer C++ idiom. my initial intention was to ignore the case when comparing the prefix. But seems this's unnecessary since it can't protect anything if the status message is modified, I will change to `rfind` to simplify the expression. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] git-hulk commented on a diff in pull request #620: Fix don't swallow the error when creating column families failed

Posted by GitBox <gi...@apache.org>.
git-hulk commented on code in PR #620:
URL: https://github.com/apache/incubator-kvrocks/pull/620#discussion_r889593547


##########
src/storage.cc:
##########
@@ -209,9 +210,16 @@ Status Storage::CreateColumnFamilies(const rocksdb::Options &options) {
     tmp_db->Close();
     delete tmp_db;
   }
-  // Open db would be failed if the column families have already exists,

Review Comment:
   Thanks @tisonkun, changed to the c++ api and do a bit logic refactor, please take a look again.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] git-hulk merged pull request #620: Fix don't swallow the error when creating column families failed

Posted by GitBox <gi...@apache.org>.
git-hulk merged PR #620:
URL: https://github.com/apache/incubator-kvrocks/pull/620


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] tisonkun commented on a diff in pull request #620: Fix don't swallow the error when creating column families failed

Posted by GitBox <gi...@apache.org>.
tisonkun commented on code in PR #620:
URL: https://github.com/apache/incubator-kvrocks/pull/620#discussion_r889566487


##########
src/storage.cc:
##########
@@ -209,9 +210,16 @@ Status Storage::CreateColumnFamilies(const rocksdb::Options &options) {
     tmp_db->Close();
     delete tmp_db;
   }
-  // Open db would be failed if the column families have already exists,

Review Comment:
   Is it possible we check exact that it failed because of "already exists" instead of "NOT column families not opened"? I'm afraid there is still some edge case we miss.
   
   Also, shall we prefer C++ idiom and thus check strings with `<string>`? That means:
   
   * `s.ToString().rfind(notOpenedPrefix, 0) != 0`
   
   over
   
   * `!strncasecmp(s.ToString().c_str(), notOpenedPrefix.c_str(), notOpenedPrefix.size())`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] tisonkun commented on a diff in pull request #620: Fix don't swallow the error when creating column families failed

Posted by GitBox <gi...@apache.org>.
tisonkun commented on code in PR #620:
URL: https://github.com/apache/incubator-kvrocks/pull/620#discussion_r889590278


##########
src/storage.cc:
##########
@@ -209,9 +210,16 @@ Status Storage::CreateColumnFamilies(const rocksdb::Options &options) {
     tmp_db->Close();
     delete tmp_db;
   }
-  // Open db would be failed if the column families have already exists,

Review Comment:
   Sorry I just (again, haha) revert the boolean logic :P
   
   Ping me when you have a conclusion on whether use rfind or keep strncasecmp.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org