Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into fix310
Browse files Browse the repository at this point in the history
  • Loading branch information
JinHai-CN committed Oct 9, 2024
2 parents 3bb743b + b604010 commit 540d047
Show file tree
Hide file tree
Showing 93 changed files with 2,077 additions and 5,726 deletions.
1 change: 1 addition & 0 deletions benchmark/local_infinity/sparse/sparse_benchmark_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import infinity_exception;
import sparse_util;
import compilation_config;
import bmp_util;
import local_file_handle;

using namespace infinity;

Expand Down
166 changes: 165 additions & 1 deletion docs/references/http_api_reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2370,4 +2370,168 @@ A `500` HTTP status code indicates an error condition. The response includes a J
</TabItem>
</Tabs>
---
---
## Show buffer
**GET** `/instance/buffer`
List the cached buffer objects in database.
### Request
- Method: GET
- URL: `/instance/buffer`
- Headers: `accept: application/json`
#### Request example
```shell
curl --request GET \
--url http://localhost:23820/instance/buffer \
--header 'accept: application/json'
```
### Response
<Tabs
defaultValue="s200"
values={[
{label: 'Status code 200', value: 's200'},
{label: 'Status code 500', value: 's500'},
]}>
<TabItem value="s200">
The response includes a JSON object like the following:
```shell
{
"buffer": [
{
"buffered_type": "Persistent",
"path": "/var/infinity/data/nlAn5spku9_db_default_db/sNzUhKy3er_table_table1/seg_0/blk_0/0.col",
"size": "32768",
"status": "Freed",
"type": "data"
},
{
"buffered_type": "Persistent",
"path": "/var/infinity/data/nlAn5spku9_db_default_db/sNzUhKy3er_table_table1/seg_0/blk_0/2.col",
"size": "131072",
"status": "Freed",
"type": "data"
},
{
"buffered_type": "Persistent",
"path": "/var/infinity/data/nlAn5spku9_db_default_db/sNzUhKy3er_table_table1/seg_0/blk_0/version",
"size": "65536",
"status": "Freed",
"type": "version data"
}
],
"error_code": 0
}
```
- `"error_code"`: `integer`
`0`: The operation succeeds.
</TabItem>
<TabItem value="s500">
A `500` HTTP status code indicates an error condition. The response includes a JSON object like the following:
```shell
{
"error_code": 2005,
"error_message": "Not support in maintenance mode"
}
```
- `"error_code"`: `integer`
A non-zero value indicates a specific error condition.
- `"error_message"`: `string`
When `error_code` is non-zero, `"error_message"` provides additional details about the error.
</TabItem>
</Tabs>
---
## Show profiles
**GET** `/instance/profiles`
When set session variable 'enable_profiling', Infinity will record query profile information. This command is to list recorded queries profile.
### Request
- Method: GET
- URL: `/instance/profiles`
- Headers: `accept: application/json`
#### Request example
```shell
curl --request GET \
--url http://localhost:23820/instance/profiles \
--header 'accept: application/json'
```
### Response
<Tabs
defaultValue="s200"
values={[
{label: 'Status code 200', value: 's200'},
{label: 'Status code 500', value: 's500'},
]}>
<TabItem value="s200">
The response includes a JSON object like the following:
```shell
{
"error_code": 0,
"profiles": [
{
"command parsing": "250us",
"commit": "0ns",
"execution": "380us",
"logical plan building": "133us",
"physical plan building": "44us",
"pipeline building": "38us",
"plan optimizing": "1000ns",
"record_no": "0",
"rollback": "35us",
"task building": "70us",
"total_cost": "951us"
}
]
}
```
- `"error_code"`: `integer`
`0`: The operation succeeds.
</TabItem>
<TabItem value="s500">
A `500` HTTP status code indicates an error condition. The response includes a JSON object like the following:
```shell
{
"error_code": 2005,
"error_message": "Not support in maintenance mode"
}
```
- `"error_code"`: `integer`
A non-zero value indicates a specific error condition.
- `"error_message"`: `string`
When `error_code` is non-zero, `"error_message"` provides additional details about the error.
</TabItem>
</Tabs>
---
3 changes: 3 additions & 0 deletions example/http/cluster_admin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
curl --request GET \
--url http://localhost:23822/admin/node/current \
--header 'accept: application/json'
24 changes: 24 additions & 0 deletions example/http/insert_search_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,30 @@ curl --request GET \
]
} '

# select num and year of 'tbl1' and order by num descending, year ascending
echo -e '\n\n-- select num and year of tbl1 and order by num descending, year ascending'
curl --request GET \
--url http://localhost:23820/databases/default_db/tables/tbl1/docs \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"output":
[
"num",
"year"
],
"sort" :
[
{
"num": "desc"
},
{
"year": "asc"
}
]
} '


# select num and year of 'tbl1' where num > 1 and year < 2023
echo -e '\n\n-- select num and year of tbl1 where num > 1 and year < 2023 offset 1 limit 1'
Expand Down
38 changes: 38 additions & 0 deletions example/http/show_metrics.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Copyright(C) 2024 InfiniFlow, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# show buffer
echo -e '\n-- show buffer'
curl --request GET \
--url http://localhost:23820/instance/buffer \
--header 'accept: application/json'

# show profiles
echo -e '\n\n-- show profiles'
curl --request GET \
--url http://localhost:23820/instance/profiles \
--header 'accept: application/json'

# show memindex
echo -e '\n\n-- show memindex'
curl --request GET \
--url http://localhost:23820/instance/memindex \
--header 'accept: application/json'

# show queries
echo -e '\n\n-- show queries'
curl --request GET \
--url http://localhost:23820/instance/queries \
--header 'accept: application/json'

3 changes: 3 additions & 0 deletions gui/app/(dashboard)/database/[dabataseId]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default async function DatabasePage() {
return <div>DatabasePage id</div>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default async function DatabasePage() {
return <div>table id</div>;
}
3 changes: 3 additions & 0 deletions gui/app/(dashboard)/database/[dabataseId]/table/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default async function TablePage() {
return <div>table</div>;
}
87 changes: 87 additions & 0 deletions gui/app/(dashboard)/database/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import SideMenu, { MenuItem } from '@/components/ui/side-menu';
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow
} from '@/components/ui/table';
import { listDatabase, listTable } from '../actions';
import { InfinityContextMenuContent } from '../tables/context-menu';

async function InfinityTable() {
const tables = await listTable('default_db');
return (
<Table>
<TableHeader>
<TableRow>
<TableHead className="text-center">Name</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{tables.tables.map((table: string) => (
<TableRow key={table}>
<TableCell className="font-medium">{table}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
);
}

export default async function DatabaseLayout({
searchParams,
children
}: {
searchParams: { q: string; offset: string };
children: React.ReactNode;
}) {
const search = searchParams?.q ?? '';
const offset = searchParams?.offset ?? 0;

const items: MenuItem[] = [
{
key: 'sub1',
label: 'Navigation',
children: [
{
key: 'g1',
label: 'Item 1'
},
{
key: 'g2',
label: 'Item 2'
}
]
}
];

const ret = await listDatabase();
if (ret.databases.length > 1) {
const latestDatabase = ret.databases.at(-1);
const tables = await listTable(latestDatabase);
console.log('🚀 ~ ret:', tables);
items.push({
key: latestDatabase,
label: latestDatabase,
children: tables.tables
});
}

return (
<div className="flex divide-x ">
<section className="w-40">
<SideMenu
items={items}
contextMenuContent={(key: string) => (
<InfinityContextMenuContent
databaseName={key}
></InfinityContextMenuContent>
)}
></SideMenu>
</section>
<section className="flex-1 text-center">{children}</section>
</div>
);
}
Loading

0 comments on commit 540d047

Please sign in to comment.