Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
MKCLOS
Core Development Platform
corepkgv2
Commits
77af4d91
Commit
77af4d91
authored
5 years ago
by
Vivek Naik
Browse files
Options
Downloads
Patches
Plain Diff
added global lock for lazy write in append bucket
added global lock for lazy write in append bucket
parent
be84f87a
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!125
Mep release 7 nov
,
!124
segregation of pack operation and fdb operations
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dalmdl/corefdb/bucket.go
+5
-11
dalmdl/corefdb/bucket.go
with
5 additions
and
11 deletions
dalmdl/corefdb/bucket.go
+
5
−
11
View file @
77af4d91
...
...
@@ -42,6 +42,7 @@ const (
// ErrNoDataFound - This error describes that the required data might be deleted and not found. Kidly ignore this error in caller.
var
ErrNoDataFound
=
errors
.
New
(
"No data found"
)
var
bucketLock
=
sync
.
Mutex
{}
// Bucket - Bucket
type
Bucket
struct
{
...
...
@@ -122,10 +123,8 @@ func (fdb *FDB) GetIndexDB(index *Index) (*buntdb.DB, error) {
return
db
,
nil
}
// GetNewBucket - return Bucket Obj
// GetNewBucket - return Bucket Obj
with provided data and new guid
func
(
fdb
*
FDB
)
GetNewBucket
(
BucketNameQuery
string
,
IsDynamicName
bool
,
parentBucket
*
Bucket
)
*
Bucket
{
fdb
.
bLocker
.
Lock
()
defer
fdb
.
bLocker
.
Unlock
()
bucket
:=
&
Bucket
{
BucketID
:
guidmdl
.
GetGUID
(),
BucketNameQuery
:
BucketNameQuery
,
...
...
@@ -143,11 +142,7 @@ func (fdb *FDB) GetNewBucket(BucketNameQuery string, IsDynamicName bool, parentB
func
(
fdb
*
FDB
)
NewBucket
(
bucket
,
parentBucket
*
Bucket
)
*
Bucket
{
fdb
.
bLocker
.
Lock
()
defer
fdb
.
bLocker
.
Unlock
()
// bucket := &Bucket{
// BucketID: guidmdl.GetGUID(),
// BucketNameQuery: BucketNameQuery,
// IsDynamicName: IsDynamicName,
// }
bucketNameQuery
:=
bucket
.
BucketNameQuery
if
bucket
.
IsDynamicName
{
bucketNameQuery
=
"$$"
+
bucket
.
BucketNameQuery
...
...
@@ -315,8 +310,8 @@ func getUpdatedFilePath(filePath string, data gjson.Result) (string, error) {
func
AppendDataInLazyObjectInCache
(
bucketID
string
,
data
gjson
.
Result
)
error
{
// lazy cache must be present for provided bucketID
// loggermdl.LogError("AppendDataInLazyObjectInCache")
mutex
:=
sync
.
Mutex
{}
mutex
.
L
ock
()
bucketLock
.
Lock
()
defer
bucketLock
.
Unl
ock
()
lazyObj
,
ok
:=
AppendLazyObjHolder
.
Get
(
bucketID
)
if
!
ok
{
loggermdl
.
LogError
(
AppendLazyObjHolder
.
GetItems
())
...
...
@@ -360,7 +355,6 @@ func AppendDataInLazyObjectInCache(bucketID string, data gjson.Result) error {
}
AppendLazyObjHolder
.
SetNoExpiration
(
bucketID
,
bucketLazyData
)
mutex
.
Unlock
()
return
nil
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets