Skip to content

Commit 58da65f

Browse files
shiva-istariShivaji Kharse
andauthored
fix(backup): prevent duplicate predicates in backup manifest for vector indexes (#9679)
**Description** Fixed a bug in ProcessBackupRequest where vecPredMap[gid] was being built using predMap[gid] as the append base instead of vecPredMap[gid]. This caused all base predicates in the group to be duplicated in the manifest every time a vector predicate was found, making manifest.json grow larger and larger with each backup. With multiple vector predicates in the same group, each iteration also overwrote the previous result, so only the last vector predicate's supporting entries (__vector_entry, __vector_, __vector_dead) were kept the rest were silently lost. --------- Co-authored-by: Shivaji Kharse <shiva@Shivajis-MacBook-Pro.local>
1 parent 1cbd7ea commit 58da65f

File tree

4 files changed

+412
-4
lines changed

4 files changed

+412
-4
lines changed

dgraphtest/local_cluster.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,6 +1397,27 @@ func (c *LocalCluster) GetAlphaGrpcEndpoint(id int) (string, error) {
13971397

13981398
// CopyExportToHost copies exported files from the container to a host directory.
13991399
// It returns the paths to RDF/JSON files and schema files on the host.
1400+
func (c *LocalCluster) ReadFileFromContainer(containerPath string) ([]byte, error) {
1401+
ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
1402+
defer cancel()
1403+
1404+
ts, _, err := c.dcli.CopyFromContainer(ctx, c.alphas[0].cid(), containerPath)
1405+
if err != nil {
1406+
return nil, errors.Wrapf(err, "error copying file from container [%v]", c.alphas[0].cname())
1407+
}
1408+
defer ts.Close()
1409+
1410+
tr := tar.NewReader(ts)
1411+
if _, err := tr.Next(); err != nil {
1412+
return nil, errors.Wrap(err, "error reading tar header")
1413+
}
1414+
data, err := io.ReadAll(tr)
1415+
if err != nil {
1416+
return nil, errors.Wrap(err, "error reading file contents from tar stream")
1417+
}
1418+
return data, nil
1419+
}
1420+
14001421
func (c *LocalCluster) CopyExportToHost(exportDir, hostDir string) (dataFiles, schemaFiles []string, err error) {
14011422
ctx, cancel := context.WithTimeout(context.Background(), requestTimeout)
14021423
defer cancel()

0 commit comments

Comments
 (0)