You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@teaclave.apache.org by ms...@apache.org on 2022/11/10 05:38:52 UTC

[incubator-teaclave] branch master updated (e5215555 -> df5c0a7f)

This is an automated email from the ASF dual-hosted git repository.

mssun pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git


    from e5215555 Update rusty-leveldb version to v1.0.4
     new 67630008 LevelDB-SGX: omit SGX recovery files when traversing DB files
     new df5c0a7f SDK: fix calling a wrong function

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 common/rusty_leveldb_sgx/src/db_impl.rs | 20 ++++++++++++++++++--
 common/rusty_leveldb_sgx/src/types.rs   |  5 +++++
 sdk/rust/src/bindings.rs                |  2 +-
 3 files changed, 24 insertions(+), 3 deletions(-)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org


[incubator-teaclave] 02/02: SDK: fix calling a wrong function

Posted by ms...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mssun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git

commit df5c0a7f314ede717c9ccfad3aa95a737b8cf6d5
Author: sunhe05 <su...@baidu.com>
AuthorDate: Tue Nov 8 04:45:31 2022 +0000

    SDK: fix calling a wrong function
---
 sdk/rust/src/bindings.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sdk/rust/src/bindings.rs b/sdk/rust/src/bindings.rs
index e7a72979..e8fcf70b 100644
--- a/sdk/rust/src/bindings.rs
+++ b/sdk/rust/src/bindings.rs
@@ -344,7 +344,7 @@ pub unsafe extern "C" fn teaclave_cancel_task(
     }
 
     let task_id = CStr::from_ptr(task_id).to_string_lossy().into_owned();
-    match client.invoke_task(&task_id) {
+    match client.cancel_task(&task_id) {
         Ok(_) => 0,
         Err(_) => 1,
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org


[incubator-teaclave] 01/02: LevelDB-SGX: omit SGX recovery files when traversing DB files

Posted by ms...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mssun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave.git

commit 67630008ee75b660ea86d96ae44e206eb91137b9
Author: sunhe05 <su...@baidu.com>
AuthorDate: Tue Nov 8 04:40:51 2022 +0000

    LevelDB-SGX: omit SGX recovery files when traversing DB files
---
 common/rusty_leveldb_sgx/src/db_impl.rs | 20 ++++++++++++++++++--
 common/rusty_leveldb_sgx/src/types.rs   |  5 +++++
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/common/rusty_leveldb_sgx/src/db_impl.rs b/common/rusty_leveldb_sgx/src/db_impl.rs
index e2d9aa3f..55629ac6 100644
--- a/common/rusty_leveldb_sgx/src/db_impl.rs
+++ b/common/rusty_leveldb_sgx/src/db_impl.rs
@@ -12,7 +12,7 @@ use crate::db_iter::DBIterator;
 
 use crate::cmp::{Cmp, InternalKeyCmp};
 use crate::env::{Env, FileLock};
-use crate::error::{err, Result, StatusCode};
+use crate::error::{err, Result, Status, StatusCode};
 use crate::filter::{BoxedFilterPolicy, InternalFilterPolicy};
 use crate::infolog::Logger;
 use crate::key_types::{parse_internal_key, InternalKey, LookupKey, ValueType};
@@ -25,7 +25,7 @@ use crate::table_builder::TableBuilder;
 use crate::table_cache::{table_file_name, TableCache};
 use crate::types::{
     parse_file_name, share, FileMetaData, FileNum, FileType, LdbIterator, SequenceNumber, Shared,
-    MAX_SEQUENCE_NUMBER, NUM_LEVELS,
+    MAX_SEQUENCE_NUMBER, NUM_LEVELS, SGX_RECOVERY_FILE_SUFFIX,
 };
 use crate::version::Version;
 use crate::version_edit::VersionEdit;
@@ -191,6 +191,14 @@ impl DB {
         let mut log_files = vec![];
 
         for file in &filenames {
+            if file
+                .to_str()
+                .ok_or_else(|| Status::new(StatusCode::InvalidArgument, "not valid UTF-8"))?
+                .ends_with(SGX_RECOVERY_FILE_SUFFIX)
+            {
+                continue;
+            }
+
             match parse_file_name(&file) {
                 Ok((num, typ)) => {
                     expected.remove(&num);
@@ -310,6 +318,14 @@ impl DB {
         let files = self.vset.borrow().live_files();
         let filenames = self.opt.env.children(Path::new(&self.path))?;
         for name in filenames {
+            if name
+                .to_str()
+                .ok_or_else(|| Status::new(StatusCode::InvalidArgument, "not valid UTF-8"))?
+                .ends_with(SGX_RECOVERY_FILE_SUFFIX)
+            {
+                continue;
+            }
+
             if let Ok((num, typ)) = parse_file_name(&name) {
                 match typ {
                     FileType::Log => {
diff --git a/common/rusty_leveldb_sgx/src/types.rs b/common/rusty_leveldb_sgx/src/types.rs
index b4da1d68..d05e58d5 100644
--- a/common/rusty_leveldb_sgx/src/types.rs
+++ b/common/rusty_leveldb_sgx/src/types.rs
@@ -10,6 +10,10 @@ use std::rc::Rc;
 
 pub const NUM_LEVELS: usize = 7;
 
+// SGX protected fs saves the recovery file in the same directory as the original file.
+// It should not be pared for db use.
+pub static SGX_RECOVERY_FILE_SUFFIX: &str = "_recovery";
+
 /// Represents a sequence number of a single entry.
 pub type SequenceNumber = u64;
 
@@ -211,5 +215,6 @@ pub mod tests {
         assert!(parse_file_name("01a.sst").is_err());
         assert!(parse_file_name("0011.abc").is_err());
         assert!(parse_file_name("MANIFEST-trolol").is_err());
+        assert!(parse_file_name("000167.log_recovery").is_err());
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@teaclave.apache.org
For additional commands, e-mail: commits-help@teaclave.apache.org