Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
新注册的用户请输入邮箱并保存,随后登录邮箱激活账号。后续可直接使用邮箱登录!
Open sidebar
sitong ge
store
Commits
a9be49f1
Commit
a9be49f1
authored
2 years ago
by
厚发 周
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add get block log
----story=1012853
parent
fffb496b
master
develop
v2.3.4
v2.3.3
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
4 deletions
+22
-4
binlog/binloger.go
binlog/binloger.go
+1
-1
blockdb/blockfiledb/blockfile.go
blockdb/blockfiledb/blockfile.go
+1
-0
blockdb/blockfiledb/blockfiledb.go
blockdb/blockfiledb/blockfiledb.go
+13
-2
blockstore_impl_test.go
blockstore_impl_test.go
+1
-0
resultdb/resultfiledb/resultfiledb.go
resultdb/resultfiledb/resultfiledb.go
+6
-1
No files found.
binlog/binloger.go
View file @
a9be49f1
...
...
@@ -54,7 +54,7 @@ type BinLogger interface {
// @return err
Write
(
index
uint64
,
data
[]
byte
)
(
fileName
string
,
offset
,
blkLen
uint64
,
err
error
)
// ReadFileSection read data,according to file index
// ReadFileSection read data,
according to file index
// @Description:
// @param fiIndex
// @param timeOut
...
...
This diff is collapsed.
Click to expand it.
blockdb/blockfiledb/blockfile.go
View file @
a9be49f1
...
...
@@ -909,6 +909,7 @@ func (l *BlockFile) doReadFileSection(fiIndex *storePb.StoreInfo) ([]byte, error
path
=
l
.
segmentPathWithENDSuffix
(
fiIndex
.
FileName
)
}
l
.
logger
.
Debugf
(
"read file section, path: %s, offset: %d, dataLen: %d"
,
path
,
fiIndex
.
Offset
,
fiIndex
.
ByteLen
)
lfile
,
err
:=
l
.
openReadFileWithTimeOut
(
path
,
time
.
Second
)
if
err
!=
nil
{
return
nil
,
err
...
...
This diff is collapsed.
Click to expand it.
blockdb/blockfiledb/blockfiledb.go
View file @
a9be49f1
...
...
@@ -680,6 +680,7 @@ func (b *BlockFileDB) GetTxConfirmedTime(txId string) (int64, error) {
// @return *storePb.StoreInfo
// @return error
func
(
b
*
BlockFileDB
)
GetBlockIndex
(
height
uint64
)
(
*
storePb
.
StoreInfo
,
error
)
{
b
.
logger
.
Debugf
(
"get block[%d] index"
,
height
)
blockIndexByte
,
err
:=
b
.
get
(
constructBlockIndexKey
(
b
.
dbHandle
.
GetDbType
(),
height
))
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -687,7 +688,11 @@ func (b *BlockFileDB) GetBlockIndex(height uint64) (*storePb.StoreInfo, error) {
if
blockIndexByte
==
nil
{
return
nil
,
nil
}
return
su
.
DecodeValueToIndex
(
blockIndexByte
)
vIndex
,
err1
:=
su
.
DecodeValueToIndex
(
blockIndexByte
)
if
err1
==
nil
{
b
.
logger
.
Debugf
(
"get block[%d] index: %s"
,
height
,
vIndex
.
String
())
}
return
vIndex
,
err1
}
// GetBlockMeta add next time
...
...
@@ -723,6 +728,7 @@ func (b *BlockFileDB) GetBlockMeta(height uint64) (*storePb.SerializedBlock, err
// @return *storePb.StoreInfo
// @return error
func
(
b
*
BlockFileDB
)
GetBlockMetaIndex
(
height
uint64
)
(
*
storePb
.
StoreInfo
,
error
)
{
b
.
logger
.
Debugf
(
"get block[%d] meta index"
,
height
)
index
,
err
:=
b
.
get
(
constructBlockMetaIndexKey
(
b
.
dbHandle
.
GetDbType
(),
height
))
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -730,7 +736,11 @@ func (b *BlockFileDB) GetBlockMetaIndex(height uint64) (*storePb.StoreInfo, erro
if
index
==
nil
{
return
nil
,
nil
}
return
su
.
DecodeValueToIndex
(
index
)
vIndex
,
err1
:=
su
.
DecodeValueToIndex
(
index
)
if
err1
==
nil
{
b
.
logger
.
Debugf
(
"get block[%d] meta index: %s"
,
height
,
vIndex
.
String
())
}
return
vIndex
,
err1
}
// GetTxIndex returns the offset of the transaction in the rfile
...
...
@@ -740,6 +750,7 @@ func (b *BlockFileDB) GetBlockMetaIndex(height uint64) (*storePb.StoreInfo, erro
// @return *storePb.StoreInfo
// @return error
func
(
b
*
BlockFileDB
)
GetTxIndex
(
txId
string
)
(
*
storePb
.
StoreInfo
,
error
)
{
b
.
logger
.
Debugf
(
"get rwset txId: %s"
,
txId
)
txIDBlockInfoBytes
,
err
:=
b
.
get
(
constructBlockTxIDKey
(
txId
))
if
err
!=
nil
{
return
nil
,
err
...
...
This diff is collapsed.
Click to expand it.
blockstore_impl_test.go
View file @
a9be49f1
...
...
@@ -181,6 +181,7 @@ func getBadgerConfig(path string) *conf.StorageConfig {
conf1
.
StorePath
=
filepath
.
Join
(
os
.
TempDir
(),
fmt
.
Sprintf
(
"%d_wal"
,
time
.
Now
()
.
Nanosecond
()))
return
conf1
}
func
getlvldbConfig
(
path
string
)
*
conf
.
StorageConfig
{
conf1
,
_
:=
conf
.
NewStorageConfig
(
nil
)
if
path
==
""
{
...
...
This diff is collapsed.
Click to expand it.
resultdb/resultfiledb/resultfiledb.go
View file @
a9be49f1
...
...
@@ -184,12 +184,17 @@ func (h *ResultFileDB) GetTxRWSet(txId string) (*commonPb.TxRWSet, error) {
// @return error
func
(
h
*
ResultFileDB
)
GetRWSetIndex
(
txId
string
)
(
*
storePb
.
StoreInfo
,
error
)
{
// GetRWSetIndex returns the offset of the block in the file
h
.
logger
.
Debugf
(
"get rwset txId: %s"
,
txId
)
index
,
err
:=
h
.
get
(
constructTxRWSetIndexKey
(
txId
))
if
err
!=
nil
{
return
nil
,
err
}
return
su
.
DecodeValueToIndex
(
index
)
vIndex
,
err1
:=
su
.
DecodeValueToIndex
(
index
)
if
err1
==
nil
{
h
.
logger
.
Debugf
(
"get rwset txId: %s, index: %s"
,
txId
,
vIndex
.
String
())
}
return
vIndex
,
err1
}
// GetLastSavepoint returns the last block height
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment