Skip to content

Commit 7d0d87f

Browse files
authored
fix(web-shell): lock manager fix (#492)
Signed-off-by: Alex Chi <[email protected]>
1 parent 68361f0 commit 7d0d87f

File tree

3 files changed

+38
-8
lines changed

3 files changed

+38
-8
lines changed

src/common/bustub_instance.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ BustubInstance::BustubInstance(const std::string &db_file_name) {
6161
}
6262

6363
// Transaction (txn) related.
64+
65+
#ifdef __EMSCRIPTEN__
66+
lock_manager_ = new LockManager(false);
67+
#else
6468
lock_manager_ = new LockManager();
69+
#endif
70+
6571
txn_manager_ = new TransactionManager(lock_manager_, log_manager_);
6672

6773
// Checkpoint related.
@@ -93,7 +99,13 @@ BustubInstance::BustubInstance() {
9399
}
94100

95101
// Transaction (txn) related.
102+
103+
#ifdef __EMSCRIPTEN__
104+
lock_manager_ = new LockManager(false);
105+
#else
96106
lock_manager_ = new LockManager();
107+
#endif
108+
97109
txn_manager_ = new TransactionManager(lock_manager_, log_manager_);
98110

99111
// Checkpoint related.

tools/wasm-shell/extra_files/index.html

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@
1919
<link rel="preconnect" href="https://fonts.googleapis.com">
2020
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
2121
<link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;700&display=swap" rel="stylesheet">
22+
<!-- Preview -->
23+
<meta property="og:site_name" content="CMU 15-445/645" />
24+
<meta property="og:type" content="website" />
25+
<meta property="og:title" content="BusTub SQL Database Shell " />
26+
<meta property="og:url" content="https://15445.courses.cs.cmu.edu" />
27+
<meta property="og:description" content="Interactive BusTub shell right in your browser!" />
28+
<meta property="og:image" content="https://15445.courses.cs.cmu.edu/fall2022/images/bustub-shell.png" />
29+
<meta name="twitter:card" content="summary_large_image">
30+
<meta name="twitter:site" content="@CMUDB">
31+
<meta name="twitter:creator" content="@CMUDB">
32+
<meta name="twitter:domain" content=".">
33+
<meta property="twitter:label1" content="Semester?" />
34+
<meta property="twitter:data1" content="Fall 2022" />
35+
<meta property="twitter:label1" content="Relational?" />
36+
<meta property="twitter:data1" content="Hell Yes" />
2237
</head>
2338

2439
<body>
@@ -110,17 +125,20 @@
110125
line = ""
111126
}
112127
}, {
113-
greetings:
114-
`Welcome to the BusTub shell! \u{1F68C}\u{1F6C1}
128+
greetings: `[[@;;;;bustub.svg]]`,
129+
prompt: () => line.length == 0 ? "[[b;;]bustub> ]" : "[[b;;]... ]"
130+
})
131+
term.echo(`<hr><h1>Live Database Shell</h1>`, { raw: true })
132+
133+
term.echo(`
134+
[[b;;]Solution Version:] ${BUSTUB_PRIVATE_VERSION_VAR} · [[b;;]BusTub Version:] ${BUSTUB_PUBLIC_VERSION_VAR} · [[b;;]Built Date:] ${BUSTUB_BUILD_TIME_VAR}
115135
116-
BusTub is a relational database management system built at Carnegie Mellon University for the Introduction to Database Systems (15-445/645) course. This system was developed for educational purposes and should not be used in production environments. [[!;;;;https://github.com/cmu-db/bustub]BusTub on GitHub] [[!;;;;https://15445.courses.cs.cmu.edu/]Course Website] [[!;;;;https://github.com/cmu-db/bustub/issues/new]Report Bugs]
136+
BusTub is a relational database management system built at Carnegie Mellon University for the Introduction to Database Systems (15-445/645) course. This system was developed for educational purposes and should not be used in production environments. &#91;[[!;;;;https://github.com/cmu-db/bustub]BusTub on GitHub]&#93; &#91;[[!;;;;https://15445.courses.cs.cmu.edu/]Course Website]&#93; &#91;[[!;;;;https://github.com/cmu-db/bustub/issues/new]Report Bugs]&#93;
117137
118138
Use \\help to learn about the usage. Use \\clear to clear the page.
119139
120-
This is BusTub reference solution running in your browser. Solution Version: ${BUSTUB_PRIVATE_VERSION_VAR}, BusTub Version: ${BUSTUB_PUBLIC_VERSION_VAR}, built at ${BUSTUB_BUILD_TIME_VAR}.
121-
`,
122-
prompt: () => line.length == 0 ? "[[b;;]bustub> ]" : "[[b;;]... ]"
123-
})
140+
This is BusTub reference solution running in your browser.
141+
`)
124142
})
125143
</script>
126144

tools/wasm-shell/wasm-shell.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ extern "C" {
1717

1818
auto BustubInit() -> int {
1919
std::cout << "Initialize BusTub..." << std::endl;
20-
auto bustub = std::make_unique<bustub::BustubInstance>("test.db");
20+
auto bustub = std::make_unique<bustub::BustubInstance>();
2121
bustub->GenerateMockTable();
2222

2323
if (bustub->buffer_pool_manager_ != nullptr) {

0 commit comments

Comments
 (0)