MCPcopy
hub / github.com/cubefs/cubefs / TestSplitKeyDeletion

Function TestSplitKeyDeletion

metanode/multi_ver_test.go:267–322  ·  view source on GitHub ↗

create

(t *testing.T)

Source from the content-addressed store, hash-verified

265
266// create
267func TestSplitKeyDeletion(t *testing.T) {
268 log.LogDebugf("action[TestSplitKeyDeletion] start!!!!!!!!!!!")
269 initMp(t)
270 initVer()
271 mp.config.Cursor = 1100
272
273 fileIno := testCreateInode(t, FileModeType)
274
275 fileName := "fileTest"
276 dirDen := testCreateDentry(t, 1, fileIno.Inode, fileName, FileModeType)
277 assert.True(t, dirDen != nil)
278
279 initExt := buildExtentKey(0, 0, 1024, 0, 1000)
280 fileIno.GetExtents().eks = append(fileIno.GetExtentEks(), initExt)
281
282 splitSeq := testCreateVer()
283 splitKey := buildExtentKey(splitSeq, 500, 1024, 128100, 100)
284 extents := &SortedExtents{}
285 extents.eks = append(extents.eks, splitKey)
286
287 iTmp := &Inode{
288 Inode: fileIno.Inode,
289 multiSnap: &InodeMultiSnap{
290 verSeq: splitSeq,
291 },
292 HybridCloudExtents: NewSortedHybridCloudExtents(),
293 }
294
295 mp.verSeq = iTmp.getVer()
296 iTmp.StorageClass = proto.StorageClass_Replica_HDD
297 iTmp.HybridCloudExtents.sortedEks = extents
298
299 mp.fsmAppendExtentsWithCheck(iTmp, true)
300
301 //TODO: support-hybrid
302 //assert.True(t, testGetSplitSize(t, fileIno) == 1)
303 //assert.True(t, testGetEkRefCnt(t, fileIno, &initExt) == 4)
304 //
305 //testCleanSnapshot(t, 0)
306 //delCnt := testDelDiscardEK(t, fileIno)
307 //assert.True(t, 1 == delCnt)
308 //
309 //assert.True(t, testGetSplitSize(t, fileIno) == 1)
310 //assert.True(t, testGetEkRefCnt(t, fileIno, &initExt) == 3)
311 //
312 //log.LogDebugf("try to deletion current")
313 //testDeleteDirTree(t, 1, 0)
314 //
315 //fileIno.GetAllExtsOfflineInode(mp.config.PartitionId)
316 //
317 //splitCnt := uint32(testGetSplitSize(t, fileIno))
318 //assert.True(t, 0 == splitCnt)
319 //
320 //assert.True(t, testGetSplitSize(t, fileIno) == 0)
321 //assert.True(t, testGetEkRefCnt(t, fileIno, &initExt) == 0)
322}
323
324func testGetlastVer() (verSeq uint64) {

Callers

nothing calls this directly

Calls 12

getVerMethod · 0.95
LogDebugfFunction · 0.92
initMpFunction · 0.85
initVerFunction · 0.85
testCreateInodeFunction · 0.85
testCreateDentryFunction · 0.85
buildExtentKeyFunction · 0.85
testCreateVerFunction · 0.85
GetExtentEksMethod · 0.80
GetExtentsMethod · 0.65

Tested by

no test coverage detected