You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@age.apache.org by GitBox <gi...@apache.org> on 2022/08/17 18:25:08 UTC

[GitHub] [age] ibrarahmad commented on a diff in pull request #246: AGE PG12.1.0 ALPHA

ibrarahmad commented on code in PR #246:
URL: https://github.com/apache/age/pull/246#discussion_r948206930


##########
src/backend/executor/cypher_set.c:
##########
@@ -136,41 +136,63 @@ static HeapTuple update_entity_tuple(ResultRelInfo *resultRelInfo,
         {
             ExecConstraints(resultRelInfo, elemTupleSlot, estate);
         }
-        /*
-        simple_table_tuple_update(resultRelInfo->ri_RelationDesc, 
-                                  GetCurrentCommandId(true), 
-                                  elemTupleSlot, estate->es_snapshot,
-                                  &update_indexes);
-        
-        if (resultRelInfo->ri_NumIndices > 0 && update_indexes)
-          //ExecInsertIndexTuples(elemTupleSlot, estate, false, NULL,
-          //                                       NIL);
-        */ 
-        // Insert the tuple normally
-        update_result = heap_update(resultRelInfo->ri_RelationDesc,
-                                    &(tuple->t_self), tuple,
+
+        result = table_tuple_update(resultRelInfo->ri_RelationDesc,
+                                    &tuple->t_self, elemTupleSlot,
                                     GetCurrentCommandId(true),
-                                    estate->es_crosscheck_snapshot, true, &hufd,
-                                    &lockmode);
+                                    //estate->es_output_cid,
+                                    estate->es_snapshot,// NULL,
+                                    estate->es_crosscheck_snapshot,
+                                    true /* wait for commit */ ,
+                                    &hufd, &lockmode, &update_indexes);
 
-        if (update_result != TM_Ok)
+        if (result == TM_SelfModified)
+        {
+            if (hufd.cmax != estate->es_output_cid)
+            {
+                ereport(ERROR,
+                        (errcode(ERRCODE_TRIGGERED_DATA_CHANGE_VIOLATION),
+                         errmsg("tuple to be updated was already modified")));
+            }
+
+            ExecCloseIndices(resultRelInfo);
+            estate->es_result_relation_info = saved_resultRelInfo;
+
+            return tuple;
+        }
+
+        if (result != TM_Ok)
         {
             ereport(ERROR, (errcode(ERRCODE_INTERNAL_ERROR),
-                    errmsg("Entity failed to be updated: %i", update_result)));
+                    errmsg("Entity failed to be updated: %i", result)));
         }
-        
-        &update_indexes = update_result == TM_Ok && !HeapTupleIsHeapOnly(tuple);
-        
+
         // Insert index entries for the tuple

Review Comment:
   Don't use "//" comments, it is prohibited in PostgreSQL code. You can always use /* */. 



##########
.gitignore:
##########
@@ -1,7 +1,6 @@
 *.o
 *.so
-.gitignore
 build.sh
 .idea
 .deps
-.DS_Store
+.DS_Store

Review Comment:
   Every file need to have one blank like at the end.



##########
.github/workflows/installcheck.yml:
##########
@@ -0,0 +1,40 @@
+name: PG12 Regression
+
+on:
+  push:
+    branches: [ '*' ]
+  pull_request:
+    branches: [ '*' ]
+
+jobs:
+  build:
+
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Get latest commit id of PostgreSQL 12
+        run: |
+          echo "PG_COMMIT_HASH=$(git ls-remote git://git.postgresql.org/git/postgresql.git refs/heads/REL_12_STABLE | awk '{print $1}')" >> $GITHUB_ENV
+
+      - name: Cache PostgreSQL 12
+        uses: actions/cache@v2
+        id: pg12cache
+        with:
+          path: ~/pg12
+          key: ${{ runner.os }}-v1-pg12-${{ env.PG_COMMIT_HASH }}
+
+      - name: Install PostgreSQL 12
+        if: steps.pg12cache.outputs.cache-hit != 'true'
+        run: |
+          git clone --depth 1 --branch REL_12_STABLE git://git.postgresql.org/git/postgresql.git ~/pg12source
+          cd ~/pg12source
+          ./configure --prefix=$HOME/pg12 CFLAGS="-std=gnu99 -ggdb -O0" --enable-cassert
+          make install -j$(nproc) > /dev/null
+
+      - uses: actions/checkout@v2
+      - name: Regression
+        run: |
+          export PG_CONFIG=$HOME/pg12/bin/pg_config 
+          make -j$(nproc)
+          make install
+          make installcheck

Review Comment:
   Every file need to have one blank like at the end.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org